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-run (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 legacy/
tripal_core/ tripal_core.drush.inc - DEPRECATED. Executes jobs in the Tripal Jobs Queue.
- drush_tripal_trp_rerun_job in tripal/
tripal.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 legacy/
tripal_core/ api/ tripal_core.DEPRECATED.inc
2 string references to 'tripal_rerun_job'
- tripal_jobs_rerun in legacy/
tripal_core/ api/ tripal_core.DEPRECATED.inc - tripal_menu in tripal/
tripal.module - Implements hook_menu(). Defines all menu items needed by Tripal Core
File
- tripal/
api/ tripal.jobs.api.inc, line 245 - 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;
$job = new TripalJob();
$job->load($job_id);
$arguments = $job->getArguments();
$includes = $job->getIncludes();
$newJob = new Tripaljob();
try {
$job->create(array(
'job_name' => $job->getJobName(),
'modulename' => $job->getModuleName(),
'callback' => $job->getCallback(),
'arguments' => $arguments,
'uid' => $user_id,
'priority' => $job->getPriority(),
'includes' => $includes
));
// If no exceptions were thrown then we know the creation worked. So
// let the user know!
drupal_set_message(t("Job '%job_name' submitted.", array('%job_name' => $job->getJobName())));
// If this is the Tripal admin user then give a bit more information
// about how to run the job.
if (user_access('administer tripal')) {
$jobs_url = url("admin/tripal/tripal_jobs");
drupal_set_message(t("Check the <a href='!jobs_url'>jobs page</a> for status.",
array('!jobs_url' => $jobs_url)));
drupal_set_message(t("You can execute the job queue manually on the command line " .
"using the following Drush command: <br>drush trp-run-jobs --username=%uname --root=%base_path",
array('%base_path' => DRUPAL_ROOT, '%uname' => $user->name)));
}
if ($goto_jobs_page) {
drupal_goto("admin/tripal/tripal_jobs");
}
}
catch (Exception $e) {
drupal_set_message($e->getMessage(), 'error');
tripal_report_error('tripal', TRIPAL_ERROR, $e->getMessage());
}
}