开发者

When using Parallel Python, is there any way to tell on which machine the job has run?

开发者 https://www.devze.com 2022-12-20 16:56 出处:网络
I have written a simple program using parallel python, and all works well. However, mainly for curiosities sake, I would like to know on which machine each task ran, and how long it took.

I have written a simple program using parallel python, and all works well. However, mainly for curiosities sake, I would like to know on which machine each task ran, and how long it took.

Is there any way to programmatically get this information for t开发者_StackOverflow中文版he job that is returned?


A uuid1 could help:

>>> import uuid
>>> uuid.uuid1()
UUID('b46fa8cf-1fc1-11df-b891-001641ec3fab')
>>>

See pydoc uuid and the RFC 4122 for more details, I think the last 48 bits are unique to the host. Not sure you you call/return that in Parallel python though.

In the pp.py I found:

self.__stats[hostid] = _Statistics(ncpus, rworker)

Can you then use get_stats() to get at that:

get_stats(self) Returns job execution statistics as a dictionary.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号