forked from ejeffrey/labrad-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
labrad_manager_notes.txt
189 lines (155 loc) · 7.72 KB
/
labrad_manager_notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
Labrad manager tasks:
Notes:
pylabrad 0.92 types;
1.0, Value(1.0), Value(1.0, None) -> 'v'
Value(1.0, ''), (1.0*GHz / (1.0*GHz)) -> 'v[]'
Labrad manager converts v-> target units, but v[] is explicitly dimensionless
pylabrad servers don't include type tags on unflatten, so handleRequest
expects records without type tags. sendPacket can accept records with type
tags, but does not require them.
FIXME:
Change lazy lists to not be lazy
Fix unit handling, use ValueArrays
Make sure pylabrad is always unflattening as the expected data type
Make 'synchronous' packet type for debugging.
Make error message specify which setting had the error "error in setting 5L (cd), cannot flatten argument...
Login sequence:
# Packet 1: origin client, target 1, context any, request ID: positive, no records
# Response: from source ID 1, same context, -request ID, single response settnig 0: (s) pw challenge
# Packet 2: origin client: target 1, context any, request ID: positive, setting 0 MD5(pw_challenge + pw)
# Response: from setting 0: (s) welcome message or error
# Packet 3: target 1, context any, request ID any, setting 0 (ws) or (wsss) for client/server
# containing protocol version, client/server name, description, remarks.
# Response: from setting 0: (w) connection ID or error.
Protocol version 3:
Improved protocol negotiation
Client adds records in the initial request to indicate it knows about version negotiation
Check old server behavior: presumably it disconnects -- client reconnects as v2.0
Otherwise server replies with the version it will use along with pw challenge
Feature negotiation happens in packet 3.
Force big-endian
Don't convert data in manager
This can coexist with version 2 clients. Always convert or not based on desination unless
little endian data targets v3 connection in which case always convert (only endian?).
Forward requests (ID > 0) are always converted at the server.
Responses (ID < 0) are converted at client or server? Client is 'safer', server has the right
information
Allow auxillary direct connection with fallback to manager
Server advertizes its availablility
Client requests temporary auth token via manager
Client connects to server.
Disconnect of auxillary connection cause revert to manager
How to handle context expiration notices? First message from context always via manager?
Only allow (0,x) contexts? Seems overly limiting
Add 64 bit integer type (q)
Add unitless float type (f) # Hopefully reduce confusion over v vs v[]
Add unitless complex type (z) # Hopefully reduce confusion over c vs c[]
Add unicode type (u) -- don't make strings default to unicode
Add option negotiation to handshake phase
Safe context -- contexts that will raise an error if the context doesn't exist on the server.
Client and server must both support it.
Client must explicitly request it for each server
Client asks manager to support explicit contexts for a specific server (?)
Client calls init_context on server
Every request from client has 'notify on new context' flag?
TODO:
Core:
Optimize unit conversion for arrays using numpy
Behavior to test:
rejecting incompatible type tags
converting i,w,b types (?)
Check exceptions when shutting down manager
clean up debugging print statements PARTIAL
GUI:
Sort ID numerically instead of lexically
In memory server:
Get/set blacklist/whitelist: Implemented but not accessible
Make sure all names are case insensitive but case preserving
Manipulate whitelist from server interface
Prohibit dropping registry connection
Registry:
Separate process registry needs to get path from command line
performance test with/without fsync() -- possibly need separate thread for registry so sync() doesn't block manager
Stop relying on garbage collection to clean up directory contexts
Test compatibility with delphi registry dir
Optional:
Make registry optional
Performance optimization:
Do endian conversion without full unflattening
Avoid unflattening completely for remote servers
PARTIAL: lazy lists are not unflattened if contents don't
require unit/type/endian conversion. Still need
optimization to unflatten as numpy array for
unit conversion -- IN PROGRESS, see types.py / TransformingBuffer
detect when endianness / unit conversions allow it. For
simplicty, only allow direct communication for
big-endian clients and servers that don't require unit conversion
Change flatteing to use buffer API to avoid reallocation -- DONE
DONE:
Convert units -- DONE
Accept connections, check whitelist handle signon -- DONE
Convert endiennes -- DONE
add default client index to zero context -- DONE
how are settings registered? message or request? -- DONE
Manage list of connected clients/servers -- DONE
When client disconnects:
Send context expiration to serve -- DONE
utility functions (unit conversion, flatten/unflatten, help) -- DONE
Manipulate server setting lists -- DONE
Handle named signal subscriptions -- DONE
Allow gui-free startup -- Avoid QT dependency entirely DONE
Generate error response on sendPacket failure DONE
Get unit type conversion working (to extent supported by pylabrad) DONE
Save/restore whitelist DONE
Prohibit dropping manager connection DONE
Enforce blacklist DONE
Make registry files end with newline DONE
Make all file writes atomic DONE
Make registry get path from cfg object when invoked from manager DONE
Use delphi compatible format DONE
Try PyPy (without QT) -- DONE Poor performance for some reason
avoid extra flattening/unflattening for in-memory servers (probably not helpful since the in-memory servers are not performance critical)
Allow extra in-memory servers -- Probably not particularly helpful
Would be cool:
peer-to-peer server with built-in manager -- only big-endian (?) -- won't help qubit sequencer easily
How to make peer-peer work:
server registers with manager as p-p capable, gives IP and port
client asks manager for connection token
connect to server with API v2.1, provides connection token
connection token = hmac(client ID + sequence number (?), server secret token)
server asks manager to validate connection token, or does so automatically
server must validate input data and do unit conversions
version 2.1:
support version negotiation
Big endian only
No 'v' tag
support 64 bit integer (tag=L)
manager doesn't do unit conversion
Allow p-p
Performance benchmarking:
manager CPU core i3 530 @ 2.93 GHz
%time sq.lollipop(s, 'q1', update=False, df=10*MHz)
python manager: (slow types)
CPU times: user 71.62 s, sys: 0.00 s, total: 71.62 s
Wall time: 71.62 s
delphi manager:
CPU times: user 42.25 s, sys: 0.00 s, total: 42.25 s
Wall time: 42.25 s
python manager with fasttypes:
CPU times: user 26.30 s, sys: 0.00 s, total: 26.30 s
Wall time: 26.30 s
stats time (pyfast) time (delphi)
300 23.3 15.69
1000 29.75 29.67
2000 36.08
3000 52.10
4000 61.74 61.35
6000 92.01
8000 136.45 123.2
%time sq.lollipop(s, 'q1', update=False, df=10*MHz, stats=1000)
CPU times: user 29.75 s, sys: 0.00 s, total: 29.75 s
Wall time: 29.75 s
unable to convert data for request -2 to setting 1100:
data: (([3, -6, 0, ...]),), allowed types: '['*2w', '*3w', LRError(LRAny())]'
calculate_readout_axis, 30000 stats:
delphi: 9.83s