diff --git a/src/AMSWorkflow/ams/config.py b/src/AMSWorkflow/ams/config.py index 2cc5cd16..a9d21a32 100644 --- a/src/AMSWorkflow/ams/config.py +++ b/src/AMSWorkflow/ams/config.py @@ -86,8 +86,9 @@ def from_env(cls): @classmethod def from_path(cls, db_path): - _fn = Path(db_path) / Path("ams_config.json") - assert _fn.exists(), "AMS Configuration file does not exist" + _default_conf = "ams_config.json" + _fn = Path(db_path) / Path(_default_conf) + assert _fn.exists(), f"AMS Configuration ({_default_conf}) does not exist" with open(str(_fn), "r") as fd: config = json.load(fd) diff --git a/src/AMSWorkflow/ams/stage.py b/src/AMSWorkflow/ams/stage.py index 9b5a9e99..3a030c42 100644 --- a/src/AMSWorkflow/ams/stage.py +++ b/src/AMSWorkflow/ams/stage.py @@ -478,7 +478,9 @@ def __init__(self, db_dir, store, dest_dir=None, stage_dir=None, db_type="hdf5") initializes the Pipeline class to write the final data in the 'dest_dir' using a file writer of type 'db_type' and optionally caching the data in the 'stage_dir' before making them available in the cache store. """ - self.ams_config = AMSInstance.from_path(db_dir) + self.ams_config = AMSInstance.from_env() + if self.ams_config is None: + self.ams_config = AMSInstance.from_path(db_dir) if dest_dir is not None: self.dest_dir = dest_dir diff --git a/tests/AMSlib/CMakeLists.txt b/tests/AMSlib/CMakeLists.txt index ecba5eff..73135c89 100644 --- a/tests/AMSlib/CMakeLists.txt +++ b/tests/AMSlib/CMakeLists.txt @@ -43,6 +43,9 @@ function(INTEGRATION_TEST_ENV) add_test(NAME AMSEndToEndFromJSON::DuqMean::DuqMax::Double::DB::hdf5-debug::HOST COMMAND bash -c "AMS_OBJECTS=${JSON_FP} ${CMAKE_CURRENT_BINARY_DIR}/ams_end_to_end_env 0 8 9 \"double\" 1 1024 app_uq_mean_debug app_uq_max_debug;AMS_OBJECTS=${JSON_FP} python3 ${CMAKE_CURRENT_SOURCE_DIR}/verify_ete.py 0 8 9 \"double\" 1024 app_uq_mean_debug app_uq_max_debug") unset(JSON_FP) endif() + if (WITH_RMQ) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/json_configs/rmq.json.in" "rmq.json" @ONLY) + endif() endfunction() diff --git a/tests/AMSlib/json_configs/rmq.json b/tests/AMSlib/json_configs/rmq.json.in similarity index 100% rename from tests/AMSlib/json_configs/rmq.json rename to tests/AMSlib/json_configs/rmq.json.in