tripal.job package

Module contents

class tripal.job.JobClient(tripalinstance, **requestArgs)

Bases: tripal.client.Client

Manage Tripal jobs

add_import_job(name, importer, input_file, arguments, priority=10)

Schedule a new import job

Parameters:
  • name (str) – The name of the job
  • importer (str) – The Tripal importer to use (e.g. FASTAImporter)
  • input_file (str) – Local path to the file to import
  • arguments (str) – A JSON string representing an array of arguments (e.g. “[‘some’, ‘arg’, 42, ‘foo’]”)
  • priority (int) – An integer score to prioritize the job
Return type:

dict

Returns:

Job information

add_job(name, module, callback, arguments, priority=10)

Schedule a new job

Parameters:
  • name (str) – The name of the job
  • module (str) – The Tripal module name to invoke
  • callback (str) – The Tripal module callback function to invoke
  • arguments (str) – A JSON string representing an array of arguments (e.g. “[‘some’, ‘arg’, 42, ‘foo’]”)
  • priority (int) – An integer score to prioritize the job
Return type:

dict

Returns:

Job information

get_jobs(job_id=None)

Get all jobs

Parameters:job_id (int) – job id
Return type:list of dict
Returns:Jobs information
get_logs(stdout, stderr)

Get job output

Parameters:
  • stdout (str) – Path to stdout file, as returned by run_jobs
  • stderr (str) – Path to stderr file, as returned by run_jobs
Return type:

dict

Returns:

Output information

run_jobs(wait=True)

Run jobs in queue. There is no way to trigger a single job execution.

Parameters:wait (bool) – Wait for job completion
Return type:dict
Returns:Job information
wait(job_id)

Wait for a job completion

Parameters:job_id (int) – job id
Return type:dict
Returns:Job information