Project

General

Profile

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

Anchi Cheng, 05/09/2018 02:03 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 30 Anchi Cheng
h2. Array Transport tests
65
66
There is another pair of tests in leginon: *test1_array_transport.py* and *test2_array_transport.py* that, in addition to the connection test, also send through this connection a few simulated image array.  This allows a test of the transfer speed and of the continuing connection.
67
68
They run in the same way as the above test.py and test2.py.  The output is longer.  On the window for test1_array_transport.py output, you should find timing of how long it takes to send 32uint 4096x4096 array (=0.5 gigabit), like this:
69
70
<pre>
71
Event Sent Time (sec) 0.811000108719
72
</pre>
73
74
The sent time depends on your network speed.
75
76 32 Anchi Cheng
Prior to that line of timing, it would say that it inserted into queue what it needs to sent etc and the location it is sending to, like this:
77 31 Anchi Cheng
78
<pre>
79
INFO inserted in queue <ckass SetManagerEvent> handling threaded
80
INFO leginon.tcptransport client added
81
INFO server location set to {'TCP transport':{'hostname': your_test2_hostname, 'port': the port_test2_opened}}
82
INFO <class 'leginon.event.ArrayPassingEvent'> handling destination anchi3.nimgs.com, method <function printData at 0x103f0eb18>
83
</pre>
84
85 30 Anchi Cheng
On the window for test2_array_transport.py output, you should get, before the line "hit enter to kill":
86
87
<pre>
88
INFO inserted in queue (class ArrayPassingEvent)
89
 INFO handling threaded
90
INFO <class 'leginon.event.ArrayPassingEvent'> handling destination anchi3.nimgs.com, method <function printData at 0x103f0eb18>
91
got array (4096, 4096)
92
</pre>
93
94
This message will repeat as many times as the number of arrays being sent from test1_array_transport.py
95
96
If the basic test1.py test2.py pair in the previous section passes but not this.  It means that your network connection has trouble keeping the connection alive after each transmission.
97
98 1 Amber Herold
h2. Problem solving tips
99
100
101 15 Amber Herold
*  See Leginon bulletin board thread on "network problem, Leginon not seeing tecnai host":http://emg.nysbc.org/boards/6/topics/3
102 1 Amber Herold
103 29 Anchi Cheng
h2. Check if the hostname case matches
104 1 Amber Herold
105 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
106 1 Amber Herold
107
h2. Most likely reason for the failure of the test: FIREWALL
108
109
110
111 7 Amber Herold
*  The easiest solution is have the involving computers inside the same firewall.
112 1 Amber Herold
113 23 Anchi Cheng
*  Alternatively, you can
114 25 Anchi Cheng
# add python to firewall application exception OR
115 26 Anchi Cheng
# open [[Ports_used_by_Leginon|specific ports for Leginon system]]
116 23 Anchi Cheng
117
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
118 1 Amber Herold
119
120
121 27 Anchi Cheng
h2. Another possible reason for the failure of the test: hostname-ip address mismatch
122 1 Amber Herold
123 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.
124 1 Amber Herold
125 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.
126
127
You should therefore check if you have [[add host|added hosts]] to the right files on both sides of the connection.
128
129
To confirm what python thinks the hosname is on its own computer, run the following in python command line:
130 1 Amber Herold
<pre>
131
import socket
132
socket.gethostname()
133 27 Anchi Cheng
</pre>
134
135
You can also get the IP address with this python command after importing socket like above
136
<pre>
137
socket.gethostbyname(socket.gethostname())
138
</pre>
139
140
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
141
<pre>
142
socket.gethostbyname('hostname_of_the_other_computer')
143 18 Anchi Cheng
</pre>
144 28 Anchi Cheng
145
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
146
147 33 Anchi Cheng
h3. Solution 1: *create mapping on the computers that need communication with the needed pairing*.
148
149
This works if the problem is on your leginon linux box.
150
151
For example, your leginon linux box has two network connections, one local one toward your scope and camera (192.168.10.30, for example), and one toward your university internet(123.456.78,9).  Its hostname "leginonmain.my.u.edu" is default to the university network 123.456.78.9.
152
153
If there is not a mapping of
154
155
192.168.10.30  leginonmain.my.u.edu
156
157
 in the scope/camera Windows 7 computer C:\\WINDOWS\system32\drivers\etc\hosts, the communication will fail.
158
159
h3. Solution 2: reorder the network connections.  We had to do this once.
160
161 28 Anchi Cheng
You may need to [[reorder the network connections]] so that the appropriate network is the first to access.
162 2 Amber Herold
______
163
164 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 >]]
165 2 Amber Herold
166
______