Esempio n. 1
0
def __existing_jobs_torque():
    (out, err) = qstat(" -f")
    job_names = []

    for job in out.split("\n\n"):
        # Each chunk is a job with each attribute listed on a line
        if "    euser = {}".format(get_username()) in job:
            for line in job.split("\n"):
                if "Job_Name" in line:
                    job_names += [line.split("=")[-1].strip()]

    return (job_names)
Esempio n. 2
0
def __cancel_running_jobs_torque():
    (out, err) = qstat(" -f")
    job_ids = []

    for job in out.split("\n\n"):
        # Each chunk is a job with each attribute listed on a line
        if "    euser = {}".format(get_username()) in job:
            if "   job_state = R" in job:
                for line in job.split("\n"):
                    if "Job Id:" in line:
                        job_ids += [line.split(":")[-1].strip()]

    cancel_jobs(job_ids)