Current time: 03-05-2021, 06:15 AM Hello There, Guest! (LoginRegister)

Post Reply 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Number of Jobs in queue
06-12-2012, 12:01 PM
Post: #1
Number of Jobs in queue
I looked around for a script that would return the number of jobs on a queue for each location, but I couldn't find one.

So I just wrote up this quick script that others may find useful.

PHP Code:
 Returns the number of jobs in the queue for each location

$locations parse_ini_file('./settings/locations.ini'true);

header ('Content-type: text/xml');
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$processed = array();
foreach (
$locations as $key => $loc) {
//no local directory? Then there's nothing to query
if (!isset($loc['localDir'])) continue;
    if ((
$pos =  strpos($key':')) !== false) {
$key substr($key$pos);
    if (isset(
$processed[$key])) continue;
$processed[$key] = true;
$jobs count(scandir($loc['localDir'])) - 2//subtract directories from final count
echo "<location>\n";

It needs to be placed in the work directory
Find all posts by this user
Quote this message in a reply
06-12-2012, 12:11 PM
Post: #2
RE: Number of Jobs in queue
FYI, depending on what you want to do, you might be better off using the interfaces that produce XML reports:

/getLocations.php - Returns a list of all of the locations and number of tests in each (as well as counts at the different priority levels)

/getTesters.php - Returns information about the test machines at each of the locations

They both also have XSLT transforms so the output is readable in a browser (I spot check them on the public instance all the time):
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 

Forum Jump:

User(s) browsing this thread: 1 Guest(s)