flux.job.directives module¶
-
class
flux.job.directives.
Directive
(value, lineno=- 1)¶ Bases:
object
This class represents a single job submission directive processed from an input file or batch script. Input values to the constructor should have the sentinel stripped, and are then split using Python's shlex module to provide familiarity UNIX shell syntax and quoting for argument. The first argument after shell lexing determines the Directive type or "action".
At this time the only supported actions are "SETARGS", which indicates an args list to pass through to the submission utility, and NOOP, which is an empty directive.
If lineno is provided, it is used in error messages to indicate to the user more detail about the failing line (e.g. shell parsing error).
- Parameters
value (str) -- A preprocessed directive with sentinel removed
lineno (int, optional) -- The source line number of the current directive
-
lineno
¶ line number associated with directive
- Type
int
-
args
¶ list of directive arguments
- Type
list
-
action
¶ the directive type or instruction to the submission utility.
- Type
str
-
class
flux.job.directives.
DirectiveParser
(inputfile)¶ Bases:
object
RFC 36 submission directive parser.
The DirectiveParser looks for sentinels matching the pattern specified in RFC 36 in an input stream and extracts each line or quoted multiline into a Directive object. Single line strings are split into multiple tokens by Python's shlex module, which allows lines to contain familiar shell quoting and comments. As a convenience, inline triple quoting is also supported.
- Parameters
inputfile (
io.TextIOWrapper
) --
-
directives
¶ list of Directive objects
- Type
list
-
script
¶ the script to submit
- Type
str
-
append
(value, lineno)¶ Append one Directive
-
triplequote
(value)¶ Escape quotes within triple quotes (single or double) so they pass unmodified to shell lexing done in Directive constructor
-
class
flux.job.directives.
MultiLine
¶ Bases:
object
Container for multiline quoted directives.
A Multiline is opened and closed by matching triple quote at the end of a line. While a multi line triple quote is open, lines are pushed verbatim (minus any common indent). When the Multiline is finished a string is returned with the multiline literal escaped such that it may be passed to the Directive constructor.
-
append
(value)¶
-
finish
()¶
-
process
(value, lineno)¶
-