[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.



My suggestion would be to check whether you are able to query the jobs (if rm still not working for you) using python code. Also when you remove the job you should see something coming on stdout. I usually prefer to do this kind of debugging on the python terminal.Â

regarding the version of htcondor python.Â

>>> import htcondor
>>> htcondor.version()
'$CondorVersion: 8.9.11 Mar 17 2021 $'


Thanks & Regards,
Vikrant Aggarwal

On Mon, Jan 2, 2023 at 11:06 PM gagan tiwari <gagan.tiwari@xxxxxxxxxxxxxxxxxx> wrote:
Please update what I am missing.

Thanks,
Gagan

On Mon, Jan 2, 2023 at 10:39 PM gagan tiwari <gagan.tiwari@xxxxxxxxxxxxxxxxxx> wrote:
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/
_______________________________________________
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/