Skip to content

Commit

Permalink
set pipeline_stats_file if pipestat_results_file IS provided, remove …
Browse files Browse the repository at this point in the history
…checking for the first record_identifier during get_stat
  • Loading branch information
donaldcampbelljr committed Nov 27, 2023
1 parent cc84070 commit 2de4e84
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions pypiper/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ def __init__(
self.pipestat_results_file = self.pipeline_stats_file
elif pipestat_results_file:
self.pipestat_results_file = pipestat_results_file
self.pipeline_stats_file = self.pipestat_results_file

def _get_arg(args_dict, arg_name):
"""safely get argument from arg dict -- return None if doesn't exist"""
Expand Down Expand Up @@ -1859,18 +1860,11 @@ def _refresh_stats(self):

if os.path.isfile(self.pipeline_stats_file):
_, data = read_yaml_data(path=self.pipeline_stats_file, what="stats_file")
record_identifier = list(
data[self._pipestat_manager.pipeline_name][
self._pipestat_manager.pipeline_type
]
)[0]

# Confirm that the loaded stats file is the same namespace as the pipeline manager
if record_identifier == self._pipestat_manager.record_identifier:
for key, value in data[self._pipestat_manager.pipeline_name][
self._pipestat_manager.pipeline_type
][record_identifier].items():
self.stats_dict[key] = value

for key, value in data[self._pipestat_manager.pipeline_name][
self._pipestat_manager.pipeline_type
][self._pipestat_manager.record_identifier].items():
self.stats_dict[key] = value

def get_stat(self, key):
"""
Expand Down

0 comments on commit 2de4e84

Please sign in to comment.