ExecutionCommand

ExecutionCommand(context_path: str = None, input_params: dict = None, input_params_secure: dict = None, folder_path: str = None, parent_context_to_reuse: ExecutionContext = None)

Extendable interface intended to simplify working with input/output params and passing them between commands in different Pipeline Executors

Implementations are expected to override _validate and _execute methods

If context_path is not provided - context will be created dynamically using other provided params

Parameters:

  • context_path (str, default: None ) –

    Path to context-describing yaml, that should contain references to input/output param file locations

  • input_params (dict, default: None ) –

    Non-secure parameters that will be merged into dynamically created params

  • input_params_secure (dict, default: None ) –

    Secure parameters that will be merged into dynamically created params

  • folder_path (str, default: None ) –

    Folder path where dynamically-created context will be stored. Optional, will create new temp folder if missing.

  • parent_context_to_reuse (ExecutionContext, default: None ) –

    Optional, existing context to propagate input params from.

run

run()

Runs command following its lifecycle


ExecutionContext

ExecutionContext(context_path: str)

Interface that provides references and shortcuts to navigating provided input params, storing any output params, and logging messages.

Parameters:

  • context_path (str) –

    Path to context-describing yaml, that should contain references to input/output param file locations

output_params_save

output_params_save()

Stores output_param files to disk

input_param_get

input_param_get(path, def_value=None)

Gets parameter from provided params files by its param path, supporting dot-separated nested keys (e.g. 'parent_obj.child_obj.param_name')

output_param_set

output_param_set(path, value)

Sets param by path in non-secure output params

output_param_secure_set

output_param_secure_set(path, value)

Sets param by path in secure output params

validate

validate(names, silent=False)

Validates that all provided param names are present among provided param files


ExecutionContextFile

ExecutionContextFile(path=None)

Interface to work with params and context files, used in ExecutionContext.

Provides methods to init default content for different types of descriptors (e.g. init_context_descriptor, init_params)

init_empty

init_empty()

init_context_descriptor

init_context_descriptor(context_folder_path: str = None)

init_params

init_params()

init_params_secure

init_params_secure()

load

load(path)

Loads and validates file as one of supported types of descriptors

save

save(path)

Writes current file content from memory to disk

get

get(path, def_value=None)

Gets parameter from current file content by its param path, supporting dot-separated nested keys (e.g. 'parent_obj.child_obj.param_name')

set

set(path, value)

Sets parameter in current file content

set_multiple

set_multiple(dict)

Sets multiple parameters in current file content


ExecutionInfo

ExecutionInfo()

Describes trackable running processes (e.g. triggered GitHub workflow)

start

start()

Records start time for described process and transitions its status to IN_PROGRESS

stop

stop(status: str = None)

Records finish time for described process, and optionally transitions its status to passed value

get_duration

get_duration()

Returns duration of this process after it's finished

get_duration_str

get_duration_str()

Returns formatted duration of this process as hh:mm:ss string after it's finished


ExecutionLogger

ExecutionLogger(path_logs)

Default logger used by ExecutionCommands, implicitly initialized when using Context.

Reference to it is available from instance of ExecutionContext.

Provides common logging methods of different log levels - e.g. debug, info, error


utils_cli

utils_cli(func)

Decorator to add CLI options for logging level, context path and custom input params.


create_execution_context

create_execution_context(input_params: dict = None, input_params_secure: dict = None, folder_path: str = None, parent_context_to_reuse: ExecutionContext = None)

Dynamically creates ExecutionContext using provided params.

Parameters:

  • input_params (dict, default: None ) –

    dict (will be merged into created input params)

  • input_params_secure (dict, default: None ) –

    dict (will be merged into created secure input params)

  • folder_path (str, default: None ) –

    str (optional, will generate new temp)

  • parent_context_to_reuse (ExecutionContext, default: None ) –

    ExecutionContext (optional, to propagate existing input params)