/usr/lib/python3/dist-packages/bioblend/galaxy/jobs/__init__.py is in python3-bioblend 0.7.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | """
Contains possible interactions with the Galaxy Jobs
"""
from bioblend.galaxy.client import Client
class JobsClient(Client):
def __init__(self, galaxy_instance):
self.module = 'jobs'
super(JobsClient, self).__init__(galaxy_instance)
def get_jobs(self):
"""
Get the list of jobs of the current user.
:rtype: list
:returns: list of dictionaries containing summary job information.
For example::
[{u'create_time': u'2014-03-01T16:16:48.640550',
u'exit_code': 0,
u'id': u'ebfb8f50c6abde6d',
u'model_class': u'Job',
u'state': u'ok',
u'tool_id': u'fasta2tab',
u'update_time': u'2014-03-01T16:16:50.657399'},
{u'create_time': u'2014-03-01T16:05:34.851246',
u'exit_code': 0,
u'id': u'1cd8e2f6b131e891',
u'model_class': u'Job',
u'state': u'ok',
u'tool_id': u'upload1',
u'update_time': u'2014-03-01T16:05:39.558458'}]
"""
return Client._get(self)
def show_job(self, job_id, full_details=False):
"""
Get details of a given job of the current user.
:type job_id: str
:param job_id: job ID
:type full_details: bool
:param full_details: when ``True``, the complete list of details for the
given job.
:rtype: dict
:return: A description of the given job.
For example::
{u'create_time': u'2014-03-01T16:17:29.828624',
u'exit_code': 0,
u'id': u'a799d38679e985db',
u'inputs': {u'input': {u'id': u'ebfb8f50c6abde6d',
u'src': u'hda'}},
u'model_class': u'Job',
u'outputs': {u'output': {u'id': u'a799d38679e985db',
u'src': u'hda'}},
u'params': {u'chromInfo': u'"/opt/galaxy-central/tool-data/shared/ucsc/chrom/?.len"',
u'dbkey': u'"?"',
u'seq_col': u'"2"',
u'title_col': u'["1"]'},
u'state': u'ok',
u'tool_id': u'tab2fasta',
u'update_time': u'2014-03-01T16:17:31.930728'}
"""
params = {}
if full_details:
params['full'] = full_details
return Client._get(self, id=job_id, params=params)
def get_state(self, job_id):
"""
Display the current state for a given job of the current user.
:type job_id: str
:param job_id: job ID
:rtype: str
:return: state of the given job among the following values: `new`,
`queued`, `running`, `waiting`, `ok`. If the state cannot be
retrieved, an empty string is returned.
.. versionadded:: 0.5.3
"""
return self.show_job(job_id).get('state', '')
def search_jobs(self, job_info):
"""
Return jobs for the current user based payload content.
:type job_info: dict
:param job_info: dictionary containing description of the requested job.
This is in the same format as a request to POST /api/tools would take
to initiate a job
:rtype: list
:returns: list of dictionaries containing summary job information of
the jobs that match the requested job run
This method is designed to scan the list of previously run jobs and find
records of jobs that had the exact some input parameters and datasets.
This can be used to minimize the amount of repeated work, and simply
recycle the old results.
"""
payload = job_info
url = self.gi._make_url(self)
url = '/'.join([url, "search"])
return Client._post(self, url=url, payload=payload)
|