Skip to content

Commit

Permalink
Allow to specify parent id in runner
Browse files Browse the repository at this point in the history
  • Loading branch information
vmordan committed Oct 24, 2023
1 parent 4e0d5c7 commit df7cc2e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
TAG_PROPERTIES = "requirement specifications"
TAG_UPLOADER = "uploader"
TAG_NAME = "name"
TAG_IDENTIFIER = "identifier"

DEFAULT_CONFIG_COMMAND = "allmodconfig"
DEFAULT_ARCH = "x86_64"
Expand All @@ -91,7 +92,8 @@ class Runner(Component):
2. Launching klever;
3. Converting results to CVV.
"""
def __init__(self, general_config: dict, kernel_dir_override: str, version_override: str, properties: list):
def __init__(self, general_config: dict, kernel_dir_override: str, version_override: str, properties: list,
parent_job_id: str):

super().__init__(COMPONENT_RUNNER, general_config)
bridge_config = self.config[TAG_BRIDGE]
Expand Down Expand Up @@ -125,6 +127,7 @@ def __init__(self, general_config: dict, kernel_dir_override: str, version_overr
self.job_config = self.__normalize_dir(klever_config.get(TAG_JOB_CONFIG), TAG_JOB_CONFIG)
self.resource_config = self.__normalize_dir(klever_config.get(TAG_RESOURCE_CONFIG), TAG_RESOURCE_CONFIG)
self.python_venv = self.__normalize_dir(klever_config.get(TAG_PYTHON_VENV, ""))
self.parent_job_id = parent_job_id

# Klever Bridge config
self.bridge_dir = self.__normalize_dir(bridge_config.get(TAG_HOME_DIR), TAG_HOME_DIR)
Expand Down Expand Up @@ -181,6 +184,8 @@ def __update_job_config(self, build_base_dir: str):
job_config[TAG_PROPERTIES] = self.properties
uploaded_name = f"{'_'.join(self.properties)} - {self.version} - <timestamp>"
bridge_config[TAG_UPLOADER][TAG_NAME] = uploaded_name
if self.parent_job_id:
bridge_config[TAG_UPLOADER][TAG_IDENTIFIER] = self.parent_job_id
bridge_config[COMPONENT_BENCHMARK_LAUNCHER][TAG_OUTPUT_DIR] = \
os.path.join(self.klever_deploy_dir, KLEVER_TASKS_DIR)
bridge_config[COMPONENT_BENCHMARK_LAUNCHER][TAG_TASKS_DIR] = \
Expand Down Expand Up @@ -266,6 +271,7 @@ def run(self):
parser.add_argument("-d", "--kernel-dir", dest="kernel_dir", help="path to kernel directory")
parser.add_argument("-v", "--version", dest="version", help="Linux kernel version")
parser.add_argument("-p", "--properties", nargs='+', dest="properties", help="property to be checked")
parser.add_argument("-j", "--parent-job-id", dest="parent_job_id", help="parent job id")

options = parser.parse_args()
with open(options.config, errors='ignore', encoding='ascii') as data_file:
Expand All @@ -274,5 +280,5 @@ def run(self):
version = options.version
props = options.properties

runner = Runner(config, kernel_dir, version, props)
runner = Runner(config, kernel_dir, version, props, options.parent_job_id)
runner.run()

0 comments on commit df7cc2e

Please sign in to comment.