function removeResult($id)
{
    $q = Doctrine_Query::create()->delete('WPTResult r')->where('r.Id= ?', $id);
    $rows = $q->execute();
    $q->free(true);
    if ($rows > 0) {
        logOutput("[RemoveResultsWithZeros] Removing result Id: " . $id);
    }
}
Example #2
0
<?php

/**
 * The job processor scans the jobs db to find any job that is active and due to be run.
 * It also scans the results directory to see if any results are pending and will poll the wpt server
 * to see if the results are ready. If they are the results are downloaded. The xmlResult file is downloaded and
 * optionally the additional assets can be downloaded if the job was configured to do so.
 */
include_once 'monitor.inc';
include_once 'ec2_functions.inc';
include_once 'wpt_functions.inc';
include_once 'utils.inc';
require_once 'bootstrap.php';
$key = $_REQUEST['key'];
$configKey = getWptConfigFor('jobProcessorKey');
if ($configKey != $key) {
    print "Invalid Key";
    exit;
}
logOutput("[INFO] [ec2Processor] ec2 Processor checking Amazon EC2 Status", "ec2Processor.log");
// TODO: Make Only executes if EC2 integration is active
echo "Termination<br>";
terminateDeadEC2Testers();
echo "Adjustment<br>";
adjustEC2InstanceCountIfRequired();
?>
 
Example #3
0
include_once 'utils.inc';
require_once 'bootstrap.php';
$key = $_REQUEST['key'];
$configKey = getWptConfigFor('jobProcessorKey');
if ($configKey != $key) {
    print "Invalid Key";
    exit;
}
checkQueueGrowthCountAndEmailAlert();
try {
    $users = Doctrine_Core::getTable('User')->findAll();
    foreach ($users as $user) {
        if ($user->IsActive) {
            processJobsForUser($user['Id'], null, null, "Scheduled");
        }
    }
    // Process results for all
    processResultsForAll();
    $jobs = Doctrine_Core::getTable('WPTJob')->findAll();
    foreach ($jobs as $job) {
        processAlertsForJob($job['Id']);
    }
} catch (Exception $e) {
    error_log("[WPTMonitor] Failed while Listing Users: " . $wptResultId . " message: " . $e->getMessage());
    logOutput('[ERROR] [jobProcessor] Exception : ' . $e->getMessage());
}
updateQueueProcessRate();
checkTesterRatioAndEmailAlert();
?>
 
Example #4
0
<?php

error_reporting(0);
include 'monitor.inc';
include 'wpt_functions.inc';
include_once 'alert_functions.inc';
$resultId = $_REQUEST['id'];
logOutput("[INFO] [wptCallBack] WPT Callback called for result id " . $resultId);
processResultsForAll($resultId);
// Process alerts
// Get the job id
$q = Doctrine_Query::create()->select('r.Id')->from('WPTResult r')->where('r.WPTResultId = ?', $resultId)->setHydrationMode(Doctrine_Core::HYDRATE_ARRAY);
$job = $q->fetchOne();
$q->free(true);
if ($job) {
    processAlertsForJob($job['Id']);
}
Example #5
0
 /**
  * Get the number of instance of a particular AMI running in a give region.
  * @param $region
  * @param $ami
  * @return int Number of instances of AMI $ami running in region $region
  */
 public function getInstanceCount($region, $ami)
 {
     $ec2 = new AmazonEC2();
     $ec2->set_region($region);
     $response = $ec2->describe_instances(array('Filter' => array(array('Name' => 'image-id', 'Value' => $ami))));
     if ($response->status != "200") {
         logOutput("[ERROR] [WptmEC2.class] EC2 Error [" . $response->body->Errors->Error->Message . "] while getting instance count", "ec2Processor.log");
     }
     return sizeof($response->body->reservationSet->item);
 }
if ($configKey != $key) {
    print "Invalid Key";
    exit;
}
checkQueueGrowthCountAndEmailAlert();
try {
    $users = Doctrine_Core::getTable('User')->findAll();
    foreach ($users as $user) {
        if ($user->IsActive) {
            processJobsForUser($user['Id'], null, null, "Scheduled");
        }
    }
    // Process results for all
    processResultsForAll();
    logOutput('[Warning] [jobProcessor] Processing alerts for jobs disabled.');
    //    $jobs = Doctrine_Core::getTable('WPTJob')->findAll();
    //    foreach($jobs as $job){
    //      processAlertsForJob($job['Id']);
    //    }
} catch (Exception $e) {
    error_log("[WPTMonitor] Failed while Listing Users: " . $wptResultId . " message: " . $e->getMessage());
    logOutput('[ERROR] [jobProcessor] Exception : ' . $e->getMessage());
}
logOutput('[Warning] [jobProcessor] updating queue process rate disabled');
//  updateQueueProcessRate();
logOutput('[Warning] [jobProcessor] checking tester ratio disabled');
//  checkTesterRatioAndEmailAlert();
session_destroy();
?>