ska_sdp_piper.piper.utils.io_utils module

ska_sdp_piper.piper.utils.io_utils.create_output_dir(output_path, unique_output_subdir=False, prefix_name=None)[source]

Creates the root output directory if it doesn't exist already and optionally a timestamped folder inside it to store the pipeline output data products. This function returns the absolute path of the effective output directory.

Parameters:
  • output_path (str) -- The root output folder where the timestamped folders are created

  • unique_output_subdir (bool, default = False) -- Whether to create a unique timestamped subdirectory

  • prefix_name (str, optional) -- Optional prefix to add to the timestamped subdirectory name. Ignored if unique_output_subdir is False.

Returns:

str

Effective output directory absolute path

ska_sdp_piper.piper.utils.io_utils.read_yml(input_path)[source]

Reads a yaml file as python dictionary

Parameters:

input_path (str) -- Location of yaml file to read from.

Returns:

dict

ska_sdp_piper.piper.utils.io_utils.write_yml(output_path, config)[source]

Writes a config to output path as yaml

Parameters:
  • output_path (str) -- Location of yaml file to write to.

  • config (dict) -- Data to write

ska_sdp_piper.piper.utils.io_utils.timestamp(cache_breaker=0)[source]

Creates timestamp with predefined format %Y-%m-%dT%H:%M:%S Caches the result between calls to keep the timestamp consistent within a run

Parameters:

cache_breaker (Any) -- Change value to return a new timestamp

Returns:

(str):

Timestamp.