job shell: add flux_shell_t and completion references #2240
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses #2237.
I apologize in advance because this will be a difficult PR to review. I attempt to make a minor advance by adding a
struct flux_shell
structure to contain the independingio
info
andpmi
structures used by the various components of the shell, but ended up making more changes than I wanted. Perhaps with the luxury of more time, this PR could be made cleaner, but hopefully after some rounds of feedback this approach could be acceptable.As noted above, this branch adds a new
struct flux_shell
structure as container for the most of the other structures used by the shell. This structure can then be passed to callbacks that may require access to multiple shell components and data, without requiring those callers to use custom structures or push multiple pointers into the reactor or handle aux hashes.The
struct flux_shell
may also serve as an opaque handle for plugins in the future (along with a set of accessors as yet unwritten), and thus aflux_shell_t
typedef is used as the start of a public interface. Later when we need this we can installflux/shell.h
and move thestruct flux_shell
definition internal.Once the
flux_shell_t
structure was defined, many of theinit
functions were updated to take this function as an argument. This resulted in cascading changes that, unfortunately, come in one big commit. To help review, here's a summary of the changes:shell_parse_cmdline()
flux_shell_t
shell->jobid
flux_shell_t
intoshell_finalize()
jobspec
andR
fully intoshell_info_create()
(whether set on cmdline or fetched via kvs) (this is probably a majority of the code change, since some functions were moved fromshell.c
toinfo.c
)Finally, to address #2237, a concept from
wrexecd
was borrowed to add a "completion reference" interface for the shell's reactor. Once all completion refs that are taken are dropped, the shell's reactor is manually stopped withflux_reactor_stop()
. The references are also named as a future debugging aid. Initially, a reference is taken for each task, and released in the task completion handler.Fixes #2237.