Warning

This document is for an in-development version of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

galaxy.jobs.runners.util package

This module and its submodules contains utilities for running external processes and interfacing with job managers. This module should contain functionality shared between Galaxy and the Pulsar.

galaxy.jobs.runners.util.kill_pid(pid, use_psutil=True)[source]

Submodules

galaxy.jobs.runners.util.env module

galaxy.jobs.runners.util.env.env_to_statement(env)[source]

Return the abstraction description of an environment variable definition into a statement for shell script.

>>> env_to_statement(dict(name='X', value='Y'))
'X="Y"; export X'
>>> env_to_statement(dict(name='X', value='Y', raw=True))
'X=Y; export X'
>>> env_to_statement(dict(name='X', value='"A","B","C"'))
'X="\\"A\\",\\"B\\",\\"C\\""; export X'
>>> env_to_statement(dict(file="Y"))
'. "Y"'
>>> env_to_statement(dict(file="'RAW $FILE'", raw=True))
". 'RAW $FILE'"
>>> # Source file takes precedence
>>> env_to_statement(dict(name='X', value='"A","B","C"', file="S"))
'. "S"'
>>> env_to_statement(dict(execute="module load java/1.5.1"))
'module load java/1.5.1'

galaxy.jobs.runners.util.external module

galaxy.jobs.runners.util.external.parse_external_id(output, type=None)[source]

Attempt to parse the output of job submission commands for an external id.__doc__

>>> parse_external_id("12345.pbsmanager")
'12345.pbsmanager'
>>> parse_external_id('Submitted batch job 185')
'185'
>>> parse_external_id('Submitted batch job 185', type='torque')
'Submitted batch job 185'
>>> parse_external_id('submitted to cluster 125.')
'125'
>>> parse_external_id('submitted to cluster 125.', type='slurm')
>>>

galaxy.jobs.runners.util.kill module

galaxy.jobs.runners.util.kill.kill_pid(pid, use_psutil=True)[source]

galaxy.jobs.runners.util.pykube_util module

Interface layer for pykube library shared between Galaxy and Pulsar.

galaxy.jobs.runners.util.pykube_util.ensure_pykube()[source]
galaxy.jobs.runners.util.pykube_util.pykube_client_from_dict(params)[source]
galaxy.jobs.runners.util.pykube_util.produce_unique_k8s_job_name(app_prefix=None, instance_id=None, job_id=None)[source]
galaxy.jobs.runners.util.pykube_util.pull_policy(params)[source]
galaxy.jobs.runners.util.pykube_util.job_object_dict(params, job_name, spec)[source]

galaxy.jobs.runners.util.sudo module

galaxy.jobs.runners.util.sudo.sudo_popen(*args, **kwargs)[source]

Helper method for building and executing Popen command. This is potentially sensetive code so should probably be centralized.