CmdOutputHandler

abstract class CmdOutputHandler(getGraderLogPath: () -> Path) : CmdUtils.Buildable

Records container execution outputs which are to be transferred to a PipelineStage for reporting.

Parameters

getGraderLogPath

function that generates the mounted path of the logging directory. Files on this path are created from stage execution and read into the stage through CmdOutputHandler. This is for creating the lazy property thus avoiding uninitialized properties used when initializing the Path.

Inheritors

Constructors

Link copied to clipboard
constructor(getGraderLogPath: () -> Path)

Properties

Link copied to clipboard
protected val graderLogPath: Path

Root directory path where arbitrary grader output files from stage execution are stored under as logs.

Functions

Link copied to clipboard
abstract fun collectOutput(onSuccess: (Path) -> Unit, onFailure: (Path) -> Unit)

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.

Link copied to clipboard
abstract fun getResultContent(result: CmdUtils.Var.Result<*>): List<String>

Retrieves the stored content for result after stage execution. This method should utilize the outputs state to derive and return the content.

Link copied to clipboard
open fun onAfterCore(): List<String>

Commands to execute after any core commands.

Link copied to clipboard

Commands to execute after any core commands and onAfterCore commands.

Link copied to clipboard
open fun onBeforeCore(): List<String>

Commands to execute before any core commands.

Link copied to clipboard
open operator fun String.rangeTo(rest: String): String

Command building combinator to concat different parts of the command with proper spacing.

Link copied to clipboard
abstract fun CmdUtils.Var.register(cmd: String): String

Register a Var to record the results of cmd for constructing reports after stage execution.

Link copied to clipboard
open fun setup()

Setup actions required to take before container execution for this output handler to run successfully. For example: delete all files at mount mount, create directories at mount point.