function tripal_rerun_job

2.x tripal_core.jobs.api.inc tripal_rerun_job($job_id, $goto_jobs_page = TRUE)
3.x tripal.jobs.api.inc tripal_rerun_job($job_id, $goto_jobs_page = TRUE)

Set a job to be re-ran (ie: add it back into the job queue)

Parameters

$job_id: The job_id of the job to be re-ran

$goto_jobs_page: If set to TRUE then after the re run job is added Drupal will redirect to the jobs page

Related topics

5 calls to tripal_rerun_job()
drush_tripal_bulk_loader_tripal_loader_submit in tripal_bulk_loader/tripal_bulk_loader.drush.inc
Submit or Re-submit the given bulk loading job.
drush_tripal_core_tripal_jobs_rerun in tripal_core/tripal_core.drush.inc
DEPRECATED. Executes jobs in the Tripal Jobs Queue.
drush_tripal_core_trp_rerun_job in tripal_core/tripal_core.drush.inc
Executes jobs in the Tripal Jobs Queue.
tripal_bulk_loader_add_loader_job_form_submit in tripal_bulk_loader/includes/tripal_bulk_loader.loader.inc
Add Loader Job Form (Submit)
tripal_jobs_rerun in tripal_core/api/tripal_core.DEPRECATED.api.inc
2 string references to 'tripal_rerun_job'
tripal_core_menu in tripal_core/tripal_core.module
Implements hook_menu(). Defines all menu items needed by Tripal Core
tripal_jobs_rerun in tripal_core/api/tripal_core.DEPRECATED.api.inc

File

tripal_core/api/tripal_core.jobs.api.inc, line 319
Tripal offers a job management subsystem for managing tasks that may require an extended period of time for completion.

Code

function tripal_rerun_job($job_id, $goto_jobs_page = TRUE) {
  global $user;

  $user_id = $user->uid;

  $sql = "SELECT * FROM {tripal_jobs} WHERE job_id = :job_id";
  $results = db_query($sql, array(':job_id' => $job_id));
  $job = $results->fetchObject();
  // arguments for jobs used to be stored as plain string with a double colon
  // separating them.  But as of Tripal v2.0 the arguments are stored as
  // a serialized array.  To be backwards compatible, we should check for serialization
  // and if not then we will use the old style
  $args = unserialize($job->arguments);
  if (!$args) {
    $args = explode("::", $job->arguments);
  }
  $job_id = tripal_add_job($job->job_name, $job->modulename, $job->callback, $args, $user_id, $job->priority);

  if ($goto_jobs_page) {
    drupal_goto("admin/tripal/tripal_jobs");
  }
  return $job_id;
}