Skip to content

Commit

Permalink
Small modification of CMakeList to generate the correct config when R…
Browse files Browse the repository at this point in the history
…MQ is used.

Small change in stage.py to load config from AMS_CONFIG_FILE first and then look for ams_config.json if not set

Signed-off-by: Loic Pottier <[email protected]>
  • Loading branch information
lpottier committed Jun 21, 2024
1 parent 510cd34 commit 763b2f2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/AMSWorkflow/ams/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 3 additions & 1 deletion src/AMSWorkflow/ams/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions tests/AMSlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down
File renamed without changes.

0 comments on commit 763b2f2

Please sign in to comment.