Commit f591d21c authored by Chris Burr's avatar Chris Burr
Browse files

Merge branch 'aiwieder/checks_ci' into 'master'

Add CLI command to run checks for CI.

See merge request !46
parents d444cc12 e801e0c9
Pipeline #3645466 passed with stages
in 6 minutes and 3 seconds
......@@ -8,12 +8,15 @@
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
import json
import os
import shlex
from os.path import join
import click
from LbAPCommon import parse_yaml, render_yaml, validate_yaml
from LbAPCommon.checks import run_job_checks
from LbAPCommon.checks_utils import checks_to_JSON
from pkg_resources import DistributionNotFound, get_distribution
from .checks import checks_exist, perform_checks
......@@ -339,6 +342,29 @@ def check(production_name, job_name, test_ntuple_path, checks_output_dir, valida
perform_checks(production_name, job_name, [test_ntuple_path], checks_output_dir)
@main.command()
@click.argument("checks_data_file", type=str, nargs=1)
@click.argument("input_ntuple", type=str, nargs=1)
@click.argument("checks_output_file", type=str, nargs=1)
def ci_checks(checks_data_file, input_ntuple, checks_output_file):
"""Helper function for running checks in the CI. This is not recommended for users."""
click.secho("Starting checks!", fg="green")
with open(checks_data_file, "r") as inf:
test_info = json.load(inf)
check_results = {
test_info["jobs"][0]["name"]: run_job_checks(
test_info["jobs"][0]["checks"],
test_info["jobs"][0]["checks_data"],
[input_ntuple],
)
}
checks_to_JSON(
test_info["jobs"][0]["checks_data"],
check_results,
json_output_path=checks_output_file,
)
@main.command()
@click.argument("production_name", type=production_name_type, nargs=1)
@click.argument("job_name", type=str, nargs=1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment