示例#1
0
def run(batchids):
    """
    Run the QSTAT command to get the status of given batchids.

    Sample output of command:

    $ bjobs
    JOBID   USER    STAT  QUEUE      FROM_HOST   EXEC_HOST   JOB_NAME   SUBMIT_TIME
    1722    mashkev RUN   normal     pdx-lsf-lv0 pdx-lsf-lv0 job300-m   Sep 13 17:43

    """

    keywords = queueinit.readConfig(queue_dir=queue_dir)
    cmd = form_command(keywords)
    logger.debug("Executing cmd: %s" % cmd)
    qstat = sp.Popen(cmd, shell=True, stdout=sp.PIPE)
    lsf_status = process_output(qstat.stdout)
    exit_code = qstat.wait()

    if not batchids:
        batchids = sorted(lsf_status.keys())
    for batchid in batchids:
        status = lsf_status.get(batchid, "unknown")
        print batchid, status

    return exit_code
示例#2
0
def run(batchids):
    """
    Run the QSTAT command to get the status of given batchids.

    Sample output of command (note the batch id can be truncated):

    $ qstat
    Job id            Name             User              Time Use S Queue
    ----------------  ---------------- ----------------  -------- - -----
    97.pdx-pbspro-lv0 job300-muriel-4  mashkevi          00:00:00 R workq         

    """

    keywords = queueinit.readConfig(queue_dir=queue_dir)
    cmd = form_command(keywords)
    logger.debug("Executing cmd: %s" % cmd)
    qstat = sp.Popen(cmd, shell=True, stdout=sp.PIPE)
    pbs_status = process_output(qstat.stdout)
    exit_code = qstat.wait()

    if not batchids:
        batchids = sorted(pbs_status.keys())
    for batchid in batchids:
        numid = re.sub(r'\D.+', "", batchid)
        status = pbs_status.get(numid, "unknown")
        print batchid, status

    return exit_code
示例#3
0
def run(batchids):
    """
    Run the QSTAT command to get the status of given batchids.

    Sample output of command:

    $ condor_q

    -- Submitter: Q1@ip-10-159-23-56 : <10.159.23.56:39213> : ip-10-159-23-56.ec2.internal
     ID      OWNER            SUBMITTED     RUN_TIME ST PRI SIZE CMD               
      2.0   smashkevich    12/5  15:40   0+00:00:52 C  0   122.1 inscript_26041.sh 
      3.0   smashkevich    12/5  16:39   0+00:00:00 I  0   0.0  inscript_5445.sh  

    """

    keywords = queueinit.readConfig(queue_dir=queue_dir)
    cmd = form_command(keywords)
    logger.debug("Executing cmd: %s"% cmd)
    qstat = sp.Popen(cmd, shell=True, stdout=sp.PIPE)
    batch_status = process_output(qstat.stdout)
    exit_code = qstat.wait()

    if not batchids:
        batchids = sorted(batch_status.keys())
    for batchid in batchids:
        status = batch_status.get(batchid, "unknown")
        print batchid, status

    return exit_code
def run(batchids):
    """
    Run the QSTAT command to get the status of given batchids.

    Sample output of command (note the batch id can be truncated):

    $ qstat
    Job id            Name             User              Time Use S Queue
    ----------------  ---------------- ----------------  -------- - -----
    97.pdx-pbspro-lv0 job300-muriel-4  mashkevi          00:00:00 R workq

    """

    keywords = queueinit.readConfig(queue_dir=queue_dir)

    for batchid in batchids:
        cmd = form_command(keywords, batchid)
        logger.debug("Executing cmd: %s"% cmd)
        qstat = sp.Popen(cmd, shell=True, stdout = sp.PIPE)
        outp = qstat.stdout.read()
        pbs_status = process_output(outp)
        exit_code = qstat.wait()
        print batchid, pbs_status

    return exit_code
示例#5
0
def cancelJobs(batchids):
    """
    Run the QDEL command to cancel given batchids.

    Sample output of command:
    $ scancel -v 244
    scancel: Terminating job 244
    """

    keywords = queueinit.readConfig(queue_dir=queue_dir)
    cmd = form_command(keywords, batchids)
    logger.debug("Executing cmd: %s" % cmd)
    qdel = sp.Popen(cmd, shell=True, stdout=sp.PIPE, stderr=sp.STDOUT)
    message = process_output(qdel.stdout)
    print message
    exit_code = qdel.wait()
    logger.debug("Exit code from command: %d" % exit_code)

    return exit_code
示例#6
0
def run(batchids):
    """
    Run the QSTAT command to get the status of given batchids.

    Sample output of command:

    $ squeue 
    JOBID PARTITION     NAME     USER  ST       TIME  NODES NODELIST(REASON)
      244     batch job100-m mashkevi   R      12:36      1 pdx-slurm1-lv01
    """

    keywords = queueinit.readConfig(queue_dir=queue_dir)
    cmd = form_command(keywords)
    logger.debug("Executing cmd: %s" % cmd)
    qstat = sp.Popen(cmd, shell=True, stdout=sp.PIPE)
    message = process_output(qstat.stdout, batchids)
    print message
    exit_code = qstat.wait()

    return exit_code
示例#7
0
def cancelJobs(batchids):
    """
    Run the QDEL command to cancel given batchids.

    Sample output of command:

    $ condor_rm 5
    Cluster 5 has been marked for removal.

    $ condor_rm 5
    Couldn't find/remove all jobs in cluster 5.
    """

    keywords = queueinit.readConfig(queue_dir=queue_dir)
    cmd = form_command(keywords, batchids)
    logger.debug("Executing cmd: %s" % cmd)
    qdel = sp.Popen(cmd, shell=True, stdout = sp.PIPE, stderr = sp.STDOUT)
    message = process_output(qdel.stdout)
    print message
    exit_code = qdel.wait()

    return exit_code
示例#8
0
def cancelJobs(batchids):
    """
    Run the QDEL command to cancel given batchids.

    Sample output of command:

    $ qdel 7938861
    mashkevi has registered the job 7938861 for deletion

    $ qdel 7938861
    job 7938861 is already in deletion
    """
    keywords = queueinit.readConfig(queue_dir=queue_dir)

    cmd = form_command(keywords, batchids)
    logger.debug("Executing cmd: %s" % cmd)
    qdel = sp.Popen(cmd, shell=True, stdout=sp.PIPE, stderr=sp.STDOUT)
    message = process_output(qdel.stdout)
    print message
    exit_code = qdel.wait()

    return exit_code
示例#9
0
def cancelJobs(batchids):
    """
    Run the QDEL command to cancel given batchids.

    Sample output of command:

    $ qdel 7938861
    <no output -- exit code is 0 on success, nonzero on failure>
    """
    keywords = queueinit.readConfig(queue_dir=queue_dir)
    cmd = form_command(keywords, batchids)
    logger.debug("Executing cmd: %s" % cmd)

    process = sp.Popen(cmd, shell=True, stdout=sp.PIPE, stderr=sp.STDOUT)
    exit_code = process.wait()
    if exit_code:
        result = "ERROR"
    else:
        result = "cancelled"
    for batchid in batchids:
        print "%s %s" % (batchid, result)

    return exit_code
def cancelJobs(batchids):
    """
    Run the QDEL command to cancel given batchids.

    Sample output of command:

    $ qdel 7938861
    <no output -- exit code is 0 on success, nonzero on failure>
    """
    keywords = queueinit.readConfig(queue_dir=queue_dir)
    cmd = form_command(keywords, batchids)
    logger.debug("Executing cmd: %s"% cmd)

    process = sp.Popen(cmd, shell=True, stdout = sp.PIPE, stderr = sp.STDOUT)
    exit_code = process.wait()
    if exit_code:
        result = "ERROR"
    else:
        result = "cancelled"
    for batchid in batchids:
        print "%s %s" % (batchid, result)

    return exit_code