Skip to content

Commit

Permalink
get the prod_id matching the cmd from a dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
marialainez committed Nov 5, 2024
1 parent cc57cac commit 5d7a647
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/osa/workflow/stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,13 @@ def _remove_dl1b_output(self, file_prefix):

def _write_checkpoint(self):
"""Write the checkpoint in the history file."""
dl1_commands = [
cfg.get("lstchain", "r0_to_dl1"),
cfg.get("lstchain", "dl1ab"),
cfg.get("lstchain", "check_dl1")
]
if self.command in dl1_commands:
prod_id = options.dl1_prod_id
elif self.command == cfg.get("lstchain", "dl1_to_dl2"):
prod_id = options.dl2_prod_id

command_to_prod_id = {
cfg.get("lstchain", "r0_to_dl1"): options.prod_id,
cfg.get("lstchain", "dl1ab"): options.dl1_prod_id,
cfg.get("lstchain", "check_dl1"): options.dl1_prod_id,
cfg.get("lstchain", "dl1_to_dl2"): options.dl2_prod_id
}
prod_id = command_to_prod_id.get(self.command)
history(
run=self.run,
prod_id=prod_id,
Expand Down

0 comments on commit 5d7a647

Please sign in to comment.