Package arvados

Sub-modules

arvados.api

Arvados API client …

arvados.arvfile
arvados.cache
arvados.collection
arvados.commands
arvados.config
arvados.crunch
arvados.diskcache
arvados.errors
arvados.events
arvados.keep
arvados.retry

Utilities to retry operations …

arvados.safeapi

Thread-safe wrapper for an Arvados API client …

arvados.stream
arvados.timer
arvados.util
arvados.vocabulary

Functions

def current_job(num_retries=5)
def current_task(num_retries=5)
def get_job_param_mount(*args)
def get_task_param_mount(*args)
def getjobparam(*args)
def task_set_output(self, s, num_retries=5)

Classes

class JobTask (parameters={}, runtime_constraints={})
Expand source code
class JobTask(object):
    def __init__(self, parameters=dict(), runtime_constraints=dict()):
        print("init jobtask %s %s" % (parameters, runtime_constraints))
class job_setup
Expand source code
class job_setup(object):
    @staticmethod
    def one_task_per_input_file(if_sequence=0, and_end_task=True, input_as_path=False, api_client=None):
        if if_sequence != current_task()['sequence']:
            return

        if not api_client:
            api_client = api('v1')

        job_input = current_job()['script_parameters']['input']
        cr = CollectionReader(job_input, api_client=api_client)
        cr.normalize()
        for s in cr.all_streams():
            for f in s.all_files():
                if input_as_path:
                    task_input = os.path.join(job_input, s.name(), f.name())
                else:
                    task_input = f.as_manifest()
                new_task_attrs = {
                    'job_uuid': current_job()['uuid'],
                    'created_by_job_task_uuid': current_task()['uuid'],
                    'sequence': if_sequence + 1,
                    'parameters': {
                        'input':task_input
                        }
                    }
                api_client.job_tasks().create(body=new_task_attrs).execute()
        if and_end_task:
            api_client.job_tasks().update(uuid=current_task()['uuid'],
                                       body={'success':True}
                                       ).execute()
            exit(0)

    @staticmethod
    def one_task_per_input_stream(if_sequence=0, and_end_task=True):
        if if_sequence != current_task()['sequence']:
            return
        job_input = current_job()['script_parameters']['input']
        cr = CollectionReader(job_input)
        for s in cr.all_streams():
            task_input = s.tokens()
            new_task_attrs = {
                'job_uuid': current_job()['uuid'],
                'created_by_job_task_uuid': current_task()['uuid'],
                'sequence': if_sequence + 1,
                'parameters': {
                    'input':task_input
                    }
                }
            api('v1').job_tasks().create(body=new_task_attrs).execute()
        if and_end_task:
            api('v1').job_tasks().update(uuid=current_task()['uuid'],
                                       body={'success':True}
                                       ).execute()
            exit(0)

Static methods

def one_task_per_input_file(if_sequence=0, and_end_task=True, input_as_path=False, api_client=None)
def one_task_per_input_stream(if_sequence=0, and_end_task=True)