#!/usr/bin/env python
#
# Data Quality Checker also known as DQC
#
# Read the README.md for more detailed information
#
#       Barcelona Supercomputing Center - Centro Nacional de Supercomputacion
#       Earth Sciences Department - Computational Earth Sciences
#
#     Authors:
#       Joan Sala Calero (joan.sala@bsc.es)

import ecflow

print("Client -> Server: delete, then load a new definition")
try:
    ci = ecflow.Client()
    ci.ping()
    ci.delete_all()  # clear out the server
    ci.load("checker_workflow.def")  # load the definition into the server
    ci.restart_server()
    ci.begin_suite("tasks")  # start the suite
    print(ci.stats())
except RuntimeError as e:
    print("Failed:", e)