[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [HTCondor-users] Remove all jobs run by a user / owner via python script.



Not working for me. Using following codes

def remove_jobs():

    user = "shrey"
    try:
       Â
        schedd = htcondor.Schedd()
        schedd.act(htcondor.JobAction.Remove, f'Owner == "{user}"')

    Âexcept Exception as e:
        print("An execption was thrown")
        print(e)

It just doesn't printÂanything. No output.Â

How can I check htcondor python binding ?

Thanks,
Gagan



On Mon, Jan 2, 2023 at 10:14 PM Vikrant Aggarwal <ervikrant06@xxxxxxxxx> wrote:
Hello,

It seems to be working fine for me. I had htcondor python bindingÂ8.9.11 for quick check.

>>> import htcondor
>>> schedd = htcondor.Schedd()
>>> user = "testuser1"
>>> schedd.act(htcondor.JobAction.Remove, f'Owner == "{user}"')
[ TotalJobAds = 1; TotalPermissionDenied = 0; TotalAlreadyDone = 0; TotalNotFound = 0; TotalSuccess = 1; TotalChangedAds = 1; TotalBadStatus = 0; TotalError = 0 ]
>>>

also if no job is present in the queue : it's not an error condition.Â

>>> schedd.act(htcondor.JobAction.Remove, f'Owner == "{user}"')
[ TotalJobAds = 0; TotalPermissionDenied = 0; TotalAlreadyDone = 0; TotalNotFound = 0; TotalSuccess = 0; TotalChangedAds = 0; TotalBadStatus = 0; TotalError = 0 ]

If you don't have permission to remove other user jobs.

>>> schedd.act(htcondor.JobAction.Remove, f'Owner == "{user}"')
[ TotalJobAds = 40; TotalPermissionDenied = 40; TotalAlreadyDone = 0; TotalNotFound = 0; TotalSuccess = 0; TotalChangedAds = 0; TotalBadStatus = 0; TotalError = 0 ]

I suspect it could be related to permissioning?Â



Thanks & Regards,
Vikrant Aggarwal


On Mon, Jan 2, 2023 at 9:36 PM gagan tiwari <gagan.tiwari@xxxxxxxxxxxxxxxxxx> wrote:
Hi Guys,
        ÂI need to allow users to remove all or few jobs submitted by them using a pythonÂscript.Â

I am using following codes :-Â

def remove_jobs(user):
    Âschedd = htcondor.Schedd()
    Âschedd.act(htcondor.JobAction.Remove, f'Owner == "{user}"')

But the above codes seem to be not working as expected.

Even if NO job is runÂby the user above code doesn't throw an exceptionÂwhich meansÂits not working correctly.

Someone please help how can I achieve this?

Thanks,
Gagan

_______________________________________________
HTCondor-users mailing list
To unsubscribe, send a message to htcondor-users-request@xxxxxxxxxxx with a
subject: Unsubscribe
You can also unsubscribe by visiting
https://lists.cs.wisc.edu/mailman/listinfo/htcondor-users

The archives can be found at:
https://lists.cs.wisc.edu/archive/htcondor-users/
_______________________________________________
HTCondor-users mailing list
To unsubscribe, send a message to htcondor-users-request@xxxxxxxxxxx with a
subject: Unsubscribe
You can also unsubscribe by visiting
https://lists.cs.wisc.edu/mailman/listinfo/htcondor-users

The archives can be found at:
https://lists.cs.wisc.edu/archive/htcondor-users/