Skip to content

child

etl_craft.execution.child

The process one task attempt runs in: python -m etl_craft.execution.child.

run --task_code starts it with the config file and the task_run_id of the attempt, and everything it writes (its own log records and the handler's output) is captured into the attempt's log file. It runs the task's handler and records the outcome on the task's row. If it dies before recording anything, the process that started it records the task FAILED.

As a process (run_as_process) it turns SIGTERM into KeyboardInterrupt, so what the handler wrote is flushed before it is stopped, and it exits as soon as the outcome is recorded, without waiting for threads a script left running.

parse_args

parse_args(argv: Sequence[str] | None = None) -> argparse.Namespace

Parse the task process's arguments.

main

main(argv: Sequence[str] | None = None) -> int

Run one task attempt; return 0 on success, else the exit status of what failed.

run_handler

run_handler(engine: Engine, context: TaskContext) -> int

Run context's handler and record its outcome on the task's row.

run_as_process

run_as_process(argv: Sequence[str] | None = None) -> NoReturn

Run main as the task process and exit with its status as soon as it returns.

exit_now

exit_now(code: int) -> NoReturn

Flush the output and logs, and exit with code without waiting for other threads.

The outcome is recorded by then, so a thread a script left running (a client's pool, say) only held the task's slot. It is named in the log, then ends with the process.