Skip to content

_job

_write_shutdown_file(*, job)

Write job's shutdown file.

Parameters:

Name Type Description Default
job Union[ApplyWorkflow, JobV2]
required

Note: we are not marking the job as failed (by setting its status attribute) here, since this will be done by the runner backend as soon as it detects the shutdown-trigerring file and performs the actual shutdown.

Source code in fractal_server/app/routes/aux/_job.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
def _write_shutdown_file(*, job: Union[ApplyWorkflow, JobV2]):
    """
    Write job's shutdown file.

    Args:
        job:

    Note: we are **not** marking the job as failed (by setting its `status`
    attribute) here, since this will be done by the runner backend as soon as
    it detects the shutdown-trigerring file and performs the actual shutdown.
    """
    shutdown_file = Path(job.working_dir) / SHUTDOWN_FILENAME
    with shutdown_file.open("w") as f:
        f.write(f"Trigger executor shutdown for {job.id=}.")