From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D351341F66; Mon, 10 Jun 2024 21:07:36 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AB69A402CA; Mon, 10 Jun 2024 21:07:36 +0200 (CEST) Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) by mails.dpdk.org (Postfix) with ESMTP id 826A3402A9 for ; Mon, 10 Jun 2024 21:07:35 +0200 (CEST) Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2ebc724e1fdso3206561fa.1 for ; Mon, 10 Jun 2024 12:07:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1718046455; x=1718651255; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=f4gzNeSQIdL9R+0nbMB0SWVtS/xLYYv7tvNE/aFk6jo=; b=ef5zevX7ae1gqrJh8RJhm831r2l2PAnx3r4DHyMIKIJ5u7/RKiiyDy+uhf8cvoQaTu 8AajlPVvHTHMOwgDqtBQwpLtkFOivr6VKOMUaKF91sHkaqw5kV2bk40XiaRbWeoXcMb4 sHqg75sEFZmJycKeygrxaAHScqN09rsPB50xU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718046455; x=1718651255; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f4gzNeSQIdL9R+0nbMB0SWVtS/xLYYv7tvNE/aFk6jo=; b=RUEzI/24cfD0yoe8mFo/ehkiP5Eh68mXPR3hFRJa/VT6y0tufdQaksqnyypVTWFxTl 1EsBC/pU/w9RhwrESr3Vln9TDwOxkSmDvtrbHwUKeqvPD+3a0z4kf0bBlGR6t3+ar50M fQn8sEz+kv8jrRv8icviHYYt+P3a7DjFzOluPjAvXiUpnvmJGyy5+Ivx1y9xaydVwtuR Cnw0uBdxHq2UK1p697PBaCfDysRuvzGFI/n6RdRlY1hy+PlajHPdTABz6m3jJdIwG3R7 mf4GrRHSHRFjxXzhJ6037Stbr+haTDLYRoqiNDmLxnJDOK9NLrKqDNZsYHCF33GmowXH kHrw== X-Gm-Message-State: AOJu0YwvkKmndBMqPmOjsRD3LvqrsYAU4u8XPcbkrvbD7H6qZ5PeNZAW X8SNlmOCXfv3thYyh40hUmK4N5qw5hzJ2wWLMw3yWdZVtxVVWiZFMjrYNli+xWy+9P7RoXlEf+c VgJ2eAAyxht01L6fdwsIYvca6vsZOkyWuBfbWAg== X-Google-Smtp-Source: AGHT+IGpohat3ZF8KwToeNRDz4Sr1tCHPlOJLyLasc9ptptGJhxO1WTJUHsv5U3SYNpEq0rZMrtRzJNrSvQJPT2XAmo= X-Received: by 2002:a2e:2a86:0:b0:2eb:da20:7b3f with SMTP id 38308e7fff4ca-2ebda207cd5mr37193351fa.1.1718046454645; Mon, 10 Jun 2024 12:07:34 -0700 (PDT) MIME-Version: 1.0 References: <20240610185901.6466-2-npratte@iol.unh.edu> In-Reply-To: <20240610185901.6466-2-npratte@iol.unh.edu> From: Nicholas Pratte Date: Mon, 10 Jun 2024 15:07:23 -0400 Message-ID: Subject: Re: [PATCH v1] Testbed And Node Configuration Split To: yoan.picchi@foss.arm.com, paul.szczepanek@arm.com, jspewock@iol.unh.edu, juraj.linkes@pantheon.tech, probb@iol.unh.edu, luca.vizzarro@arm.com, Honnappa.Nagarahalli@arm.com, bruce.richardson@intel.com Cc: dev@dpdk.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Mon, Jun 10, 2024 at 3:00=E2=80=AFPM Nicholas Pratte wrote: > > > -def load_config(config_file_path: Path) -> Configuration: > +def load_config(node_config_file_path: Path, exec_config_file_path: Path= ) -> Configuration: > """Load DTS test run configuration from a file. > > - Load the YAML test run configuration file > + Load both the YAML testbed and execution configuration files > and :download:`the configuration file schema = `, > - validate the test run configuration file, and create a test run conf= iguration object. > + validate both configuration files to create a test run configuration= object. > > The YAML test run configuration file is specified in the :option:`--= config-file` command line > argument or the :envvar:`DTS_CFG_FILE` environment variable. > > Args: > - config_file_path: The path to the YAML test run configuration fi= le. > + node_config_file_path: The path to the testbed configuration YAM= L file. > + exec_config_file_path: The path to the execution configuration Y= AML file. > > Returns: > The parsed test run configuration. > """ > - with open(config_file_path, "r") as f: > - config_data =3D yaml.safe_load(f) > + with open(node_config_file_path, "r") as f: > + node_config_data =3D yaml.safe_load(f) > + with open(exec_config_file_path, "r") as f: > + execution_config_data =3D yaml.safe_load(f) > > schema_path =3D os.path.join(Path(__file__).parent.resolve(), "conf_= yaml_schema.json") > > with open(schema_path, "r") as f: > schema =3D json.load(f) > - config =3D warlock.model_factory(schema, name=3D"_Config")(config_da= ta) > - config_obj: Configuration =3D Configuration.from_dict(dict(config)) = # type: ignore[arg-type] > + config =3D { > + **dict(warlock.model_factory(schema, name=3D"_Config")(node_conf= ig_data)), > + **dict(warlock.model_factory(schema, name=3D"_Config")(execution= _config_data)), > + } > + if "nodes" not in config or "executions" not in config: > + raise ConfigurationError( > + f"{'node' if 'nodes' not in config else 'execution'} data no= t configured." > + ) > + config_obj: Configuration =3D Configuration.from_dict(config) # typ= e: ignore[arg-type] > return config_obj There is an alternative approach to this that I currently have implemented on a separate local branch. Essentially, both configs are merged together before being validated by the schema, effectively removing the need to change the schema at all as well as the above assertion that both nodes and executions are in the two config files. However, using this alternative method might mean that is no added control that prevents users from making funky errors when creating both config files. I could also just be overthinking or missing something.