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 1173341F66; Mon, 10 Jun 2024 21:37:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C5978402CA; Mon, 10 Jun 2024 21:37:31 +0200 (CEST) Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) by mails.dpdk.org (Postfix) with ESMTP id 7AA44402A9 for ; Mon, 10 Jun 2024 21:37:30 +0200 (CEST) Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2ebd590a8b9so3218571fa.3 for ; Mon, 10 Jun 2024 12:37:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1718048250; x=1718653050; darn=dpdk.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=TtWBKgXTneUZj6aRKUrI1GC/IGzGT1Qp5jyCUzhetLQ=; b=cii2iGoISbjOp0Rbd/YAIjhNR1HNP4PyGQYxpu23GJ9Cztext2aroJ1gqFT4TPOjH7 AuU/ANZb8DvRJGyfcthwkxNJCLrUNRTWuVwoG8BOfX5Qm5J/bNuJb/Cw9QmOxcVEM8ve OzpQABJ2NnsQVZQR5BigG5Tt8fOYue03uhdOk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718048250; x=1718653050; h=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=TtWBKgXTneUZj6aRKUrI1GC/IGzGT1Qp5jyCUzhetLQ=; b=huJpjeE+Kz6ae+YFYFrHHWOVuh+tFwd4royOKfsMqtRcEpLgYRbFvBLEUt9GWNwuDJ d0Y3XWKQcmkmlnSiGEJJmYRcxaA8pyiDXrTuWE8pxOC8y9/Q9gwXkVpxx549CsmJ9JXe 2giiIN28vjiA9bBamPRZkAclGB2VLdqHHx5DHZod7keekxr6k3kZNeUDrt/UE+K4nVmd sT37AXTHIRKUEijhIMnk2WJJkevEtPpxI9c54O9qqiyNO+C/CaAxhMU0Fn+HUyoO3MXt SNXhCIewkscqTfVdHPOygkzm+sVaVyAScxSK+e2UUWmbW1aYY1vPYoqqMqlu8iTj1hzN qFjw== X-Gm-Message-State: AOJu0Yxrf26oDMGgqqHIbMeefvCSiNlP1v7+4CXtsc+sQsSkMi2MA4Ev jVzdiZyIxiWfLxZYCkGK7qSDq6xN37lzZgswGf8CmdfvH1q/YLEe/CSCtXKood0iEIGsuh7+G33 Ypn0MhsZVmDpvi1Q8mTRIFS/Oq9Mk1NXT8x8z8g== X-Google-Smtp-Source: AGHT+IGeuNUl4SDnnlCtU7EgUB4Rpz3mUREDzqG3+zjQ3iflT+FgsDA0ZGhXk4QieolhsSjNL0cjuEi6RCQYlPrg7fE= X-Received: by 2002:a2e:6d02:0:b0:2eb:de36:676f with SMTP id 38308e7fff4ca-2ebde3668b5mr30837161fa.3.1718048249859; Mon, 10 Jun 2024 12:37:29 -0700 (PDT) MIME-Version: 1.0 References: <20240610193410.17968-2-npratte@iol.unh.edu> In-Reply-To: <20240610193410.17968-2-npratte@iol.unh.edu> From: Nicholas Pratte Date: Mon, 10 Jun 2024 15:37:18 -0400 Message-ID: Subject: Re: [PATCH v1] dts: Testbed And Node Configuration Split To: luca.vizzarro@arm.com, juraj.linkes@pantheon.tech, probb@iol.unh.edu, jspewock@iol.unh.edu, bruce.richardson@intel.com, yoan.picchi@foss.arm.com, paul.szczepanek@arm.com, Honnappa.Nagarahalli@arm.com Cc: dev@dpdk.org Content-Type: text/plain; charset="UTF-8" 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 > -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 configuration 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 file. > + node_config_file_path: The path to the testbed configuration YAML file. > + exec_config_file_path: The path to the execution configuration YAML file. > > Returns: > The parsed test run configuration. > """ > - with open(config_file_path, "r") as f: > - config_data = yaml.safe_load(f) > + with open(node_config_file_path, "r") as f: > + node_config_data = yaml.safe_load(f) > + with open(exec_config_file_path, "r") as f: > + execution_config_data = yaml.safe_load(f) > > schema_path = os.path.join(Path(__file__).parent.resolve(), "conf_yaml_schema.json") > > with open(schema_path, "r") as f: > schema = json.load(f) > - config = warlock.model_factory(schema, name="_Config")(config_data) > - config_obj: Configuration = Configuration.from_dict(dict(config)) # type: ignore[arg-type] > + config = { > + **dict(warlock.model_factory(schema, name="_Config")(node_config_data)), > + **dict(warlock.model_factory(schema, name="_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 not configured." > + ) > + config_obj: Configuration = Configuration.from_dict(config) # type: 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 there 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.