runners Package

runners Package

Base classes for job runner plugins.

class galaxy.jobs.runners.AsynchronousJobRunner(app, nworkers, **kwargs)[source]

Bases: galaxy.jobs.runners.BaseJobRunner

Parent class for any job runner that runs jobs asynchronously (e.g. via a distributed resource manager). Provides general methods for having a thread to monitor the state of asynchronous jobs and submitting those jobs to the correct methods (queue, finish, cleanup) at appropriate times..

check_watched_item(job_state)[source]
check_watched_items()[source]

This method is responsible for iterating over self.watched and handling state changes and updating self.watched with a new list of watched job states. Subclasses can opt to override this directly (as older job runners will initially) or just override check_watched_item and allow the list processing to reuse the logic here.

fail_job(job_state)[source]
finish_job(job_state)[source]

Get the output/error for a finished job, pass to job_wrapper.finish and cleanup all the job’s temporary files.

handle_stop()[source]
mark_as_failed(job_state)[source]
mark_as_finished(job_state)[source]
monitor()[source]

Watches jobs currently in the monitor queue and deals with state changes (queued to running) and job completion.

monitor_job(job_state)[source]
shutdown()[source]

Attempts to gracefully shut down the monitor thread

class galaxy.jobs.runners.AsynchronousJobState(files_dir=None, job_wrapper=None, job_id=None, job_file=None, output_file=None, error_file=None, exit_code_file=None, job_name=None, job_destination=None)[source]

Bases: galaxy.jobs.runners.JobState

Encapsulate the state of an asynchronous job, this should be subclassed as needed for various job runners to capture additional information needed to communicate with distributed resource manager.

check_limits(runtime=None)[source]
cleanup()[source]
register_cleanup_file_attribute(attribute)[source]
running
class galaxy.jobs.runners.BaseJobRunner(app, nworkers, **kwargs)[source]

Bases: object

DEFAULT_SPECS = {'recheck_missing_job_retries': {'default': 0, 'map': <type 'int'>, 'valid': <function <lambda> at 0x7f85dd6d01b8>}}
build_command_line(job_wrapper, include_metadata=False, include_work_dir_outputs=True)[source]
get_job_file(job_wrapper, **kwds)[source]
get_work_dir_outputs(job_wrapper, job_working_directory=None)[source]

Returns list of pairs (source_file, destination) describing path to work_dir output file and ultimate destination.

mark_as_queued(job_wrapper)[source]
mark_as_resubmitted(job_state, info=None)[source]
parse_destination_params(params)[source]

Parse the JobDestination params dict and return the runner’s native representation of those params.

prepare_job(job_wrapper, include_metadata=False, include_work_dir_outputs=True)[source]

Some sanity checks that all runners’ queue_job() methods are likely to want to do

put(job_wrapper)[source]

Add a job to the queue (by job identifier), indicate that the job is ready to run.

queue_job(job_wrapper)[source]
recover(job, job_wrapper)[source]
run_next()[source]

Run the next item in the work queue (a job waiting to run)

shutdown()[source]

Attempts to gracefully shut down the worker threads

stop_job(job)[source]
url_to_destination(url)[source]

Convert a legacy URL to a JobDestination.

Job runner URLs are deprecated, JobDestinations should be used instead. This base class method converts from a URL to a very basic JobDestination without destination params.

class galaxy.jobs.runners.JobState[source]

Bases: object

Encapsulate state of jobs.

static default_exit_code_file(files_dir, id_tag)[source]
static default_job_file(files_dir, id_tag)[source]
runner_states = <galaxy.util.bunch.Bunch object>
set_defaults(files_dir)[source]
class galaxy.jobs.runners.RunnerParams(specs=None, params=None)[source]

Bases: galaxy.util.ParamsWithSpecs

cli Module

Job control via a command line interface (e.g. qsub/qstat), possibly over a remote connection (e.g. ssh).

class galaxy.jobs.runners.cli.ShellJobRunner(app, nworkers)[source]

Bases: galaxy.jobs.runners.AsynchronousJobRunner

Job runner backed by a finite pool of worker threads. FIFO scheduling

check_watched_items()[source]

Called by the monitor thread to look at each watched job and deal with state changes.

finish_job(job_state)[source]

For recovery of jobs started prior to standardizing the naming of files in the AsychronousJobState object

get_cli_plugins(shell_params, job_params)[source]
parse_destination_params(params)[source]
queue_job(job_wrapper)[source]

Create job script and submit it to the DRM

recover(job, job_wrapper)[source]

Recovers jobs stuck in the queued/running state when Galaxy started

runner_name = 'ShellRunner'
stop_job(job)[source]

Attempts to delete a dispatched job

url_to_destination(url)[source]

condor Module

Job control via the Condor DRM.

class galaxy.jobs.runners.condor.CondorJobRunner(app, nworkers)[source]

Bases: galaxy.jobs.runners.AsynchronousJobRunner

Job runner backed by a finite pool of worker threads. FIFO scheduling

check_watched_items()[source]

Called by the monitor thread to look at each watched job and deal with state changes.

queue_job(job_wrapper)[source]

Create job script and submit it to the DRM

recover(job, job_wrapper)[source]

Recovers jobs stuck in the queued/running state when Galaxy started

runner_name = 'CondorRunner'
stop_job(job)[source]

Attempts to delete a job from the DRM queue

drmaa Module

Job control via the DRMAA API.

class galaxy.jobs.runners.drmaa.DRMAAJobRunner(app, nworkers, **kwargs)[source]

Bases: galaxy.jobs.runners.AsynchronousJobRunner

Job runner backed by a finite pool of worker threads. FIFO scheduling

check_watched_items()[source]

Called by the monitor thread to look at each watched job and deal with state changes.

external_runjob(jobtemplate_filename, username)[source]

runs an external script the will QSUB a new job. The external script will be run with sudo, and will setuid() to the specified user. Effectively, will QSUB as a different user (then the one used by Galaxy).

get_native_spec(url)[source]

Get any native DRM arguments specified by the site configuration

queue_job(job_wrapper)[source]

Create job script and submit it to the DRM

recover(job, job_wrapper)[source]

Recovers jobs stuck in the queued/running state when Galaxy started

runner_name = 'DRMAARunner'
stop_job(job)[source]

Attempts to delete a job from the DRM queue

store_jobtemplate(job_wrapper, jt)[source]

Stores the content of a DRMAA JobTemplate object in a file as a JSON string. Path is hard-coded, but it’s no worse than other path in this module. Uses Galaxy’s JobID, so file is expected to be unique.

url_to_destination(url)[source]

Convert a legacy URL to a job destination

local Module

Job runner plugin for executing jobs on the local system via the command line.

class galaxy.jobs.runners.local.LocalJobRunner(app, nworkers)[source]

Bases: galaxy.jobs.runners.BaseJobRunner

Job runner backed by a finite pool of worker threads. FIFO scheduling

queue_job(job_wrapper)[source]
recover(job, job_wrapper)[source]
runner_name = 'LocalRunner'
stop_job(job)[source]

lwr Module

class galaxy.jobs.runners.lwr.LwrJobRunner(app, nworkers, **kwds)[source]

Bases: galaxy.jobs.runners.AsynchronousJobRunner

LWR Job Runner

check_pid(pid)[source]
check_watched_item(job_state)[source]
fail_job(job_state)[source]

Seperated out so we can use the worker threads for it.

finish_job(job_state)[source]
get_client(job_destination_params, job_id, env=[])[source]
get_client_from_state(job_state)[source]
get_client_from_wrapper(job_wrapper)[source]
get_input_files(job_wrapper)[source]
get_output_files(job_wrapper)[source]
queue_job(job_wrapper)[source]
recover(job, job_wrapper)[source]

Recovers jobs stuck in the queued/running state when Galaxy started

runner_name = 'LWRRunner'
shutdown()[source]
stop_job(job)[source]
url_to_destination(url)[source]

Convert a legacy URL to a job destination

pbs Module

tasks Module

class galaxy.jobs.runners.tasks.TaskedJobRunner(app, nworkers)[source]

Bases: galaxy.jobs.runners.BaseJobRunner

Job runner backed by a finite pool of worker threads. FIFO scheduling

queue_job(job_wrapper)[source]
recover(job, job_wrapper)[source]
runner_name = 'TaskRunner'
stop_job(job)[source]