Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pipeline): check cluster time in yaml config #254

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions caput/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,24 @@ def from_yaml_str(cls, yaml_doc, lint=False, psutil_profiling=False):
-------
self: Pipeline object
"""
import re
from .config import SafeLineLoader

yaml_params = yaml.load(yaml_doc, Loader=SafeLineLoader)

# Check for unquoted cluster time specifications with colons in the YAML
if "cluster" in yaml_params and "time" in yaml_params["cluster"]:
matches = re.search(r"(?<=time:)\s+(\d+:(\d+:)*\d+)", yaml_doc)
if matches and matches.group(1):
raw_time_value = matches.group(1)
raise config.CaputConfigError(
f"Value 'cluster.time: {raw_time_value}' in YAML configuration"
f" parsed as sexagesimal: '{yaml_params['cluster']['time']}'\n"
"This number will be interpreted as *minutes* by Slurm.\n"
"Please enclose value in quotation marks.",
location=yaml_params,
)

try:
if not isinstance(yaml_params["pipeline"], dict):
raise config.CaputConfigError(
Expand Down
Loading