Project

General

Profile

Test Network Connection Between Remote and Instrument Computers » History » Version 29

Anchi Cheng, 07/06/2016 04:19 PM

1 20 Anchi Cheng
h1. Test Network Connection Between Remote and Instrument Computers
2 1 Amber Herold
3
4
5 20 Anchi Cheng
By far the biggest installation problem comes from network connection is block at the microscope/camera computer from the remote computer where the main Leginon program is run. Here is a test to do before trying to start leginon operation at the remote computer. Leginon bulletin board has a thread that has  "various problems and solutions":http://emg.nysbc.org/boards/6/topics/3  from users.
6 1 Amber Herold
7
8
9
h2. Start a Test Launcher on the Microscope Computer
10
11
12
13 11 Amber Herold
#  scope> go to the location where Leginon is installed, generally
14 27 Anchi Cheng
 <pre>C:\Python27\Lib\site-packages\Leginon\</pre>
15 11 Amber Herold
#  scope> double click on test1.py. You should see something like this:
16
<pre>INFO localtransport server created at location {'instance': <localtransport.Server object at 0x40e614cc>}
17 1 Amber Herold
INFO tcptransport server created at location {'hostname': 'myscope', 'port': 49152}
18
INFO <class 'event.SetManagerEvent'> binding added for destination myscope, method <function printData at 0x40e63c34>
19
ACCEPTING CONNECTIONS AT:  myscope:49152
20 11 Amber Herold
hit enter to kill
21
</pre>
22 1 Amber Herold
**If the line before last says ACCEPTING CONNECTIONS ...., you have an opened port on this host.
23 11 Amber Herold
&nbsp;
24
# Write down the name of the hose, in this case "myscope", and the opened port, in this case "49152", and proceed to try to connect to that computer from the remote compute in the next step.
25 1 Amber Herold
26
27 6 Anchi Cheng
h2. Attempt Connection from the Remote Computer
28 1 Amber Herold
29
30 11 Amber Herold
#  remote linux computer> go to the location where Leginon is installed, type the following to find the location:
31 1 Amber Herold
 <pre>start-leginon.py -v</pre>
32 11 Amber Herold
#  remote linux computer> start the 2nd test script with the host name of the microscope computer and its open port
33
<pre>
34
remote linux computer/Leginon>test2.py myscope 49152
35
</pre>
36 1 Amber Herold
You should see something like this:
37 11 Amber Herold
<pre>
38
INFO localtransport server created at location {'instance': <localtransport.Server object at 0x2b08e0d43810>}
39 1 Amber Herold
INFO tcptransport server created at location {'hostname': 'myremote', 'port': 49152}
40
ACCEPTING CONNECTIONS AT:  myremote:49152
41
INFO <class 'event.NodeAvailableEvent'> binding added for destination myremote, method <function printData at 0x2b08e0d51c80>
42
CONNECTING TO:  myscope:49154
43
WARNING localtransport client add failed
44
INFO tcptransport client added
45 3 Anchi Cheng
INFO server location set to to {'TCP transport': {'hostname': 'myscope', 'port': 49154}}
46
hit enter to kill
47
48 1 Amber Herold
INFO handling threaded
49
INFO inserted in queue (class NodeAvailableEvent)
50
INFO <class 'event.NodeAvailableEvent'> handling destination defcon1, method <function printData at 0x2b08e0d51c80>
51
REMOTE CLIENT RESPONDED:  myscope:49154
52
</pre>
53
54
55
If you get the last line "REMOTE CLIENT RESPONDED" with correct hostname and port, the
56
connection is fine. You can go to next section to test Leginon run on the remote
57
computer.
58
59 17 Anchi Cheng
You can ignore the following error message print out in test1.py on the microscope PC when you exit it.
60
<pre>
61
tcptransport.TransportError: No route to host
62
</pre>
63 1 Amber Herold
64
h2. Problem solving tips
65
66
67 15 Amber Herold
*  See Leginon bulletin board thread on "network problem, Leginon not seeing tecnai host":http://emg.nysbc.org/boards/6/topics/3
68 1 Amber Herold
69 29 Anchi Cheng
h2. Check if the hostname case matches
70 1 Amber Herold
71 29 Anchi Cheng
Python is case-sensitive.  We have seen it rejects the host because of it.  If using host file to identify the host, it is best to match the case as found from leginon/test1.py
72 1 Amber Herold
73
h2. Most likely reason for the failure of the test: FIREWALL
74
75
76
77 7 Amber Herold
*  The easiest solution is have the involving computers inside the same firewall.
78 1 Amber Herold
79 23 Anchi Cheng
*  Alternatively, you can
80 25 Anchi Cheng
# add python to firewall application exception OR
81 26 Anchi Cheng
# open [[Ports_used_by_Leginon|specific ports for Leginon system]]
82 23 Anchi Cheng
83
The latter is described in the Leginon bulletin board thread on "network problem, Leginon not seeing tecnai host":http://emg.nysbc.org/boards/6/topics/3
84 1 Amber Herold
85
86
87 27 Anchi Cheng
h2. Another possible reason for the failure of the test: hostname-ip address mismatch
88 1 Amber Herold
89 27 Anchi Cheng
For leginon to communicate through socket, it needs to know the hostname of itself and the other computer it is connected to in both ways.  The hostname also need to map properly to the IP address the partner understand as.
90 1 Amber Herold
91 27 Anchi Cheng
If you are on a dynamically assigned domain name system (DNS), this should all be taken care of.  However, since the local hosts file overwrites the DNS assignment, you should check if you have a mismatch if you do have problem.
92
93
You should therefore check if you have [[add host|added hosts]] to the right files on both sides of the connection.
94
95
To confirm what python thinks the hosname is on its own computer, run the following in python command line:
96 1 Amber Herold
<pre>
97
import socket
98
socket.gethostname()
99 27 Anchi Cheng
</pre>
100
101
You can also get the IP address with this python command after importing socket like above
102
<pre>
103
socket.gethostbyname(socket.gethostname())
104
</pre>
105
106
You should also check what one computer think the another's ip address is through socket connection once you know the hostname for the other computer
107
<pre>
108
socket.gethostbyname('hostname_of_the_other_computer')
109 18 Anchi Cheng
</pre>
110 28 Anchi Cheng
111
h3. What if the host IP address obtained from socket.gethostbyname on a computer with multiple network card is not the network that connects to other hosts involved in Leginon
112
113
You may need to [[reorder the network connections]] so that the appropriate network is the first to access.
114 2 Amber Herold
______
115
116 21 Anchi Cheng
[[Test Leginon on the Computer Controlling the Microscope|< Test Leginon on the Computer Controlling the Microscope]] | [[Run Leginon Client on the Instrument Computers|Run Leginon Client on the Instrument Computers >]]
117 2 Amber Herold
118
______