Browse Source

Merge remote-tracking branch 'origin/7.x-3.x-installprofile' into 7.x-3.x

Stephen Ficklin 7 years ago
parent
commit
7dd9325d6a

+ 40 - 37
tripal/tripal.drush.inc

@@ -19,32 +19,6 @@
  *
  * @ingroup tripal_drush
  */
-function tripal_drush_help($command) {
-  switch ($command) {
-
-    // TRIPAL JOBS
-    case 'trp-run-jobs':
-      return dt('Launches pending jobs waiting in the queue.');
-      break;
-    case 'trp-rerun-job':
-      return dt('Rerun a job in the queue.');
-      break;
-    case 'trp-get-currjob':
-      return dt('Returns details about the currently running tripal job including percent complete.');
-      break;
-    // Placeholders for unimplmeneted jobs
-    case 'trp-show-job':
-      break;
-    case 'trp-revert-jobs':
-      break;
-    case 'trp-cancel-job':
-      break;
-    case 'trp-list-jobs':
-      break;
-
-  }
-}
-
 /**
  * Registers a drush command and constructs the full help for that command.
  *
@@ -186,6 +160,39 @@ function drush_tripal_trp_run_jobs() {
   }
 }
 
+
+/**
+ * Executes jobs in the Tripal Jobs Queue.
+ *
+ * Executed when 'drush trp-run-job' is called.
+ *
+ * @ingroup tripal_drush
+ */
+function drush_tripal_trp_run_jobs_install($username) {
+  $parallel = drush_get_option('parallel');
+  $job_id   = drush_get_option('job_id');
+  $max_jobs = drush_get_option('max_jobs', -1);
+  $single   = drush_get_option('single', 0);
+
+  drush_tripal_set_user($username);
+
+  drush_print("\n" . date('Y-m-d H:i:s'));
+  if ($parallel) {
+    drush_print("Tripal Job Launcher (in parallel)");
+    if ($max_jobs !== -1) drush_print("Maximum number of jobs is " . $max_jobs);
+    drush_print("Running as user '$username'");
+    drush_print("-------------------");
+    tripal_launch_job($parallel, $job_id, $max_jobs, $single);
+  }
+  else {
+    drush_print("Tripal Job Launcher");
+    drush_print("Running as user '$username'");
+    drush_print("-------------------");
+    tripal_launch_job(0, $job_id, $max_jobs, $single);
+  }
+}
+
+
 /**
  * Executes jobs in the Tripal Jobs Queue.
  *
@@ -254,13 +261,13 @@ function drush_tripal_trp_get_currjob() {
   foreach ($jobs as $job) {
     $job_pid = $job->pid;
     $output = "Name: " . $job->job_name . "\n" .
-        "Submitted: " . date(DATE_RFC822, $job->submit_date) . "\n" .
-        "Started: " . date(DATE_RFC822, $job->start_time) . "\n" .
-        "Module: " . $job->modulename . "\n" .
-        "Callback: " . $job->callback . "\n" .
-        "Process ID: " . $job->pid . "\n" .
-        "Progress: " . $job->progress . "%\n".
-        "Current Date: " . date('Y-m-d H:i:s') . "\n";
+      "Submitted: " . date(DATE_RFC822, $job->submit_date) . "\n" .
+      "Started: " . date(DATE_RFC822, $job->start_time) . "\n" .
+      "Module: " . $job->modulename . "\n" .
+      "Callback: " . $job->callback . "\n" .
+      "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);
   }
@@ -271,7 +278,3 @@ function drush_tripal_trp_get_currjob() {
   //log to the command line with an OK status
   drush_log('Running tripal-current-job', 'ok');
 }
-
-
-
-

+ 17 - 0
tripal_chado/includes/setup/tripal_chado.setup.inc

@@ -62,6 +62,23 @@ function tripal_chado_prepare_form_submit($form, $form_state) {
    }
 }
 
+/**
+ * Submit function for the tripal_chado_prepare_form().
+ *
+ * @param $form
+ * @param $form_state
+ */
+function tripal_chado_prepare_drush_submit() {
+  $args = array();
+  $includes = array(
+    module_load_include('inc', 'tripal_chado', 'includes/setup/tripal_chado.setup'),
+  );
+  tripal_add_job('Prepare Chado', 'tripal_chado',
+    'tripal_chado_prepare_chado', $args,
+    1, 10, $includes);
+
+}
+
 /**
  *
  */

+ 11 - 0
tripal_chado/includes/tripal_chado.install.inc

@@ -186,6 +186,17 @@ function tripal_chado_load_form_submit($form, &$form_state) {
     'tripal_chado_install_chado', $args, $user->uid, 10, $includes);
 }
 
+/**
+ * Submit Load Chado Schema Form
+ *
+ * @ingroup tripal_chado
+ */
+function tripal_chado_load_drush_submit($version) {
+  $args = array($version);
+  $includes = array(module_load_include('inc', 'tripal_chado', 'includes/tripal_chado.install'));
+  tripal_add_job($version, 'tripal_chado',
+    'tripal_chado_install_chado', $args, 1, 10, $includes);
+}
 /**
  * Install Chado Schema
  *