Tripal 0.3b
Core Module Jobs API

Functions

 tripal_add_job ($job_name, $modulename, $callback, $arguments, $uid, $priority=10)
 tripal_get_module_active_jobs ($modulename)
 tripal_jobs_get_start_time ($job)
 tripal_jobs_get_end_time ($job)
 tripal_jobs_get_submit_date ($job)
 tripal_jobs_launch ($do_parallel=0)
 tripal_jobs_check_running ()
 tripal_jobs_rerun ($job_id)
 tripal_jobs_cancel ($job_id)

Detailed Description

Tripal offers a job management subsystem for managing tasks that may require an extended period of time for completion. Drupal uses a UNIX-based cron job to handle tasks such as checking the availability of updates, indexing new nodes for searching, etc. Drupal's cron uses the web interface for launching these tasks, however, Tripal provides several administrative tasks that may time out and not complete due to limitations of the web server. Examples including syncing of a large number of features between chado and Drupal. To circumvent this, as well as provide more fine-grained control and monitoring, Tripal uses a jobs management sub-system built into the Tripal Core module. It is anticipated that this functionality will be used for managing analysis jobs provided by future tools, with eventual support for distributed computing.

The Tripal jobs management system allows administrators to submit tasks to be performed which can then be launched through a UNIX command-line PHP script or cron job. This command-line script can be added to a cron entry along-side the Drupal cron entry for automatic, regular launching of Tripal jobs. The order of execution of waiting jobs is determined first by priority and second by the order the jobs were entered.

The API functions described below provide a programmatic interface for adding, checking and viewing jobs.


Function Documentation

tripal_add_job ( job_name,
modulename,
callback,
arguments,
uid,
priority = 10 
)

Adds a job to the Tripal Jbo queue

Parameters:
$job_nameThe human readable name for the job
$modulenameThe name of the module adding the job
$callbackThe name of a function to be called when the job is executed
$argumentsAn array of arguements to be passed on to the callback
$uidThe uid of the user adding the job
$priorityThe priority at which to run the job where the highest priority is 10 and the lowest priority is 1. The default priority is 10.
Returns:
The job_id of the registered job

Definition at line 47 of file jobs.php.

References $args, and $arguments.

Referenced by tripal_analysis_admin_validate(), tripal_core_chado_v1_11_load_form_submit(), tripal_core_gff3_load_form_submit(), tripal_cv_cvtermpath_form_validate(), tripal_cv_obo_form_submit(), tripal_feature_admin_validate(), tripal_feature_fasta_load_form_submit(), tripal_jobs_rerun(), tripal_library_admin_validate(), tripal_mviews_action(), tripal_organism_admin_validate(), and tripal_stock_admin_validate().

tripal_get_module_active_jobs ( modulename)

Returns a list of jobs associated with the given module

Parameters:
$modulenameThe module to return a list of jobs for
Returns:
An array of objects where each object describes a tripal job

Definition at line 110 of file jobs.php.

Referenced by get_tripal_analysis_admin_form_sync_set(), get_tripal_organism_admin_form_sync_set(), tripal_analysis_admin(), tripal_feature_admin(), tripal_library_admin(), tripal_organism_admin(), and tripal_stock_admin().

tripal_jobs_cancel ( job_id)

Cancel a Tripal Job currently waiting in the job queue

Parameters:
$job_idThe job_id of the job to be cancelled

Definition at line 422 of file jobs.php.

References $job.

tripal_jobs_check_running ( )

Returns a list of running tripal jobs

Returns:
and array of objects where each object describes a running job or false if no jobs are running

Definition at line 304 of file jobs.php.

References $job.

Referenced by tripal_jobs_launch().

tripal_jobs_get_end_time ( job)

Returns the end time for a given job

Parameters:
$jobAn object describing the job
Returns:
The end time of the job if it was already run and empty otherwise

Definition at line 220 of file jobs.php.

References $job.

Referenced by tripal_core_preprocess_tripal_core_job_view(), and tripal_jobs_report().

tripal_jobs_get_start_time ( job)

Returns the start time for a given job

Parameters:
$jobAn object describing the job
Returns:
The start time of the job if it was already run and either "Cancelled" or "Not Yet Started" otherwise

Definition at line 196 of file jobs.php.

References $job.

Referenced by tripal_core_preprocess_tripal_core_job_view(), and tripal_jobs_report().

tripal_jobs_get_submit_date ( job)

Returns the date the job was added to the queue

Parameters:
$jobAn object describing the job
Returns:
The date teh job was submitted

Definition at line 240 of file jobs.php.

References $job.

Referenced by tripal_core_preprocess_tripal_core_job_view(), and tripal_jobs_report().

tripal_jobs_launch ( do_parallel = 0)

A function used to manually launch all queued tripal jobs

Parameters:
$do_parallelA boolean indicating whether jobs should be attempted to run in parallel

Definition at line 252 of file jobs.php.

References $args, $do_parallel, $job, and tripal_jobs_check_running().

Referenced by runjob().

tripal_jobs_rerun ( job_id)

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

Parameters:
$job_idThe job_id of the job to be re-ran

Definition at line 401 of file jobs.php.

References $args, $job, $user, and tripal_add_job().

 All Classes Files Functions Variables