Skip to content

Commit

Permalink
populate meta.ref_file
Browse files Browse the repository at this point in the history
  • Loading branch information
cshanahan1 committed May 23, 2022
1 parent 858a3be commit 8c0d858
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions romancal/stpipe/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from stpipe import Step, Pipeline

from stpipe import crds_client
import roman_datamodels as rdm
from roman_datamodels.datamodels import ImageModel
from ..lib.suffix import remove_suffix
Expand Down Expand Up @@ -53,6 +54,19 @@ def finalize_result(self, model, reference_files_used):
for log_record in self.log_records:
model.cal_logs.append(_LOG_FORMATTER.format(log_record))

if len(reference_files_used) > 0:
for ref_name, ref_file in reference_files_used:
if hasattr(model.meta.ref_file, ref_name):
getattr(model.meta.ref_file, ref_name).name = ref_file

# this will only run if 'parent' is none, which happens when an individual step is being run
# or if self is a RomanPipeline and not a RomanStep.
print(self.parent)
if (self.parent == None):
model.meta.ref_file.crds.sw_version = crds_client.get_svn_version()
model.meta.ref_file.crds.context_used = crds_client.get_context_used(model.crds_observatory)


def record_step_status(self, model, step_name, success=True):
"""
Record step completion status in the model's metadata.
Expand Down Expand Up @@ -97,3 +111,5 @@ def remove_suffix(self, name):
# when constructing a pipeline using RomanStep class methods.
class RomanPipeline(Pipeline, RomanStep):
pass


0 comments on commit 8c0d858

Please sign in to comment.