Skip to content

Commit

Permalink
Add warning for mismatched pipeline names
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldcampbelljr committed May 24, 2024
1 parent e1b3aef commit f63e1ca
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions looper/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import itertools
import os

from yaml import safe_load

try:
from functools import cached_property
except ImportError:
Expand Down Expand Up @@ -579,12 +581,30 @@ def _create_pipestat_config(self, piface):
os.path.dirname(piface.pipe_iface_file), schema_path
)
pipestat_config_dict.update({"schema_path": schema_path})
try:
with open(schema_path, "r") as f:
output_schema_data = safe_load(f)
output_schema_pipeline_name = output_schema_data[
PIPELINE_INTERFACE_PIPELINE_NAME_KEY
]
except Exception:
output_schema_pipeline_name = None
else:
output_schema_pipeline_name = None
if "pipeline_name" in piface.data:
pipeline_name = piface.data["pipeline_name"]
pipestat_config_dict.update({"pipeline_name": piface.data["pipeline_name"]})
else:
pipeline_name = None
if "pipeline_type" in piface.data:
pipestat_config_dict.update({"pipeline_type": piface.data["pipeline_type"]})

# Warn user if there is a mismatch in pipeline_names from sources!!!
if pipeline_name != output_schema_pipeline_name:
_LOGGER.warning(
msg=f"Pipeline name mismatch detected. Pipeline interface: {pipeline_name} Output schema: {output_schema_pipeline_name} Defaulting to pipeline_interface value."
)

try:
# TODO if user gives non-absolute path should we force results to be in a pipeline folder?
# TODO otherwise pipelines could write to the same results file!
Expand Down

0 comments on commit f63e1ca

Please sign in to comment.