|
@@ -116,7 +116,7 @@ function tripal_add_job($job_name, $modulename, $callback, $arguments, $uid, $pr
|
|
|
'modulename' => $modulename,
|
|
|
'callback' => $callback,
|
|
|
'status' => 'Waiting',
|
|
|
- 'submit_date' => REQUEST_TIME,
|
|
|
+ 'submit_date' => time(),
|
|
|
'uid' => $uid,
|
|
|
# The lower the number the higher the priority.
|
|
|
'priority' => $priority,
|
|
@@ -183,7 +183,7 @@ function tripal_get_job($job_id) {
|
|
|
*/
|
|
|
function tripal_is_job_running() {
|
|
|
|
|
|
- // iterate through each job that has not ended
|
|
|
+ // Iterate through each job that has not ended
|
|
|
// and see if it is still running. If it is not
|
|
|
// running but does not have an end_time then
|
|
|
// set the end time and set the status to 'Error'
|
|
@@ -201,7 +201,7 @@ function tripal_is_job_running() {
|
|
|
// the job is not running so terminate it
|
|
|
$record = new stdClass();
|
|
|
$record->job_id = $job->job_id;
|
|
|
- $record->end_time = REQUEST_TIME;
|
|
|
+ $record->end_time = time();
|
|
|
$record->status = 'Error';
|
|
|
$record->error_msg = 'Job has terminated unexpectedly.';
|
|
|
drupal_write_record('tripal_jobs', $record, 'job_id');
|
|
@@ -295,7 +295,7 @@ function tripal_max_jobs_exceeded($max_jobs) {
|
|
|
// the job is not running so terminate it
|
|
|
$record = new stdClass();
|
|
|
$record->job_id = $job->job_id;
|
|
|
- $record->end_time = REQUEST_TIME;
|
|
|
+ $record->end_time = time();
|
|
|
$record->status = 'Error';
|
|
|
$record->error_msg = 'Job has terminated unexpectedly.';
|
|
|
drupal_write_record('tripal_jobs', $record, 'job_id');
|
|
@@ -367,7 +367,7 @@ function tripal_cancel_job($job_id, $redirect = TRUE) {
|
|
|
if ($job->start_time == 0) {
|
|
|
$record = new stdClass();
|
|
|
$record->job_id = $job->job_id;
|
|
|
- $record->end_time = REQUEST_TIME;
|
|
|
+ $record->end_time = time();
|
|
|
$record->status = 'Cancelled';
|
|
|
$record->progress = '0';
|
|
|
drupal_write_record('tripal_jobs', $record, 'job_id');
|
|
@@ -462,7 +462,7 @@ function tripal_launch_job($do_parallel = 0, $job_id = NULL, $max_jobs = -1, $si
|
|
|
// set the start time for this job
|
|
|
$record = new stdClass();
|
|
|
$record->job_id = $job->job_id;
|
|
|
- $record->start_time = REQUEST_TIME;
|
|
|
+ $record->start_time = time();
|
|
|
$record->status = 'Running';
|
|
|
$record->pid = getmypid();
|
|
|
drupal_write_record('tripal_jobs', $record, 'job_id');
|
|
@@ -501,7 +501,7 @@ function tripal_launch_job($do_parallel = 0, $job_id = NULL, $max_jobs = -1, $si
|
|
|
print "Calling: $callback(" . implode(", ", $string_args) . ")\n";
|
|
|
call_user_func_array($callback, $args);
|
|
|
// set the end time for this job
|
|
|
- $record->end_time = REQUEST_TIME;
|
|
|
+ $record->end_time = time();
|
|
|
$record->status = 'Completed';
|
|
|
$record->progress = '100';
|
|
|
drupal_write_record('tripal_jobs', $record, 'job_id');
|