From c1aa6f3c412cec09424e1041a096b3200befa301 Mon Sep 17 00:00:00 2001 From: brb Date: Thu, 6 Jul 2023 15:53:15 +0200 Subject: [PATCH] added function to read runner script --- code/utils.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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