dragon.workflows.batch.batch.MakeTask

class MakeTask[source]

Bases: object

Note on terminology: we use the terms “process” and “resolve” in a number of places in this class and in helper functions for this class. In general, processing a value refers to creating update-tuples at import-time. Update-tuples are applied at both import-time and call-time. Resolving a value refers to evaluating a function defined in the PTD file to get a specific value. Values are currently only resolved at call-time, but it would make sense to resolve anything we can at import-time to avoid the cost at call-time.

__init__(batch: Batch, ptd: dict , real_import_args: tuple , real_import_kwargs: dict ) None [source]

Initialize a MakeTask object. MakeTask objects are callable and return either (1) a new task described by the parameterized task descriptor (ptd), or (2) a proxy object for the task (reprsented as a ProxyObj). In the second case, calling the MakeTask object is supposed to simulate calling a function that runs a task described by ptd (the same task that’s returned in the first case). The proxy object represents the return value from the task. Consequently, the proxy object defines (almost) all of its dunder methods so that a batch fence is called if output from the task needs to be accessed, and then runs the dunder method with the proxy object replaced by the actual return value.

Parameters:
  • batch (Batch) – The batch that will run the generated task.

  • ptd (dict ) – The Parameterized Task Descriptor used to describe the task.

  • real_import_args – The actual import-time positional arguments obtained from the call

to import_func. :type real_import_args: tuple :param real_import_kwargs: The actual import-time keyword arguments obtained from the call to import_func.. :type real_import_kwargs: dict

Returns:

Returns None.

Return type:

None

Methods

__init__(batch, ptd, real_import_args, ...)

Initialize a MakeTask object.

__init__(batch: Batch, ptd: dict , real_import_args: tuple , real_import_kwargs: dict ) None [source]

Initialize a MakeTask object. MakeTask objects are callable and return either (1) a new task described by the parameterized task descriptor (ptd), or (2) a proxy object for the task (reprsented as a ProxyObj). In the second case, calling the MakeTask object is supposed to simulate calling a function that runs a task described by ptd (the same task that’s returned in the first case). The proxy object represents the return value from the task. Consequently, the proxy object defines (almost) all of its dunder methods so that a batch fence is called if output from the task needs to be accessed, and then runs the dunder method with the proxy object replaced by the actual return value.

Parameters:
  • batch (Batch) – The batch that will run the generated task.

  • ptd (dict ) – The Parameterized Task Descriptor used to describe the task.

  • real_import_args – The actual import-time positional arguments obtained from the call

to import_func. :type real_import_args: tuple :param real_import_kwargs: The actual import-time keyword arguments obtained from the call to import_func.. :type real_import_kwargs: dict

Returns:

Returns None.

Return type:

None