Skip to content

Commit

Permalink
Fix little issue in dry run script
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-parker committed Oct 4, 2024
1 parent a7182e1 commit 2c1cce0
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions ena-submission/scripts/deposition_dry_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,6 @@
datefmt="%H:%M:%S",
)

with open("config/config.yaml", encoding="utf-8") as f:
config = yaml.safe_load(f)

with open("config/defaults.yaml", encoding="utf-8") as f:
defaults = yaml.safe_load(f)

# Merge configs, using defaults only as fallback
# Write to results/config.yaml
for key, value in defaults.items():
if not key in config:
config[key] = value


@dataclass
class Config:
Expand Down Expand Up @@ -71,18 +59,28 @@ def local_ena_submission_generator(
center_name,
mode,
log_level,
config_file,
):
"""
Produce output of submission pipeline locally
"""
logger.setLevel(log_level)
logging.getLogger("requests").setLevel(logging.INFO)

with open(config_file, encoding="utf-8") as file:
full_config = yaml.safe_load(file)
relevant_config = {key: full_config.get(key, []) for key in Config.__annotations__}
config = Config(**relevant_config)
with open("config/config.yaml", encoding="utf-8") as f:
config = yaml.safe_load(f)

with open("config/defaults.yaml", encoding="utf-8") as f:
defaults = yaml.safe_load(f)

# Merge configs, using defaults only as fallback
# Write to results/config.yaml
for key, value in defaults.items():
if not key in config:
config[key] = value

full_config = config
relevant_config = {key: full_config.get(key, []) for key in Config.__annotations__}
config = Config(**relevant_config)

logger.debug(f"Config: {config}")

Expand Down

0 comments on commit 2c1cce0

Please sign in to comment.