diff --git a/code/utils.py b/code/utils.py index c2f542d..c842102 100644 --- a/code/utils.py +++ b/code/utils.py @@ -1,9 +1,12 @@ from pydantic import AnyHttpUrl +from typing import List from pathlib import Path from git import Repo import logging import shutil import os +import yaml +from runner_script import RunnerScript def clone_repository(repo_url: AnyHttpUrl) -> Path: # extract repo name @@ -18,4 +21,12 @@ def clone_repository(repo_url: AnyHttpUrl) -> Path: # git clone repo Repo.clone_from(url=repo_url, to_path=dst_dir) logging.debug('finished') - return dst_dir \ No newline at end of file + return dst_dir + +def load_runner_script(path: Path) -> RunnerScript: + assert path.exists() + with open(path, 'r') as fh: + script = yaml.safe_load(fh) + runner_script = RunnerScript.parse_obj(script) + return runner_script + \ No newline at end of file