From 58ef1b4b1ba7fefb03746dd932c666663d7241ed Mon Sep 17 00:00:00 2001 From: Gerry Knapp Date: Tue, 6 Jan 2026 15:09:35 -0500 Subject: [PATCH 1/4] add option to have no database specification in Myna input file - Needed if an application does not require build data, like the additivefoam/single_track_calibration --- src/myna/core/components/component.py | 2 +- src/myna/core/db/database.py | 14 ++++++++++++++ src/myna/core/workflow/config.py | 11 ++++------- src/myna/database/database_types.py | 3 +++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/myna/core/components/component.py b/src/myna/core/components/component.py index a583c10e..1cf12ec7 100644 --- a/src/myna/core/components/component.py +++ b/src/myna/core/components/component.py @@ -200,7 +200,7 @@ def get_files_from_template(self, template, abspath=True): # Get build name input_dir = os.path.abspath(os.path.dirname(os.environ["MYNA_INPUT"])) - build = self.data["build"]["name"] + build = nested_get(self.data, ["build", "name"], "myna_output") # Get all other names that are set by the component vars = self.types[1:] diff --git a/src/myna/core/db/database.py b/src/myna/core/db/database.py index 394c35f0..d898f704 100644 --- a/src/myna/core/db/database.py +++ b/src/myna/core/db/database.py @@ -82,3 +82,17 @@ def write_segment_sync_metadata( sync_dict[segment_type_key][segment_key]["synced_by"] = os.getlogin() with open(sync_metadata_file, "w", encoding="utf-8") as mf: yaml.safe_dump(sync_dict, mf) + + +class NoDatabase(Database): + """Non-existent database used for tasks that don't actually require build data""" + + def __init__(self): + super().__init__() + self.build_segmentation_type = "layer" + + def set_path(self, path): + pass + + def exists(self) -> bool: + return True diff --git a/src/myna/core/workflow/config.py b/src/myna/core/workflow/config.py index efadc8c5..32b0c7e8 100644 --- a/src/myna/core/workflow/config.py +++ b/src/myna/core/workflow/config.py @@ -83,8 +83,10 @@ def config(input_file, output_file=None, show_avail=False, overwrite=False): settings = load_input(input_file) # Check build directory contains the expected metadata folder - build_path = settings["data"]["build"]["path"] - datatype = database.return_datatype_class(settings["data"]["build"]["datatype"]) + build_path = nested_get(settings, ["data", "build", "path"]) + datatype = database.return_datatype_class( + nested_get(settings, ["data", "build", "datatype"], "None") + ) datatype.set_path(build_path) if not datatype.exists(): print(f"ERROR: Could not find valid {datatype} in" + f" {build_path}") @@ -131,11 +133,6 @@ def config(input_file, output_file=None, show_avail=False, overwrite=False): all_parts.extend(build_region_parts) all_parts = list(set(all_parts)) - # Check that some amount of parts were specified - if len(all_parts) < 1: - print(f"ERROR: No parts specified in {input_file}") - raise ValueError - # Get list of all segments in build parts and build_region parts # Possible options for types segments are: # - datatype.build_segmentation_type == "layer": uses layers diff --git a/src/myna/database/database_types.py b/src/myna/database/database_types.py index 72fe9c03..d140c9a7 100644 --- a/src/myna/database/database_types.py +++ b/src/myna/database/database_types.py @@ -13,6 +13,7 @@ from myna.database.nist_ambench_2022 import AMBench2022 from myna.database.myna_json import MynaJSON from myna.database.pelican import Pelican +from myna.core.db import NoDatabase def return_datatype_class(datatype_str): @@ -51,6 +52,8 @@ def remove_text_format(text): return MynaJSON() elif remove_text_format(datatype_str) in ["pelican"]: return Pelican() + elif remove_text_format(datatype_str) in ["none"]: + return NoDatabase() else: print(f"Error: {datatype_str} does not correspond to any implemented database") raise NotImplementedError From 467676490c9ae37a820cf21a4435c983034aab1d Mon Sep 17 00:00:00 2001 From: Gerry Knapp Date: Wed, 4 Feb 2026 15:21:44 -0500 Subject: [PATCH 2/4] fixup: add NoDatabase to submodule definition --- src/myna/core/db/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/myna/core/db/__init__.py b/src/myna/core/db/__init__.py index de2cd3b0..72916abf 100644 --- a/src/myna/core/db/__init__.py +++ b/src/myna/core/db/__init__.py @@ -8,6 +8,6 @@ # """Define the requirements and behavior of Myna databases.""" -from .database import Database +from .database import Database, NoDatabase -__all__ = ["Database"] +__all__ = ["Database", "NoDatabase"] From 59f0a53ff7758d13003262bff03d27f1059fa0f7 Mon Sep 17 00:00:00 2001 From: Gerry Knapp Date: Fri, 20 Feb 2026 15:48:42 -0500 Subject: [PATCH 3/4] add missing class functions to NoDatabase --- src/myna/core/db/database.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/myna/core/db/database.py b/src/myna/core/db/database.py index d898f704..7843dc4f 100644 --- a/src/myna/core/db/database.py +++ b/src/myna/core/db/database.py @@ -96,3 +96,17 @@ def set_path(self, path): def exists(self) -> bool: return True + + def load(self, metadata_type, **kwargs): + """Returns None since there is no database to load from.""" + return None + + def get_cui_info(self): + """Returns 'N/A' since there is no database.""" + return "N/A" + + def sync(self, component_type, step_types, output_class, files): + """Returns an empty list since there is no database to sync to.""" + return [] + + From 4723339c48437159212821955c08f14fcb720d44 Mon Sep 17 00:00:00 2001 From: Gerry Knapp Date: Fri, 20 Feb 2026 15:50:53 -0500 Subject: [PATCH 4/4] format --- src/myna/core/db/database.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/myna/core/db/database.py b/src/myna/core/db/database.py index 7843dc4f..d29582b4 100644 --- a/src/myna/core/db/database.py +++ b/src/myna/core/db/database.py @@ -108,5 +108,3 @@ def get_cui_info(self): def sync(self, component_type, step_types, output_class, files): """Returns an empty list since there is no database to sync to.""" return [] - -