Преглед на файлове

Fixed bug in job time stamps

Stephen Ficklin преди 8 години
родител
ревизия
9a34e7512e
променени са 3 файла, в които са добавени 17 реда и са изтрити 15 реда
  1. 7 7
      tripal_core/api/tripal_core.jobs.api.inc
  2. 9 7
      tripal_core/includes/tripal_core.jobs.inc
  3. 1 1
      tripal_feature/includes/tripal_feature.chado_node.inc

+ 7 - 7
tripal_core/api/tripal_core.jobs.api.inc

@@ -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');

+ 9 - 7
tripal_core/includes/tripal_core.jobs.inc

@@ -75,13 +75,13 @@ function tripal_jobs_report_form($form, &$form_state = NULL) {
     '#title'         => t('Filter by Job Status'),
     '#default_value' => $default_status,
     '#options' => array(
-    0           => 'All Jobs',
-    'Running'   => 'Running',
-    'Waiting'   => 'Waiting',
-    'Completed' => 'Completed',
-    'Cancelled' => 'Cancelled',
-    'Error'     => 'Error',
-  ),
+      0           => 'All Jobs',
+      'Running'   => 'Running',
+      'Waiting'   => 'Waiting',
+      'Completed' => 'Completed',
+      'Cancelled' => 'Cancelled',
+      'Error'     => 'Error',
+    ),
   );
   $form['job_name'] = array(
     '#type'          => 'textfield',
@@ -177,6 +177,8 @@ function tripal_jobs_report() {
     $end = tripal_get_job_end($job);
     $cancel_link = '';
     $execute_link = '';
+
+    // If the job hasn't started then provide a 'Cancel' and 'Execute' link.
     if ($job->start_time == 0 and $job->end_time == 0) {
       $cancel_link = "<a href=\"" . url("admin/tripal/tripal_jobs/cancel/" . $job->job_id) . "\">Cancel</a><br />";
       $execute_link = "<a href=\"" . url("admin/tripal/tripal_jobs/execute/" . $job->job_id) . "\">Execute</a><br />";

+ 1 - 1
tripal_feature/includes/tripal_feature.chado_node.inc

@@ -233,7 +233,7 @@ function chado_feature_form($node, &$form_state) {
 
   // RELATIONSHIPS FORM
   //---------------------------------------------
-  $relationship_cv = tripal_get_default_cv('sequence', 'type_id');
+  $relationship_cv = tripal_get_default_cv('feature_relationship', 'type_id');
   $cv_id = $relationship_cv ? $relationship_cv->cv_id : NULL;
   $details = array(
     'relationship_table' => 'feature_relationship',