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

StackOverflow https://stackoverflow.com/questions/2307739

  •  22-09-2019
  •  | 
  •  

문제

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top