run_tool

Runs the tool.

A set of functions needed to run the build and run the test generation and the tests themselves. Includes the main

atoml_cmp.run_tool.build_docker_collection(d_list: List[Dict[str, Any]])[source]

Builds a set of docker images defined by a list of dictionaries.

Parameters

d_list – list of dictionaries with data to set up docker.

Raises

RuntimeError – if a docker build failed.

atoml_cmp.run_tool.check_docker_state()[source]

checks if there is a running instance of docker.

Uses the ‘docker info’ command to check if docker is running. If it raises an error, docker is either not installed or just not running.

Raises

RuntimeError – if there is no running instances of docker

atoml_cmp.run_tool.delete_folder(name: str)[source]

deletes a directory if existent.

Parameters

name – directory name that should be deleted

atoml_cmp.run_tool.main(dockerlist_file: str, gen_tests_folder: str = 'generated-tests', pred_folder: str = 'predictions', yaml_folder: str = 'algorithm-descriptions', archive_folder: str = 'archive', manual_flag: bool = False) int[source]

entrypoint for the overall pipeline.

Runs the whole pipeline of the tool. This includes clearing old data from output folder, building test / test generation docker, test generation, executing tests, compare results of the tests and finally saving the information in an archive.

Parameters
  • dockerlist_file (str) – json file with the specification for the docker container.

  • gen_tests_folder (str) – directory for the generated test cases.

  • pred_folder (str) – directory for the prediction csv files.

  • yaml_folder (str) – directory for the yaml files with the algorithm definitions.

  • archive_folder (str) – directory, where to save the archive.

  • manual_flag (bool) – flag for the activation of manual decisions.

Returns

  • Number of evaluated csv files.

atoml_cmp.run_tool.make_decision(active: bool, question: str) bool[source]

Asks a deciding question (True/False) to the user.

Parameters
  • active (bool) – flag whether the user should be asked.

  • question (str) – the question for the user

Returns

The result of the decision, which is set to True if not dissented.

atoml_cmp.run_tool.run_docker_collection(d_list: List[Dict[str, Any]])[source]

Runs a set of docker container defined by a list of dictionaries.

Parameters

d_list – list of dictionaries with data to set up docker.

atoml_cmp.run_tool.run_docker_container(name: str, *bindings: List[str], option: Optional[str] = None)[source]

Starts a docker container.

Parameters
  • name – Name of the docker to start.

  • *bindings – List of string couples. Contains the mount bindings with the source relative to the current dictionary as the first string and the absolute target path as the second

  • option – Optional argument which is passed to the docker.

Raises

RuntimeWarning – if the docker run failed.

atoml_cmp.run_tool.split_docker_list(d_list: List[Dict[str, Any]])[source]

Splits the list of docker in test generation docker and test environment docker.

The split is done by checking for the ‘generator’ key in the dockers dict defined in the json file. Only the docker for the test case / test data generation should contain that key. All others, which are used to set

the environment for running the tests, must not have it.

Parameters

d_list – list of dictionaries with docker information

Returns

  • list of dictionaries with test generator docker information (can not contain more than one element)

  • list of dictionaries with test environment docker information

Return type

(list, list)

Raises

RuntimeError – if there is more than one test generator docker defined.