Skip to content

Commit

Permalink
feat(runner): config file linting
Browse files Browse the repository at this point in the history
Add lint command as well as --lint for the queue command.
  • Loading branch information
nritsche committed Dec 9, 2020
1 parent f31cc06 commit 5223419
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion caput/scripts/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ def cli():
pass


@cli.command("lint")
@click.argument(
"configfile",
type=click.Path(exists=True, dir_okay=False, readable=True, resolve_path=True),
)
def lint_config(configfile):
"""Test a pipeline for errors without running it."""
from caput.pipeline import Manager

Manager.from_yaml_file(configfile)


@cli.command()
@click.argument(
"configfile",
Expand Down Expand Up @@ -104,7 +116,12 @@ def run(configfile, loglevel, profile, profiler):
@click.option(
"--submit/--nosubmit", default=True, help="Submit the job to the queue (or not)"
)
def queue(configfile, submit=False):
@click.option(
"--lint/--nolint",
default=True,
help="Check the pipeline for errors before submitting it.",
)
def queue(configfile, submit=False, lint=True):
"""Queue a pipeline on a cluster from the given CONFIGFILE.
This queues the job, using parameters from the `cluster` section of the
Expand Down Expand Up @@ -156,6 +173,11 @@ def queue(configfile, submit=False):
import shutil
import yaml

if lint:
from caput.pipeline import Manager

Manager.from_yaml_file(configfile)

with open(configfile, "r") as f:
yconf = yaml.safe_load(f)

Expand Down

0 comments on commit 5223419

Please sign in to comment.