Absent Member.. Absent Member..
Absent Member..
940 views

Asynchronous Batch Job Response Time

Jump to solution

Hi,

 

I am stuck at a strange problem. There is a batch job for which we need to monitor the response time. This batch job is running at the backend and we have a URL to fetch the job details.

The URL is something like http://application.domain.com/contextpath/servlet?jobid=XXX

 

Now when I hit the URL, and if the job is running I get response as 'Job XXX: Running'

 

After multiple hits on the same URL, I can either get Job Status = 0 or 1 depending on pass or failed status. 

How can I loop the multiple hits and fetch the response time for whole batch execution using LR. Also the pass or fail status of the transaction will depend upon the job status returned.

Any help will be highly appreciated.

 

Thanks in advance,

Regards.

0 Likes
1 Solution

Accepted Solutions
Absent Member.
Absent Member.

Hello!

 

You can put the request into a while loop and repeat it until the result as you expect. If you enclose the following structure into transaction you will get the timing:

 

// register the command to analyse the server response
web_reg_find("Text=<your string>", "SaveCount=Wait_count", LAST );

// the request
web_url("saw.dll_6",
 . . .
 LAST);

// verify the result: wait or no wait
lr_output_message("There is a wait message %s", lr_eval_string("{Wait_count}"));

// loop to iterate the request until the final result is created
while (strcmp(lr_eval_string("{Wait_count}"), "0") != 0)
{
 // wait 10.000 miliseconds
 sleep (10000);

 // verify the result: wait or no wait
 web_reg_find("Text=<your string>", "SaveCount=Wait_count", LAST );

 // repeat the request
 web_url("saw.dll_6",
  . . .
  LAST);

 // verify the result: wait or no wait
 lr_output_message("There is a wait message %s", lr_eval_string("{Wait_count}"));
}

 

You may vary the number in the sleep() command.

 

Regards

Thomas

View solution in original post

3 Replies
Vice Admiral
Vice Admiral

Using a monitoring solution like HP SiteScope, you should be able to check that URL at regular intervals, or write a script to test the return value of that URL request, and get a reasonably accurate measurement of the batch time.

 

Shane Evans

0 Likes
Absent Member.
Absent Member.

Hello!

 

You can put the request into a while loop and repeat it until the result as you expect. If you enclose the following structure into transaction you will get the timing:

 

// register the command to analyse the server response
web_reg_find("Text=<your string>", "SaveCount=Wait_count", LAST );

// the request
web_url("saw.dll_6",
 . . .
 LAST);

// verify the result: wait or no wait
lr_output_message("There is a wait message %s", lr_eval_string("{Wait_count}"));

// loop to iterate the request until the final result is created
while (strcmp(lr_eval_string("{Wait_count}"), "0") != 0)
{
 // wait 10.000 miliseconds
 sleep (10000);

 // verify the result: wait or no wait
 web_reg_find("Text=<your string>", "SaveCount=Wait_count", LAST );

 // repeat the request
 web_url("saw.dll_6",
  . . .
  LAST);

 // verify the result: wait or no wait
 lr_output_message("There is a wait message %s", lr_eval_string("{Wait_count}"));
}

 

You may vary the number in the sleep() command.

 

Regards

Thomas

View solution in original post

Absent Member.. Absent Member..
Absent Member..

Thanks Thomas!!! This should do the trick.

 

Regards,

Vaibhav

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.