@@ -61,7 +61,7 def multiSchain(child, nProcess=cpu_count(), startDate=None, endDate=None, by_da | |||||
61 | process.terminate() |
|
61 | process.terminate() | |
62 | process.join() |
|
62 | process.join() | |
63 | print traceback.print_tb(trace) |
|
63 | print traceback.print_tb(trace) | |
64 |
|
64 | |||
65 | sys.excepthook = beforeExit |
|
65 | sys.excepthook = beforeExit | |
66 |
|
66 | |||
67 | for process in processes: |
|
67 | for process in processes: |
@@ -114,10 +114,6 class GenericData(object): | |||||
114 |
|
114 | |||
115 | flagNoData = True |
|
115 | flagNoData = True | |
116 |
|
116 | |||
117 | def __init__(self): |
|
|||
118 |
|
||||
119 | raise NotImplementedError |
|
|||
120 |
|
||||
121 | def copy(self, inputObj=None): |
|
117 | def copy(self, inputObj=None): | |
122 |
|
118 | |||
123 | if inputObj == None: |
|
119 | if inputObj == None: | |
@@ -231,10 +227,6 class JROData(GenericData): | |||||
231 |
|
227 | |||
232 | profileIndex = None |
|
228 | profileIndex = None | |
233 |
|
229 | |||
234 | def __init__(self): |
|
|||
235 |
|
||||
236 | raise NotImplementedError |
|
|||
237 |
|
||||
238 | def getNoise(self): |
|
230 | def getNoise(self): | |
239 |
|
231 | |||
240 | raise NotImplementedError |
|
232 | raise NotImplementedError |
@@ -15,6 +15,7 from threading import Thread | |||||
15 | from multiprocessing import Process |
|
15 | from multiprocessing import Process | |
16 |
|
16 | |||
17 | from schainpy.model.proc.jroproc_base import Operation, ProcessingUnit |
|
17 | from schainpy.model.proc.jroproc_base import Operation, ProcessingUnit | |
|
18 | from schainpy.model.data.jrodata import JROData | |||
18 |
|
19 | |||
19 | MAXNUMX = 100 |
|
20 | MAXNUMX = 100 | |
20 | MAXNUMY = 100 |
|
21 | MAXNUMY = 100 | |
@@ -257,7 +258,44 class PublishData(Operation): | |||||
257 | self.client.loop_stop() |
|
258 | self.client.loop_stop() | |
258 | self.client.disconnect() |
|
259 | self.client.disconnect() | |
259 |
|
260 | |||
260 | class ReceiverData(ProcessingUnit, Process): |
|
261 | ||
|
262 | class ReceiverData(ProcessingUnit): | |||
|
263 | ||||
|
264 | def __init__(self, **kwargs): | |||
|
265 | ||||
|
266 | ProcessingUnit.__init__(self, **kwargs) | |||
|
267 | ||||
|
268 | self.isConfig = False | |||
|
269 | server = kwargs.get('server', 'zmq.pipe') | |||
|
270 | if 'tcp://' in server: | |||
|
271 | address = server | |||
|
272 | else: | |||
|
273 | address = 'ipc:///tmp/%s' % server | |||
|
274 | ||||
|
275 | self.address = address | |||
|
276 | self.dataOut = JROData() | |||
|
277 | ||||
|
278 | def setup(self): | |||
|
279 | ||||
|
280 | self.context = zmq.Context() | |||
|
281 | self.receiver = self.context.socket(zmq.PULL) | |||
|
282 | self.receiver.bind(self.address) | |||
|
283 | time.sleep(0.5) | |||
|
284 | print '[Starting] ReceiverData from {}'.format(self.address) | |||
|
285 | ||||
|
286 | ||||
|
287 | def run(self): | |||
|
288 | ||||
|
289 | if not self.isConfig: | |||
|
290 | self.setup() | |||
|
291 | self.isConfig = True | |||
|
292 | ||||
|
293 | self.dataOut = self.receiver.recv_pyobj() | |||
|
294 | print '[Receiving] {} - {}'.format(self.dataOut.type, | |||
|
295 | self.dataOut.datatime.ctime()) | |||
|
296 | ||||
|
297 | ||||
|
298 | class PlotterReceiver(ProcessingUnit, Process): | |||
261 |
|
299 | |||
262 | throttle_value = 5 |
|
300 | throttle_value = 5 | |
263 |
|
301 | |||
@@ -268,7 +306,7 class ReceiverData(ProcessingUnit, Process): | |||||
268 | self.mp = False |
|
306 | self.mp = False | |
269 | self.isConfig = False |
|
307 | self.isConfig = False | |
270 | self.isWebConfig = False |
|
308 | self.isWebConfig = False | |
271 | self.plottypes =[] |
|
309 | self.plottypes = [] | |
272 | self.connections = 0 |
|
310 | self.connections = 0 | |
273 | server = kwargs.get('server', 'zmq.pipe') |
|
311 | server = kwargs.get('server', 'zmq.pipe') | |
274 | plot_server = kwargs.get('plot_server', 'zmq.web') |
|
312 | plot_server = kwargs.get('plot_server', 'zmq.web') |
General Comments 0
You need to be logged in to leave comments.
Login now