Ejemplo n.º 1
0
def validate_args(parser,user):
    """
    Validate qmove arguments.
    """
    if len(parser.args) < 2:
        client_utils.print_usage(parser)
        sys.exit(1)

    # get jobids from the argument list
    jobids = client_utils.get_jobids(parser.args[1:])

    jobs = [{'tag':'job', 'user':user, 'jobid':jobid, 'project':'*', 'notify':'*',
             'walltime':'*', 'queue':'*', 'procs':'*', 'nodes':'*'} for jobid in jobids]
    queue = parser.args[0] 
    return queue,jobs
Ejemplo n.º 2
0
def validate_args(parser, spec, opt_count):
    """
    Validate qalter arguments
    """
    opts_wo_args = ['debug', 'getq', 'savestate',
                    'setjobid']  # no argument options

    # handle release or hold options
    if hasattr(parser.options, 'admin_hold'):
        opt_count += 1
        spec['admin_hold'] = parser.options.admin_hold

    if hasattr(parser.options, 'user_hold'):
        opt_count += 1
        spec['user_hold'] = parser.options.user_hold

    # Make sure jobid or queue is supplied for the appropriate commands
    if parser.no_args() and not [opt for opt in spec if opt in opts_wo_args]:
        client_utils.print_usage(parser)
        sys.exit(1)

    # Check required options
    if opt_count == 0:
        client_utils.logger.error("At least one option must be specified")
        sys.exit(1)

    check_option_conflicts(opt_count, parser)

    if parser.options.addq   != None or \
       parser.options.delq   != None or \
       parser.options.getq   != None or \
       parser.options.qdata  != None: # set queue options
        # queue job change request
        jobs = [{'tag': 'queue', 'name': qname} for qname in parser.args]
    else:
        # get jobids from the argument list
        jobids = client_utils.get_jobids(parser.args)
        jobs = [{
            'tag': 'job',
            'jobid': int(jobid),
            'location': '*',
            'walltime': '*'
        } for jobid in jobids]

    return jobs
Ejemplo n.º 3
0
Archivo: cqadm.py Proyecto: ido/cobalt
def validate_args(parser, spec, opt_count):
    """
    Validate qalter arguments
    """
    opts_wo_args = ["debug", "getq", "savestate", "setjobid"]  # no argument options

    # handle release or hold options
    if hasattr(parser.options, "admin_hold"):
        opt_count += 1
        spec["admin_hold"] = parser.options.admin_hold

    if hasattr(parser.options, "user_hold"):
        opt_count += 1
        spec["user_hold"] = parser.options.user_hold

    # Make sure jobid or queue is supplied for the appropriate commands
    if parser.no_args() and not [opt for opt in spec if opt in opts_wo_args]:
        client_utils.print_usage(parser)
        sys.exit(1)

    # Check required options
    if opt_count == 0:
        client_utils.logger.error("At least one option must be specified")
        sys.exit(1)

    check_option_conflicts(opt_count, parser)

    if (
        parser.options.addq != None
        or parser.options.delq != None
        or parser.options.getq != None
        or parser.options.qdata != None
    ):  # set queue options
        # queue job change request
        jobs = [{"tag": "queue", "name": qname} for qname in parser.args]
    else:
        # get jobids from the argument list
        jobids = client_utils.get_jobids(parser.args)
        jobs = [{"tag": "job", "jobid": int(jobid), "location": "*", "walltime": "*"} for jobid in jobids]

    return jobs
Ejemplo n.º 4
0
Archivo: cqadm.py Proyecto: ido/cobalt
def validate_args(parser, spec, opt_count):
    """
    Validate qalter arguments
    """
    opts_wo_args = ['debug', 'getq', 'savestate', 'setjobid'] # no argument options

    # handle release or hold options
    if hasattr(parser.options, 'admin_hold'):
        opt_count += 1
        spec['admin_hold'] = parser.options.admin_hold

    if hasattr(parser.options, 'user_hold'):
        opt_count += 1
        spec['user_hold'] = parser.options.user_hold
    
    # Make sure jobid or queue is supplied for the appropriate commands
    if parser.no_args() and not [opt for opt in spec if opt in opts_wo_args]:
        client_utils.print_usage(parser)
        sys.exit(1)

    # Check required options
    if opt_count == 0:
        client_utils.logger.error("At least one option must be specified")
        sys.exit(1)

    check_option_conflicts(opt_count, parser)

    if parser.options.addq   != None or \
       parser.options.delq   != None or \
       parser.options.getq   != None or \
       parser.options.qdata  != None: # set queue options
        # queue job change request
        jobs = [{'tag':'queue', 'name':qname} for qname in parser.args]
    else:
        # get jobids from the argument list
        jobids = client_utils.get_jobids(parser.args)
        jobs = [{'tag':'job', 'jobid':int(jobid), 'location':'*', 'walltime':'*'} for jobid in jobids]

    return jobs
Ejemplo n.º 5
0
def validate_args(parser, user):
    """
    Validate qmove arguments.
    """
    if len(parser.args) < 2:
        client_utils.print_usage(parser)
        sys.exit(1)

    # get jobids from the argument list
    jobids = client_utils.get_jobids(parser.args[1:])

    jobs = [{
        'tag': 'job',
        'user': user,
        'jobid': jobid,
        'project': '*',
        'notify': '*',
        'walltime': '*',
        'queue': '*',
        'procs': '*',
        'nodes': '*'
    } for jobid in jobids]
    queue = parser.args[0]
    return queue, jobs