Beispiel #1
0
def delete(job):
    """Delete a job."""
    # Initialise variables.
    jobid = job["jobid"]

    try:

        shellout = shellwrappers.sendtossh(job, ["bkill " + jobid])

    except exceptions.SSHError:

        raise exceptions.JobdeleteError("Unable to delete job.")

    return shellout[0]
Beispiel #2
0
def test_delete_deleteexcept(mock_delete):

    """
    Test that job delete exception is handled in a controlled way.
    """

    job = {
        "jobname": "job-one",
        "resource": "test-machine",
        "scheduler": "LSF",
        "jobid": "test456"
    }

    mock_delete.side_effect = exceptions.JobdeleteError("Delete Error")

    delete(job)
Beispiel #3
0
def delete(job):
    """Delete a job."""
    # Initialise variables.
    jobid = job["jobid"]

    try:

        if int(job["replicates"]) > 1:

            shellout = shellwrappers.sendtossh(job, ["qdel " + jobid + "[]"])

        else:

            shellout = shellwrappers.sendtossh(job, ["qdel " + jobid])

    except exceptions.SSHError:

        raise exceptions.JobdeleteError("Unable to delete job.")

    return shellout[0]