Skip to content

Commit

Permalink
Misunderstood what was being captured by the sas_call decorator again…
Browse files Browse the repository at this point in the history
… - hopefully now the arg capturing for processing configuration storage should work as intended. For issue #69

Signed-off-by: David Turner <turne540@msu.edu>
  • Loading branch information
DavidT3 committed Sep 2, 2024
1 parent 3cab4f3 commit 3838eb6
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions daxa/process/xmm/_common.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This code is a part of the Democratising Archival X-ray Astronomy (DAXA) module.
# Last modified by David J Turner (turne540@msu.edu) 02/09/2024, 17:39. Copyright (c) The Contributors
# Last modified by David J Turner (turne540@msu.edu) 02/09/2024, 17:57. Copyright (c) The Contributors

import glob
import os.path
Expand All @@ -17,7 +17,7 @@

from daxa.archive.base import Archive
from daxa.config import SASERROR_LIST, SASWARNING_LIST
from daxa.exceptions import NoXMMMissionsError, DAXADeveloperError
from daxa.exceptions import NoXMMMissionsError
from daxa.process._backend_check import find_sas
from daxa.process.general import create_dirs

Expand Down Expand Up @@ -212,13 +212,6 @@ def wrapper(*args, **kwargs):
# This is here to avoid a circular import issue
from daxa.process.xmm.setup import parse_odf_sum

# This is in order to enforce a design of having only the archive as a positional argument, as anything
# else might mess up the way we store the configuration of each executed processing step
if len(args) != 1:
raise DAXADeveloperError("Decorated processing function has multiple positional arguments, that is against"
" the standard DAXA design, and may interfere with the storage of "
"run-configurations for later archive updates.")

# The first argument of all the SAS processing functions will be an archive instance, and pulling
# that out of the arguments will be useful later
obs_archive = args[0]
Expand All @@ -227,6 +220,12 @@ def wrapper(*args, **kwargs):
func_sig = signature(sas_func)
run_args = {k: v.default for k, v in func_sig.parameters.items() if v.default is not Parameter.empty}
run_args = {k: kwargs[k] if k in kwargs else v for k, v in run_args.items()}
if len(args) != 1:
for ind in range(1, len(args)):
rel_key = list(run_args.keys())[ind]
run_args[rel_key] = args[ind]

print(run_args)

# This is the output from whatever function this is a decorator for
miss_cmds, miss_final_paths, miss_extras, process_message, cores, disable, timeout = sas_func(*args, **kwargs)
Expand Down

0 comments on commit 3838eb6

Please sign in to comment.