Пример #1
0
def main():
    initLog()

    # Accept the optional -w argument, but ignore it
    if len(sys.argv) == 2:
        jobid_arg = sys.argv[1]
    elif len(sys.argv) == 3 and sys.argv[1] == "-w":
        jobid_arg = sys.argv[2]
    else:
        print "1Usage: pbs_status.sh pbs/<date>/<jobid>"
        return 1
    jobid = jobid_arg.split("/")[-1].split(".")[0]

    global config
    config = blah.BlahConfigParser(defaults={
        'pbs_pro': 'no',
        'pbs_binpath': '/usr/bin'
    })

    log("Checking cache for jobid %s" % jobid)
    cache_contents = None
    try:
        cache_contents = check_cache(jobid)
    except Exception, e:
        msg = "1ERROR: Internal exception, %s" % str(e)
        log(msg)
Пример #2
0
def main():
    initLog()

    # Accept the optional -w argument, but ignore it
    if len(sys.argv) == 2:
        jobid_arg = sys.argv[1]
    elif len(sys.argv) == 3 and sys.argv[1] == "-w":
        jobid_arg = sys.argv[2]
    else:
        print("1Usage: slurm_status.py slurm/<date>/<jobid>")
        return 1
    jobid = jobid_arg.split("/")[-1]
    cluster = ""
    jobid_list = jobid.split("@")
    if len(jobid_list) > 1:
        jobid = jobid_list[0]
        cluster = jobid_list[1]

    global config
    config = blah.BlahConfigParser(defaults={'slurm_binpath': '/usr/bin'})

    log("Checking cache for jobid %s" % jobid)
    if cluster != "":
        log("Job in remote cluster %s" % cluster)
    cache_contents = None
    try:
        cache_contents = check_cache(jobid, cluster)
    except Exception as e:
        msg = "1ERROR: Internal exception, %s" % str(e)
        log(msg)
        #print msg
    if not cache_contents:
        log("Jobid %s not in cache; querying SLURM" % jobid)
        results = call_squeue(jobid, cluster)
        log("Finished querying SLURM for jobid %s" % jobid)
        if not results or jobid not in results:
            log("1ERROR: Unable to find job %s" % jobid)
            print("1ERROR: Unable to find job %s" % jobid)
        else:
            log("0%s" % job_dict_to_string(results[jobid]))
            print("0%s" % job_dict_to_string(results[jobid]))
    else:
        log("Jobid %s in cache." % jobid)
        log("0%s" % job_dict_to_string(cache_contents))

        if cache_contents["JobStatus"] == '4' or cache_contents[
                "JobStatus"] == '3':
            finished_job_stats = get_finished_job_stats(jobid, cluster)
            cache_contents.update(finished_job_stats)

        print("0%s" % job_dict_to_string(cache_contents))
    return 0
Пример #3
0
def main():
    initLog()

    # Accept the optional -w argument, but ignore it
    if len(sys.argv) == 2:
        jobid_arg = sys.argv[1]
    elif len(sys.argv) == 3 and sys.argv[1] == "-w":
        jobid_arg = sys.argv[2]
    else:
        print("1Usage: pbs_status.sh pbs/<date>/<jobid>")
        return 1
    jobid = jobid_arg.split("/")[-1].split(".")[0]

    global config
    config = blah.BlahConfigParser(defaults={
        'pbs_pro': 'no',
        'pbs_binpath': '/usr/bin'
    })

    log("Checking cache for jobid %s" % jobid)
    cache_contents = None
    try:
        cache_contents = check_cache(jobid)
    except Exception as e:
        msg = "1ERROR: Internal exception, %s" % str(e)
        log(msg)
        #print msg
    if not cache_contents:
        log("Jobid %s not in cache; querying PBS" % jobid)
        results = qstat(jobid)
        log("Finished querying PBS for jobid %s" % jobid)
        if not results or jobid not in results:
            log("1ERROR: Unable to find job %s" % jobid)
            print("1ERROR: Unable to find job %s" % jobid)
        else:
            log("0%s" % job_dict_to_string(results[jobid]))
            print("0%s" % job_dict_to_string(results[jobid]))
    else:
        log("Jobid %s in cache." % jobid)
        log("0%s" % job_dict_to_string(cache_contents))

        if cache_contents["JobStatus"] == '4' or cache_contents[
                "JobStatus"] == '3':
            finished_job_stats = get_finished_job_stats(jobid)
            cache_contents.update(finished_job_stats)

        print("0%s" % job_dict_to_string(cache_contents))
    return 0