mloq.runner#

This module defines the pipeline for running a mloq command, such as config loading, template writing and interfacing with click.

Module Contents#

Functions#

load_config(config_file, hydra_args)

Load the necessary configuration for running mloq from a mloq.yaml file.

write_record(record, path[, overwrite, only_config])

Write the contents of the provided record to the target path.

run_command(cmd_cls[, use_click])

Run the given Command class.

mloq.runner.load_config(config_file, hydra_args)[source]#

Load the necessary configuration for running mloq from a mloq.yaml file.

If no path to mloq.yaml is provided, it returns a template to be filled in using the interactive mode.

Parameters
  • config_file (Union[pathlib.Path, str]) – Path to the target mloq.yaml file.

  • hydra_args (str) – Arguments passed to hydra for composing the project configuration.

Returns

DictConfig containing the project configuration.

Return type

omegaconf.DictConfig

mloq.runner.write_record(record, path, overwrite=False, only_config=False)[source]#

Write the contents of the provided record to the target path.

The writing process is performed by :class: Writer, class that fills in rendered templates according to the given configuration.

Parameters
  • record (mloq.record.CMDRecord) – CMDRecord containing all the data to be written.

  • path (Union[pathlib.Path, str]) – Target directory to write the data.

  • overwrite (bool) – If True overwrite existing files.

  • only_config (bool) – Do not write any file except mloq.yaml

Returns

None.

Return type

None

mloq.runner.run_command(cmd_cls, use_click=True)[source]#

Run the given Command class.

Parameters
  • cmd_cls – Command to be executed.

  • use_click (bool) – If True run the function as a “cli” command.

Returns

A function that will run the target class as a mloq command.

Return type

Callable