ソースを参照

Issue #72: Updating API to include 2.1 improvements: 78846a2

Stephen Ficklin 7 年 前
コミット
71985c6182
2 ファイル変更10 行追加5 行削除
  1. 5 4
      tripal/api/tripal.jobs.api.inc
  2. 5 1
      tripal/tripal.drush.inc

+ 5 - 4
tripal/api/tripal.jobs.api.inc

@@ -345,12 +345,12 @@ function tripal_launch_job($do_parallel = 0, $job_id = NULL, $max_jobs = -1, $si
   // First check if any jobs are currently running if they are, don't continue,
   // we don't want to have more than one job script running at a time.
   if (!$do_parallel and tripal_is_job_running()) {
-    print "Jobs are still running. Use the --parallel=1 option with the Drush command to run jobs in parallel.\n";
+    print date('Y-m-d H:i:s') . ": Jobs are still running. Use the --parallel=1 option with the Drush command to run jobs in parallel.";
     return;
   }
 
   if ($do_parallel && tripal_max_jobs_exceeded($max_jobs)) {
-    print "At least $max_jobs jobs are still running. At least one of these jobs much complete before a new job can start.\n";
+    print date('Y-m-d H:i:s') . ": More than $max_jobs jobs are still running. At least one of these jobs much complete before a new job can start.";
     return;
   }
 
@@ -380,7 +380,8 @@ function tripal_launch_job($do_parallel = 0, $job_id = NULL, $max_jobs = -1, $si
     ";
     $jobs = db_query($sql);
   }
-  print "There are " . $jobs->rowCount() . " jobs queued.\n";
+  print date('Y-m-d H:i:s') . ": There are " . $job_res->rowCount() . " jobs queued.\n";
+
   foreach ($jobs as $jid) {
 
     $job_id = $jid->job_id;
@@ -408,7 +409,7 @@ function tripal_launch_job($do_parallel = 0, $job_id = NULL, $max_jobs = -1, $si
 
     // Run the job
     $callback = $job->getCallback();
-    print "Calling Job #$job_id: $callback(" . implode(", ", $string_args) . ")\n";
+    print date('Y-m-d H:i:s') .": Calling: $callback(" . implode(", ", $string_args) . ")\n";
     try {
       $job->run();
     }

+ 5 - 1
tripal/tripal.drush.inc

@@ -123,6 +123,7 @@ function drush_tripal_set_user($username) {
     $results = db_query($sql, array(':name' => $username));
     $u = $results->fetchObject();
     if (!$u) {
+      drush_print(date('Y-m-d H:i:s'));
       drush_print('ERROR: Please provide a valid username (--username argument) for running this job.');
       exit;
     }
@@ -131,6 +132,7 @@ function drush_tripal_set_user($username) {
     return $u->uid;
   }
   else {
+    drush_print(date('Y-m-d H:i:s'));
     drush_print('ERROR: Please provide a username (--username argument) for running this job.');
     exit;
   }
@@ -199,7 +201,7 @@ function drush_tripal_trp_rerun_job() {
   // --username argument for the fture.
   $user = drush_get_option('user');
   $uname = drush_get_option('username');
-  print "USER: '$user', UNAME: '$uname'\n";
+  print date('Y-m-d H:i:s') . ": USER: '$user', UNAME: '$uname'\n";
   if ($user and is_numeric($user)) {
   }
   elseif ($user) {
@@ -259,9 +261,11 @@ function drush_tripal_trp_get_currjob() {
         "Process ID: " . $job->pid . "\n" .
         "Progress: " . $job->progress . "%\n".
         "Current Date: " . date('Y-m-d H:i:s') . "\n";
+    drush_print(date('Y-m-d H:i:s'));
     drush_print($output);
   }
   if (!$job_pid) {
+    drush_print(date('Y-m-d H:i:s'));
     drush_print('There are currently no running jobs.');
   }
   //log to the command line with an OK status