pgiri / dispy

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

Canonical program is giving error! #200

Open sagardhakate opened 4 years ago

sagardhakate commented 4 years ago

I have started the dispynode on the node(server) which outside the network ( suppose IP address of node is a.b.c.d, where as client's IP address is e.f.g.h)

After running, the canonical program which has following code at cluster cluster = dispy.JobCluster(compute, nodes = ['a.b.c.d'])

It is giving below error.

dispy_client_error

makla95 commented 4 years ago

I have experienced the same issue after updating from dispy '4.10.5' to '4.11.1'. I was using Python 3.7 and client and server nodes were on the same network.

sagardhakate commented 4 years ago

I'm using Python 3.8.0

makla95 commented 4 years ago

Hi @sagardhakate , for now, you could downgrade dispy on both machines with the following statement: python -m pip install "dispy==4.10.5" --force-reinstall In this version of dispy client uses UDP and TCP ports 51347, dispynode uses UDP and TCP ports 51348, and dispyscheduler uses UDP and TCP ports 51349 so make sure that you properly forward those ports if the machines are behind a NAT firewall/gateway.

sagardhakate commented 4 years ago

But in config.py program of dispy module they have used dispyport as 61590 config_py

sagardhakate commented 4 years ago

Hi @sagardhakate , for now, you could downgrade dispy on both machines with the following statement: python -m pip install "dispy==4.10.5" --force-reinstall In this version of dispy client uses UDP and TCP ports 51347, dispynode uses UDP and TCP ports 51348, and dispyscheduler uses UDP and TCP ports 51349 so make sure that you properly forward those ports if the machines are behind a NAT firewall/gateway.

I am not concerned with dispyscheduler as I am using JobCluster instead of SharedJobCluster Could you please share the entire code what changes we need to make in program or Command line while executing Canonical program on client and dispynode.py on server ?

sagardhakate commented 4 years ago

Is it necessary that node(server) (a.b.c.d) should get pinged from client(e.f.g.h) and vice-versa? Because server is out of the local network of client.

makla95 commented 4 years ago

They don't have to be pingable. I have client and server on different subnets so I can not ping the server from the client. Let's say that my client is 123.4.5.3 and my server is 123.4.8.5. I am using dispy version 4.10.5.

  1. create an inbound port allow rule for both machines If you are on Windows 10: Start->Windows Defender Firewall->Advanced settings->Inbound Rules->New Rule->TCP (later do all of this for UDP as well), Port(click next)->Specific local ports: 51347-51349 (Clink next)-> Next -> Name: dispy (click Finish).
  2. go to dispy directory You can use this python code to find out the directory: import os, dispy print(os.path.dirname(dispy.file))
  3. run the dispynode.py with 4 processing units on server with python dispynode -d -c 4 -i 123.4.8.5
  4. open canonical program change cluster = dispy.JobCluster(compute, nodes = ['a.b.c.d']) to cluster = dispy.JobCluster(compute, nodes= ['123.4.8.5'], ip_addr = '123.4.5.3', ext_ip_addr='123.4.5.3') and run the program If this doesn't work for you try reading about port forwarding with SSH (link 1, link 2, link 3).
sagardhakate commented 4 years ago

They don't have to be pingable. I have client and server on different subnets so I can not ping the server from the client. Let's say that my client is 123.4.5.3 and my server is 123.4.8.5. I am using dispy version 4.10.5.

  1. create an inbound port allow rule for both machines If you are on Windows 10: Start->Windows Defender Firewall->Advanced settings->Inbound Rules->New Rule->TCP (later do all of this for UDP as well), Port(click next)->Specific local ports: 51347-51349 (Clink next)-> Next -> Name: dispy (click Finish).
  2. go to dispy directory You can use this python code to find out the directory: import os, dispy print(os.path.dirname(dispy.file))
  3. run the dispynode.py with 4 processing units on server with python dispynode -d -c 4 -i 123.4.8.5
  4. open canonical program change cluster = dispy.JobCluster(compute, nodes = ['a.b.c.d']) to cluster = dispy.JobCluster(compute, nodes= ['123.4.8.5'], ip_addr = '123.4.5.3', ext_ip_addr='123.4.5.3') and run the program If this doesn't work for you try reading about port forwarding with SSH (link 1, link 2, link 3).

I followed the above steps till 'run the program'..but I am getting below error -

Jobcluster

Here in nodes, I gave server's IP address, whereas in ip_addr and ext_ip_addr, I have given client's IP address, as per your suggestion. I am using Python 3.8.0

Note I have also followed all these above steps using dispy version 4.11.0 as well with replacing port numbers as 61590-61592, but was getting same error as I mentioned in original post (1st post screenshot)

Sample.py is as follows: sample

makla95 commented 4 years ago

They don't have to be pingable. I have client and server on different subnets so I can not ping the server from the client. Let's say that my client is 123.4.5.3 and my server is 123.4.8.5. I am using dispy version 4.10.5.

  1. create an inbound port allow rule for both machines If you are on Windows 10: Start->Windows Defender Firewall->Advanced settings->Inbound Rules->New Rule->TCP (later do all of this for UDP as well), Port(click next)->Specific local ports: 51347-51349 (Clink next)-> Next -> Name: dispy (click Finish).
  2. go to dispy directory You can use this python code to find out the directory: import os, dispy print(os.path.dirname(dispy.file))
  3. run the dispynode.py with 4 processing units on server with python dispynode -d -c 4 -i 123.4.8.5
  4. open canonical program change cluster = dispy.JobCluster(compute, nodes = ['a.b.c.d']) to cluster = dispy.JobCluster(compute, nodes= ['123.4.8.5'], ip_addr = '123.4.5.3', ext_ip_addr='123.4.5.3') and run the program If this doesn't work for you try reading about port forwarding with SSH (link 1, link 2, link 3).

I followed the above steps till 'run the program'..but I am getting below error -

Jobcluster

Here in nodes, I gave server's IP address, whereas in ip_addr and ext_ip_addr, I have given client's IP address, as per your suggestion.

I have followed all these above steps using dispy version 4.11.0 as well with replacing port numbers as 61590-61592, but was getting same error as I mentioned in original post (1st post screenshot)

You probably have multiple versions of python installed on your system and that other version is set higher in Path environment variable. When you type python in cmd does it open python 3.8 or some other version of python?

sagardhakate commented 4 years ago

They don't have to be pingable. I have client and server on different subnets so I can not ping the server from the client. Let's say that my client is 123.4.5.3 and my server is 123.4.8.5. I am using dispy version 4.10.5.

  1. create an inbound port allow rule for both machines If you are on Windows 10: Start->Windows Defender Firewall->Advanced settings->Inbound Rules->New Rule->TCP (later do all of this for UDP as well), Port(click next)->Specific local ports: 51347-51349 (Clink next)-> Next -> Name: dispy (click Finish).
  2. go to dispy directory You can use this python code to find out the directory: import os, dispy print(os.path.dirname(dispy.file))
  3. run the dispynode.py with 4 processing units on server with python dispynode -d -c 4 -i 123.4.8.5
  4. open canonical program change cluster = dispy.JobCluster(compute, nodes = ['a.b.c.d']) to cluster = dispy.JobCluster(compute, nodes= ['123.4.8.5'], ip_addr = '123.4.5.3', ext_ip_addr='123.4.5.3') and run the program If this doesn't work for you try reading about port forwarding with SSH (link 1, link 2, link 3).

I followed the above steps till 'run the program'..but I am getting below error - Jobcluster Here in nodes, I gave server's IP address, whereas in ip_addr and ext_ip_addr, I have given client's IP address, as per your suggestion. I have followed all these above steps using dispy version 4.11.0 as well with replacing port numbers as 61590-61592, but was getting same error as I mentioned in original post (1st post screenshot)

You probably have multiple versions of python installed on your system and that other version is set higher in Path environment variable. When you type python in cmd does it open python 3.8 or some other version of python?

I am using same version of Python on both client and server i.e. 3.8.0. In Cmd as well it shows 3.8.0

makla95 commented 4 years ago

I think that your python is not properly set up. Try unistalling it and I would recomend you to use annaconda python distribution. Install version 3.7 (during installation click on the option "Add Anaconda to my PATH environment variable"). After installation click Start and open Anaconda Prompt. Install dispy version 4.10.5 (python -m pip install "dispy==4.10.5") and then try to run sample.py script.

sagardhakate commented 4 years ago

I think that your python is not properly set up. Try unistalling it and I would recomend you to use annaconda python distribution. Install version 3.7 (during installation click on the option "Add Anaconda to my PATH environment variable"). After installation click Start and open Anaconda Prompt. Install dispy version 4.10.5 (python -m pip install "dispy==4.10.5") and then try to run sample.py script.

I have to follow above steps on Server as well?

sagardhakate commented 4 years ago

I think that your python is not properly set up. Try unistalling it and I would recomend you to use annaconda python distribution. Install version 3.7 (during installation click on the option "Add Anaconda to my PATH environment variable"). After installation click Start and open Anaconda Prompt. Install dispy version 4.10.5 (python -m pip install "dispy==4.10.5") and then try to run sample.py script.

Followed all the above steps on both client and server as you mentioned,

I am getting client screen as follows - Anaconda_client

and server screen of Anaconda prompt is as follows - Anaconda_server

sagardhakate commented 4 years ago

I think that your python is not properly set up. Try unistalling it and I would recomend you to use annaconda python distribution. Install version 3.7 (during installation click on the option "Add Anaconda to my PATH environment variable"). After installation click Start and open Anaconda Prompt. Install dispy version 4.10.5 (python -m pip install "dispy==4.10.5") and then try to run sample.py script.

Followed all the above steps on both client and server as you mentioned,

  • uninstalled Python 3.8.0
  • installed Anaconda Distribution 3.7.4 and also added Anaconda to PATH env variable
  • Installed dispy version 4.10.5 from Anaconda Prompt

I am getting client screen as follows - Anaconda_client

and server screen of Anaconda prompt is as follows - Anaconda_server

Nothing comingup as ouput of compute in sample.py

Note - All the Firewall setting you suggested are as it is

sagardhakate commented 4 years ago

Finally it worked from office( from collegues' machine) ..but still it is not working from home network. Thanks @makla95