Skip to content

Commit

Permalink
Merge pull request #5719 from grondo/shell.post-init
Browse files Browse the repository at this point in the history
shell: add `shell.post-init` plugin calllback topic between `shell.init` and first `task.init`
  • Loading branch information
mergify[bot] committed Feb 5, 2024
2 parents 91bd396 + 73b47bb commit 96ff0f4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions doc/man1/flux-shell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ execution of the job:
* change working directory to the cwd of the job
* enter a barrier to ensure shell initialization is complete on all shells
* emit ``shell.init`` event to exec.eventlog
* call ``shell.post-init`` plugin callbacks
* create all local tasks. For each task, the following procedure is used

- call ``task.init`` plugin callback
Expand Down Expand Up @@ -142,6 +143,10 @@ topics:
**jobspec** and **R** from the KVS, but before any tasks
are started.

**shell.post-init**
Called after the shell initialization barrier has completed, but
before starting any tasks.

**task.init**
Called for each task after the task info has been constructed
but before the task is executed.
Expand Down
10 changes: 10 additions & 0 deletions src/shell/shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,11 @@ static int shell_init (flux_shell_t *shell)
return plugstack_call (shell->plugstack, "shell.init", NULL);
}

static int shell_post_init (flux_shell_t *shell)
{
return plugstack_call (shell->plugstack, "shell.post-init", NULL);
}

static int shell_task_init (flux_shell_t *shell)
{
return plugstack_call (shell->plugstack, "task.init", NULL);
Expand Down Expand Up @@ -1618,6 +1623,11 @@ int main (int argc, char *argv[])
&& shell_eventlogger_emit_event (shell.ev, "shell.init") < 0)
shell_die_errno (1, "failed to emit event shell.init");

/* Call shell.post-init plugins.
*/
if (shell_post_init (&shell) < 0)
shell_die_errno (1, "shell_post_init");

/* Create tasks
*/
if (!(shell.tasks = zlist_new ()))
Expand Down

0 comments on commit 96ff0f4

Please sign in to comment.