#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import logging
import os
import sys
import uuid

import seutils

import qondor

parser = argparse.ArgumentParser()
parser.add_argument('jsonfile', type=str, help='Path to a .json file or a run directory', default='.', nargs='?')
parser.add_argument('-d', '--dry', action='store_true', help='Prints what would happen does not actually submit a job')
parser.add_argument('-v', '--verbose', action='store_true', help='Enable info output')
parser.add_argument('--debug', action='store_true', help='Enable debug output')
parser.add_argument('-c', '--cli', action='store_true', help='Force the job to be submitted by the condor_submit command line via a .jdl file')
args = parser.parse_args()

def main():
    qondor.logger.setLevel(logging.WARNING)
    if args.verbose:
        qondor.logger.setLevel(logging.INFO)
    if args.debug:
        qondor.logger.setLevel(logging.DEBUG)
    if args.dry: qondor.drymode()

    resub = qondor.resubmit.build_resubmission(args.jsonfile)
    resub.print_jobs(summary=True)

if __name__ == '__main__':
    main()