FileBased
File-based implementation of command line output handler, in which every variable's result is stored as a file.
The algorithm used:
Every
add
call with aVar
against a command will pipe to 3 created/overwritten file at graderLogPath. Files follow a specific naming convention: ".NAME_OF_VARIABLE.{stdout, stderr, ec}".Since graderLogPath is mounted, so all files are retrievable from the grader host. We search for such "NAME_OF_VARIABLE"s that have all 3 files present at the log path, do truncation if needed, and record them in vars.
When a result of a variable is queried (by calling
Var.{stdout,stderr,exitcode}
in a pipeline stage), if the underlying variable is registered in vars, read the corresponding file and return file content as list of lines.
One feature that FileBased output handler has is the ability to handle a potentially large command output, that could come from a stream produced by commands like yes
and cat
of a big file.
Properties
Functions
IO action to perform after stage execution (under an environment like a container), in order to load stage output files from the file system for reading and further reporting. This method shall put the contents of output files into a readable internal state representing the outputs.
Reads the file that stores result if the variable underlying result is registered in vars. Truncates the file content up to Configuration.PipelineStage.OutputTruncation.reportOutputLength bytes if it is too big. Otherwise return empty content.
Commands to execute after any core commands.
Commands to execute after any core commands and onAfterCore commands.
Delete all files in the mounted log directory, cleaning up for the next stage to output logs.