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

Re: [HTCondor-users] Not able to remove selected jobs from queue via python bindings



result = schedd.act(
	htcondor.JobAction.Remove,
	f'Owner == {getpass.getuser()} && ProcID == ans'
)

This will remove any job whose `ProcID` is equal to the (almost certainly undefined) job ad attribute `ans` and whose `Owner` is equal to the (almost certainly undefined) job attribute "gagan" (or whichever user is running the Python script). Additionally, you almost certainly want to match against `ClusterID` instead of `ProcID`, as the former is unique within a given schedd and the latter is not. Finally, even if you did substute `ans` with a ClassAd list, in the ClassAd language, comparing an integere (the `ProcID` or `ClusterID`) to a list generates an error value,
meaning that not jobs will ever be removed.

	I haven't tested the following examples.


# Given a cluster ID in `clusterID`, remove the entire cluster. Since # cluster IDs are unique with a given schedd, there's no need to
# specify an owner.
result = schedd.act(
	htcondor.JobAction.Remove,
	f'Owner == "ClusterID == {clusterID}'
)


# Given a cluster ID in `clusterID` and a proc ID in `procID`, remove
# that the single specific job.
result = schedd.act(
	htcondor.JobAction.Remove,
	f'Owner == "ClusterID == {clusterID} && ProcID == {procID}'
)


# Remove more than one cluster with a single call.  Note that `clusterIDs`
# is a string in the ClassAd list syntax.
clusterIDs = "{7, 8, 9}"
result = schedd.act(
	htcondor.JobAction.Remove,
	f'Owner == member( ClusterID, {clusterIDs} )'
)

- ToddM