Description
Extend <EnvironmentActions> with a third session action, onWrapTaskRun, that lets an environment template intercept and wrap a task's onRun action. The runtime provides the wrap action with the task's command, args, timeout, cancelation method, and environment variables as template variables (Task.Command, Task.Args, Task.Environment, Env.Action.Timeout). This enables environment templates to execute tasks inside containers, virtual machines, or other execution contexts without modifying the job template.
The primary motivation is container support: a Docker or Apptainer environment template can start a container in onEnter, run each task inside it via onWrapTaskRun, and stop it in onExit. Job templates remain portable across Conda, Rez, Docker, and Apptainer environments. The mechanism is general enough for remote execution, instrumentation, and privilege isolation use cases as well.
Specification version: 2023-09 extension WRAP_TASK_RUN. Depends on RFC 0002 and the EXPR extension's repr_sh() function from RFC 0006.
Roles
Workflow
Please close this tracking issue when the proposal enters the Released stage of the process.
Open Points
-
Single-layer vs. nested composition — Should multiple onWrapTaskRun actions compose as nested wrappers, or should only one active layer be allowed per session? The RFC recommends starting with a single-layer restriction for simplicity, relaxing it in a future RFC if real use cases for nesting emerge.
-
Task monitoring / watchdog — Container workloads can stall silently (GPU crash, application deadlock). Consider adding a Task.Monitor variable or periodic onMonitor action for health-checking wrapped processes (e.g., via docker stats). The RFC recommends deferring this to a future RFC, but designing onWrapTaskRun so a monitoring mechanism can be added without breaking changes.
The author is responsible to progress the RFC according to this checklist, and
apply the relevant labels to this issue.
Description
Extend
<EnvironmentActions>with a third session action,onWrapTaskRun, that lets an environment template intercept and wrap a task'sonRunaction. The runtime provides the wrap action with the task's command, args, timeout, cancelation method, and environment variables as template variables (Task.Command,Task.Args,Task.Environment,Env.Action.Timeout). This enables environment templates to execute tasks inside containers, virtual machines, or other execution contexts without modifying the job template.The primary motivation is container support: a Docker or Apptainer environment template can start a container in
onEnter, run each task inside it viaonWrapTaskRun, and stop it inonExit. Job templates remain portable across Conda, Rez, Docker, and Apptainer environments. The mechanism is general enough for remote execution, instrumentation, and privilege isolation use cases as well.Specification version:
2023-09extensionWRAP_TASK_RUN. Depends on RFC 0002 and the EXPR extension'srepr_sh()function from RFC 0006.Roles
Workflow
rfc/proposed)rfc/exploring)rfc/exploringandrfc/final-comments)rfc/accepted-future)rfc/accepted-draft)rfc/accepted-staged)rfc/released)Please close this tracking issue when the proposal enters the
Releasedstage of the process.Open Points
Single-layer vs. nested composition — Should multiple
onWrapTaskRunactions compose as nested wrappers, or should only one active layer be allowed per session? The RFC recommends starting with a single-layer restriction for simplicity, relaxing it in a future RFC if real use cases for nesting emerge.Task monitoring / watchdog — Container workloads can stall silently (GPU crash, application deadlock). Consider adding a
Task.Monitorvariable or periodiconMonitoraction for health-checking wrapped processes (e.g., viadocker stats). The RFC recommends deferring this to a future RFC, but designingonWrapTaskRunso a monitoring mechanism can be added without breaking changes.