Mixins provided by mtrchk.org.momotor.run.inout

checklet mixin class mtrchk.org.momotor.run.inout.mixin.RunInOutMixin

A Momotor checklet mixin that executes an external program providing input and capturing output from that program through standard input and output streams or files.

Subclasses from CapturedExecutionMixin so also provides runtime monitoring and limiting.

timeLimit option

Maximum time allowed for execution. Can be supplied in hh:mm:ss format, 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:ss format, 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) or 1KiB (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-ref option. If neither stdin and stdin-file-ref options are provided, stdin is closed.

Type:

Any

Required:

False

Multiple:

False

Location:

config, step, recipe

Default:

No default

Provided by: CapturedExecutionMixin

stdin-file-ref option

Reference to a file to provide text on stdin. Mutually exclusive with the stdin option. If neither stdin-file-ref and :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

Provided by: CapturedExecutionMixin

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

Provided by: CapturedExecutionMixin

input-delay option

Delay (in milliseconds) between sending lines on stdin

Type:

integer

Required:

False

Multiple:

False

Location:

config, step, recipe

Default:

No default

Provided by: CapturedExecutionMixin

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

Provided by: CapturedExecutionMixin

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

Provided by: CapturedExecutionMixin

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

Provided by: CapturedExecutionMixin

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

Provided by: CapturedExecutionMixin

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

Provided by: CapturedExecutionMixin

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..109 allows exit codes 0, 1 and 100 up to and including 109

Type:

Any

Required:

False

Multiple:

False

Location:

config, step, recipe

Default:

0

Provided by: CapturedExecutionMixin

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

Provided by: CapturedExecutionMixin

report-stdio option

Report stdio.

Either true, false or a (comma or space-seperated) list of streams (in, out, err) to include.

in stream will be formatted bold, out stream will be in regular font and err stream will be in red.

Default: false

Type:

Any

Required:

False

Multiple:

False

Location:

config, step, recipe

Default:

false

Provided by: CapturedExecutionMixin

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) or 1KiB (for 1024 lines). Default = 5000, hard limit = 100k

Type:

string

Required:

False

Multiple:

False

Location:

config, step, recipe

Default:

No default

Provided by: CapturedExecutionMixin

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) or 1KiB (for 1024 bytes). Default = 1 MiB, hard limit = 16 MiB

Type:

string

Required:

False

Multiple:

False

Location:

config, step, recipe

Default:

No default

Provided by: CapturedExecutionMixin

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) or 1KiB (for 1024 lines). Default = 5000, hard limit = 100k

Type:

string

Required:

False

Multiple:

False

Location:

config, step, recipe

Default:

No default

Provided by: CapturedExecutionMixin

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) or 1KiB (for 1024 bytes).

Default = 1 MiB, hard limit = 16 MiB

Type:

string

Required:

False

Multiple:

False

Location:

config, step, recipe

Default:

No default

Provided by: CapturedExecutionMixin

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

Provided by: CapturedExecutionMixin

abstract _prepare_command(workdir)

Prepares the command to execute and the environment.

Abstract method that should be implemented by the checklet using this mixin.

Parameters:

workdir (Path) – the working directory to use

Return type:

tuple[Union[str, bytes, PathLike[str], PathLike[bytes], Sequence[Union[str, bytes, PathLike[str], PathLike[bytes]]]], dict[str, str], dict]

Returns:

the command and arguments, environment and keyword arguments for captured_popen()

_run_inout()

Executes the command using captured_popen() and captures the output according to the options.

The command and environment are prepared by the _prepare_command() method.

Return type:

CheckletResult

DEFAULT_RUN_LIMITS: ClassVar = RunLimits(timeLimit=60, blockLimit=60, memoryLimit=1073741824, processLimit=1000)

Default run limits for the execution. Can be overridden by the options.