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

Re: [HTCondor-users] How to use request_cpus/disk/memory in python bindings?



Hi,

You're on exactly the right track. In general, anything that is listed atÂhttps://htcondor.readthedocs.io/en/latest/man-pages/condor_submit.htmlÂas a submit file command can be used as a Python bindings Submit object key-value pair instead. So a submit object constructed like

sub = htcondor.Submit({
  "executable": "/bin/sleep",
  "arguments": "5m",
  "request_cpus": "1",
  "request_disk": "20MB",
  "request_memory": "1GB",
})

should do what you want.

To check that it actually worked, you could do a query to check the classad attributes after submission usingÂhttps://htcondor.readthedocs.io/en/latest/apis/python-bindings/api/htcondor.html#htcondor.Schedd.queryÂ, perhaps something likeÂ

schedd = htcondor.Schedd()

ads = schedd.query(
  f"ClusterId == {clusterid}",
  ["RequestDisk", "RequestMemory"],
)

for ad in ads:
  print(ad)

Keep in mind that disk and memory are stored internally in KB and MB, respectively.

Hope that helps!


Josh Karpel


On Fri, Jan 24, 2020 at 4:36 AM Htcondor user <htcondor.user@xxxxxxxxx> wrote:
Hi all,

I am Using Python bindings (condor 8.6.12 version) to submit a job as below:

sub = htcondor.submit (
{"executable":"/bin/sleep",Â
"arguments":"5m"} )

I am able to get the clusterID.

Now i want to pass below info similarÂto .submit file to my submit apiÂ
"request_cpus":1,
"request_disk":"20MB",
"request_memory":"1GB"

How can i achieve this using python bindings? can any one share some examples?

After that, While requesting the appropriate resources for my job to run like (request_cpus, request_disk, request_memory) how can i test it? is it really overwritting by defaultÂconfig files and giving me 1GB of memory to run my job or not?

Is there any log file generated where i can see the allocated disk/memory/cpu for my job?

Thanks in advance.

_______________________________________________
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/