1

I am trying to spawn processes to a remote node. The code resembles the answer I have found here

if __name__ == "__main__":

from pathos.pp import ParallelPythonPool as Pool
def sleepy_squared(x):
    from time import sleep
    sleep(1.0)
    import socket

    print(socket.gethostname())

    return x**2

p = Pool(8, servers=('151.49.140.246:1234',))
# use an asynchronous parallel map
x = [1,2,3,4,5,6,7,8,9]
res = p.amap(sleepy_squared, x)

print(res.get())

The problem is that when I run this code, pathos keeps running on my local machine ignoring the servers attribute. I would like the function to run only on the remote server (or crash if not available). In order to configure the server I'm launching the file ppserver.py (found in the Scripts folder in the Anaconda installation). I have tried launching it with multiple configurations

python ppserver.py -d
python ppserver.py -i 127.0.0.1 -p 1234 -d
python ppserver.py -i 151.49.140.246 -p 1234 -b 255.255.255.0 -d 

(the last one doesn't even work)

I can't understand honestly if the problem is with the configuration server side (the server is listening though) or the client side (servers are ignored) or both.

Vittorio Apicella
  • 381
  • 1
  • 2
  • 14

0 Answers0