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

Re: [HTCondor-users] Removed all jobs from a cluster via Python binding



Hi Cole,Â

   Thanks so much for your help.Â

It did the trick.Â

Thanks,Â
Gagan

On Fri, 20 Jan, 2023, 10:51 pm Cole Bollig via HTCondor-users, <htcondor-users@xxxxxxxxxxx> wrote:
Hi Gagan,

It looks like you are missing the curly brackets to insert the clusterid number into the constraint f string:
result = schedd.act(htcondor.JobAction.Remove, f'ClusterId == clusterId') -> f'ClusterId == {clusterId}'

Hope that fixes your issue,
Cole Bollig

From: HTCondor-users <htcondor-users-bounces@xxxxxxxxxxx> on behalf of gagan tiwari <gagan.tiwari@xxxxxxxxxxxxxxxxxx>
Sent: Friday, January 20, 2023 10:49 AM
To: HTCondor-Users Mail List <htcondor-users@xxxxxxxxxxx>
Subject: [HTCondor-users] Removed all jobs from a cluster via Python binding
Â
HiÂGuys,
          I need our condor users to be able to remove all of their jobs from a particular cluster by specifying just cluster id.Â

I am using following python codes to achieve this :-Â

ÂIn below codes clusid is the int variableÂthat stores cluster id given by the userÂ

ads = schedd.query(
                constraint=f'ClusterId == {clusid}',  Â
                projection=["ClusterId"],
                )
            for ad in ads:
                clusterId = ad['ClusterId']
                break
            result = schedd.act(htcondor.JobAction.Remove, f'ClusterId == clusterId')
            print(f"Jobs successfully removed: {result['TotalSuccess']}")

But above codes remove all jobs from all clusters instead of all jobs from that particular cluster id.Â

Please let me know what I am missing here.Â

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/