Mixins provided by mtrchk.org.momotor.mixin.exec¶
- checklet mixin class mtrchk.org.momotor.mixin.exec.ExecutionMixin¶
A checklet mixin that provides a method to execute a command with runtime monitoring and limiting
- timeLimit option¶
Maximum time allowed for execution. Can be supplied in
hh:mm:ssformat, or as seconds- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
- blockLimit option¶
Maximum time allowed without any progress (wall clock time). Can be supplied in
hh:mm:ssformat, or as seconds- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
- memoryLimit option¶
Maximum memory usage allowed for execution. Can use IEC or SI units, eg.
1k(for 1000 bytes) or1KiB(for 1024 bytes)- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
- processLimit option¶
Maximum number of child processes
- Type:
integer
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
- static format_args(*args)¶
Format arguments for use with
monitored_popen()
- monitored_popen(args, *, default_limits=None, **kwargs)¶
Executes a command with monitoring. A wrapper around
MPopenthat sets up limits based on checklet options.- Parameters:
args (
Union[str,bytes,PathLike[str],PathLike[bytes],Sequence[Union[str,bytes,PathLike[str],PathLike[bytes]]]]) – The command to be executed.default_limits (
RunLimits) – The default limits for the execution. Any value here is overridden by values provided in the checklet options.kwargs – Additional keyword arguments passed on to
MPopen.
- Return type:
- checklet mixin class mtrchk.org.momotor.mixin.exec.CapturedExecutionMixin¶
A mixin for checklets that captures the data on stdin/stdout/stderr and provides it as a property.
Subclasses from
ExecutionMixinso also provides runtime monitoring and limiting.- timeLimit option¶
Maximum time allowed for execution. Can be supplied in
hh:mm:ssformat, or as seconds- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
Provided by:
ExecutionMixin
- blockLimit option¶
Maximum time allowed without any progress (wall clock time). Can be supplied in
hh:mm:ssformat, or as seconds- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
Provided by:
ExecutionMixin
- memoryLimit option¶
Maximum memory usage allowed for execution. Can use IEC or SI units, eg.
1k(for 1000 bytes) or1KiB(for 1024 bytes)- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
Provided by:
ExecutionMixin
- processLimit option¶
Maximum number of child processes
- Type:
integer
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
Provided by:
ExecutionMixin
- stdin option¶
Content to provide on stdin. Mutually exclusive with the
stdin-file-refoption. If neitherstdinandstdin-file-refoptions are provided, stdin is closed.- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
- stdin-file-ref option¶
Reference to a file to provide text on stdin. Mutually exclusive with the
stdinoption. If neitherstdin-file-refand :momotor:option:.stdin` options are provided, stdin is closed.The reference is parsed with
find_files(), see that method for details.- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
- input-file-ref option¶
Reference for file(s) to put in execution tree.
The reference is parsed with
find_files(), see that method for details.- Type:
Any
- Required:
False
- Multiple:
True
- All:
False
- Location:
config, step, recipe
- Default:
No default
- input-delay option¶
Delay (in milliseconds) between sending lines on stdin
- Type:
integer
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
- capture-stdio option¶
Capture the stream on stdin/out/err. When enabled, the checklet outputs a property stdio containing a (json) list of objects. The objects contains entries for I/O on ‘stdin’, ‘stdout’, ‘stderr’ (with key 0, 1 and 2 respectively), and a timestamp in seconds since execution start (with key
@)- Type:
boolean
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
False
- stdout-file-class option¶
Export output produced on stdout to a file with this class
- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
- stderr-file-class option¶
Export output produced on stderr to a file with this class
- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
- stdouterr-file-class option¶
Export combined output produced on stdout/stderr combined to a file with this class
- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
- output-file-class option¶
Export produced or modified files with this class
- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
- pass-on-exitcode option¶
A comma-separated list of exit codes that should not be considered a failure. Ranges can be indicated as X..Y. This list should include the “0” exit code if it should be a pass. e.g.
0, 1, 100..109allows exit codes 0, 1 and 100 up to and including 109- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
0
- fail-on-stderr option¶
Produce a fail outcome if any (non-whitespace) output is produced on stderr
- Type:
boolean
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
False
- report-stdio option¶
Report stdio.
Either
true,falseor a (comma or space-seperated) list of streams (in,out,err) to include.instream will be formatted bold,outstream will be in regular font anderrstream will be in red.Default:
false- Type:
Any
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
false
- truncate-stdout-lines option¶
Limit for the number of lines captured from stdout.
Can be use IEC or SI units, eg.
1k(for 1000 lines) or1KiB(for 1024 lines). Default =5000, hard limit =100k- Type:
string
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
- truncate-stdout-bytes option¶
Limit for the number of bytes captured from stdout.
Can be use IEC or SI units, eg.
1k(for 1000 bytes) or1KiB(for 1024 bytes). Default =1 MiB, hard limit =16 MiB- Type:
string
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
- truncate-stderr-lines option¶
Limit for the number of lines captured from stderr.
Can be use IEC or SI units, eg.
1k(for 1000 lines) or1KiB(for 1024 lines). Default =5000, hard limit =100k- Type:
string
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
- truncate-stderr-bytes option¶
Limit for the number of bytes captured from stderr. Can be use IEC or SI units, eg.
1k(for 1000 bytes) or1KiB(for 1024 bytes).Default =
1 MiB, hard limit =16 MiB- Type:
string
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
No default
- fail-on-truncation option¶
Fail if an output is truncated.
Can be a boolean ‘true’ to fail if either stdout or stderr is truncated, ‘false’ to never fail on truncation, or the values ‘stdout’ or ‘stderr’ to only fail if that stream is truncated
- Type:
string
- Required:
False
- Multiple:
False
- Location:
config, step, recipe
- Default:
false
- captured_popen(args, cwd, *, encoding='utf8', errors='replace', default_limits=None, default_run_limits=None, default_capture_limits=None, **kwargs)¶
Call
monitored_popen()providing input from a file to stdin and capturing the output on stdout and stderr.- Parameters:
args (
Union[str,bytes,PathLike[str],PathLike[bytes],Sequence[Union[str,bytes,PathLike[str],PathLike[bytes]]]]) – The command and arguments to be executed.cwd (
Path) – The working directory for the command.encoding (
str) – The encoding to use for stdin/stdout/stderr.errors (
str) – How to handle encoding errorsdefault_limits (
RunLimits) – deprecated Use default_run_limits instead.default_run_limits (
RunLimits) – The default limits for the execution.default_capture_limits (
CaptureLimits) – The default limits for capturing stdout/stderr.kwargs – Additional keyword arguments passed on to
monitored_popen().
- Return type:
- Returns:
The result of the execution. Can be used as the checklet result, or processed further by the checklet.