Skip to content

runner_functions

no_op_submit_setup_call(*, wftask, workflow_dir_local, workflow_dir_remote, which_type)

Default (no-operation) interface of submit_setup_call in V2.

Source code in fractal_server/app/runner/v2/runner_functions.py
62
63
64
65
66
67
68
69
70
71
72
def no_op_submit_setup_call(
    *,
    wftask: WorkflowTaskV2,
    workflow_dir_local: Path,
    workflow_dir_remote: Path,
    which_type: Literal["non_parallel", "parallel"],
) -> dict:
    """
    Default (no-operation) interface of submit_setup_call in V2.
    """
    return {}

run_v2_task_non_parallel(*, images, zarr_dir, task, wftask, workflow_dir_local, workflow_dir_remote=None, executor, logger_name=None, submit_setup_call=no_op_submit_setup_call)

This runs server-side (see executor argument)

Source code in fractal_server/app/runner/v2/runner_functions.py
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
def run_v2_task_non_parallel(
    *,
    images: list[dict[str, Any]],
    zarr_dir: str,
    task: TaskV2,
    wftask: WorkflowTaskV2,
    workflow_dir_local: Path,
    workflow_dir_remote: Optional[Path] = None,
    executor: Executor,
    logger_name: Optional[str] = None,
    submit_setup_call: Callable = no_op_submit_setup_call,
) -> TaskOutput:
    """
    This runs server-side (see `executor` argument)
    """

    if workflow_dir_remote is None:
        workflow_dir_remote = workflow_dir_local
        logging.warning(
            "In `run_single_task`, workflow_dir_remote=None. Is this right?"
        )
        workflow_dir_remote = workflow_dir_local

    executor_options = _get_executor_options(
        wftask=wftask,
        workflow_dir_local=workflow_dir_local,
        workflow_dir_remote=workflow_dir_remote,
        submit_setup_call=submit_setup_call,
        which_type="non_parallel",
    )

    function_kwargs = dict(
        zarr_urls=[image["zarr_url"] for image in images],
        zarr_dir=zarr_dir,
        **(wftask.args_non_parallel or {}),
    )
    future = executor.submit(
        functools.partial(
            run_single_task,
            wftask=wftask,
            command=task.command_non_parallel,
            workflow_dir_local=workflow_dir_local,
            workflow_dir_remote=workflow_dir_remote,
        ),
        function_kwargs,
        **executor_options,
    )
    output = future.result()
    if output is None:
        return TaskOutput()
    else:
        return _cast_and_validate_TaskOutput(output)