pgiri / dispy

Distributed and Parallel Computing Framework with / for Python
https://dispy.org
Other
266 stars 55 forks source link

May not be an issue...but trying to understand exact dispy mechanism #128

Closed Kekushke closed 6 years ago

Kekushke commented 6 years ago

Awesome project! Tried to execute the following on a client along with multiple server nodes. All machines are identical.

import dispy
cluster = dispy.JobCluster('/bin/hostname')
for i in range(50):
    print i
    cluster.submit(i)

The server nodes are running dispynode.py -d and show the following error. Wanting to understand how this works, and why the extra characters are added? Is it that every node gets unique version; and it tries to copy over the destination path?

OSError: [Errno 13] Permission denied: /bin/hostname_RfaY5X

Thank you!

pgiri commented 6 years ago

Is this with latest version (4.8.7)?

Note that dispy sends the program itself to nodes, so in this case '/bin/hostname' program is sent to nodes which save it under dispy execution directory (such as '/tmp/dispy/node/') and execute that program. This may not work if the nodes are different platform as in this case the program is binary executable.

Kekushke commented 6 years ago

This is with the latest version (4.8.7). All machines are identical in all respects including hardware, os, kernel version etc. Just to check permissions, on one of the nodes, I copied /bin/hostname to /tmp with the same local user privileges of dispynode.py. The execution of /tmp/hostname then worked just fine even when owner and group permissions are same as that of how dispynode.py is run. From the fact that it should copy the file, I think the OSError is baffling. Just to confirm identical nature of executable, I did hash check on binaries of /bin/hostname and they turned out to be all identical.

pgiri commented 6 years ago

I tried this with

cluster = dispy.JobCluster('/bin/hostname', nodes=['192.168.0.5'], cleanup=False, dest_path='test')

and checked on the node at `/tmp/dispy/node/192.168.0.5/test' where 'hostname' is saved (in this client and node are same so '192.168.0.5' in path is also node's address). Nothing should be saved directly in '/tmp'. You can run above and check.

Kekushke commented 6 years ago

@pgiri Thanks again! I figured that there is a mistake in the original post. '/bin/hostname' with a parameter is a request for changing the hostname. Which cannot be accomplished without superuser privileges. Value of i was being sent as a parameter; instead of no parameters at all. Your note above definitely works. Plus, here is a completely working script. Sends fifty /bin/hostname requests to all available nodes and prints out the results:

import dispy
cluster = dispy.JobCluster('/bin/hostname', cleanup=False, dest_path='test')
jobs=[]
for i in range(50):
    job=cluster.submit()
    jobs.append(job)
for j in jobs:
    job()
    print j.stdout