tasks

tasks

The tasks module holds the TaskFiles class which organizes input and output paths and the Task class for steps in the runmanager.

Classes

Name Description
AutoFillDict Dictionary that gets populated by calling get_missing.
Task A task to be performed as as a step in the RunManager.
TaskFiles Class for Task input and output files and directories.

AutoFillDict

tasks.AutoFillDict(self, get_missing)

Dictionary that gets populated by calling get_missing.

Task

tasks.Task(self, runmng, f, kwargs=None, out=None)

Parameters:

runmng Runmanager instance from which the task is called f Function that will be called when the task is called kwargs kwargs to be passed to f out If not None, an output dir will be created with this name

TaskFiles

tasks.TaskFiles(get_latest, input=field(default_factory=dict), output=field(default_factory=dict), outputdir=Path(), logger=logging.getLogger('kimmdy.basetask'))

Atributes

get_latest: Runmanager.get_latest function that returns paths to the latest file of given type. input: Input file paths for a Task. Is populated by get_latest or manually. output: Output file paths for a Task. Is populated by runmanager._discover_output_files or manually. outputdir: Output directory for a Task. Typically populated by create_task_directory called by Task. logger: Logger for a Task. Initialized in create_task_directory.

Examples

>>> class run():
>>>     def get_latest(self, s):
>>>         return f"latest {s}"
>>> runmng = run()
>>> files = TaskFiles(runmng)
>>> files.input
>>> files.input["top"]
{'top': 'latest top'}

Functions

Name Description
create_task_directory Creates TaskFiles object, output directory, logger and symlinks ff.

create_task_directory

tasks.create_task_directory(runmng, postfix)

Creates TaskFiles object, output directory, logger and symlinks ff.

Gets called when a Task is called (from the runmanager.tasks queue).

Back to top