-
Notifications
You must be signed in to change notification settings - Fork 19
New mm reboot #284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New mm reboot #284
Changes from all commits
9b0333b
62aa7e0
bb9e17c
ecf8cd7
9624c8f
3f13249
fab6a1a
df1638e
51f942c
be0703f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,7 +61,6 @@ | |
|
|
||
| startMeasureManager() { | ||
| const vm = this; | ||
|
|
||
| // find an open port | ||
| portfinder.getPortPromise({ | ||
| port: 3100, | ||
|
|
@@ -70,67 +69,61 @@ | |
| vm.port = port; | ||
| vm.$log.info('Measure Manager port: ', vm.port); | ||
|
|
||
| vm.$log.info('Start Measure Manager Server: ', vm.cliPath, ' measure -s ', vm.port); | ||
| vm.cli = vm.spawn(vm.cliPath, ['classic', 'measure', '-s', vm.port]); | ||
| vm.$log.info('Start Measure Manager Server: ', vm.cliPath, 'measure -s ', vm.port); | ||
| vm.cli = vm.spawn(vm.cliPath, ['measure', '-s', vm.port], { cwd: '.', stdio : 'pipe' }); | ||
| vm.cli.stdout.on('data', (data) => { | ||
| // record errors | ||
| if (data.indexOf('<0>') !== -1) { | ||
| // WARNING | ||
| vm.$log.warn(`MeasureManager WARNING: ${data}`); | ||
| vm.Message.appendMeasureManagerError({type: 'warning', data: data.toString()}); | ||
| } else if (data.indexOf('<1>') !== -1) { | ||
| // ERROR | ||
| vm.$log.error(`MeasureManager ERROR: ${data}`); | ||
| vm.Message.appendMeasureManagerError({type: 'error', data: data.toString()}); | ||
| } else if(data.indexOf('<2>') !== -1) { | ||
| // ERROR | ||
| // FATAL | ||
| vm.$log.error(`MeasureManager ERROR: ${data}`); | ||
| vm.Message.appendMeasureManagerError({type: 'fatal', data: data.toString()}); | ||
| } else { | ||
| if (vm.Message.showDebug()) { | ||
| vm.$log.debug(`MeasureManager: ${data}`); | ||
| } | ||
| } | ||
| else { | ||
| if (vm.Message.showDebug()) vm.$log.debug(`MeasureManager: ${data}`); | ||
| } | ||
|
|
||
| // check that the mm was started correctly: resolve readyDeferred | ||
| const str = data.toString(); | ||
| if (str.indexOf('WEBrick::HTTPServer#start: pid=') !== -1) { | ||
| if (vm.Message.showDebug()) vm.$log.debug('Found WEBrick Start!, resolve promise'); | ||
| vm.mmReadyDeferred.resolve(); | ||
| } | ||
| // TODO: THIS IS TEMPORARY (windows): | ||
| else if (str.indexOf('Only one usage of each socket address') !== -1) { | ||
| if (vm.Message.showDebug()) vm.$log.debug('WEBrick already running...assuming MeasureManager is already up'); | ||
| if ((str.indexOf('Accepting requests on:') !== -1) || | ||
| (str.indexOf('MeasureManager Ready') !== -1)) { | ||
| vm.$log.info('Found MeasureManager Start, MeasureManager is running'); | ||
| vm.mmReadyDeferred.resolve(); | ||
| } | ||
| // TODO: THIS IS TEMPORARY (mac): | ||
| else if (str.indexOf('Error: Address already in use') !== -1) { | ||
| if (vm.Message.showDebug()) vm.$log.debug('WEBrick already running...assuming MeasureManager is already up'); | ||
| vm.mmReadyDeferred.resolve(); | ||
| } | ||
|
|
||
| }); | ||
| vm.cli.stderr.on('data', (data) => { | ||
| vm.$log.info(`MeasureManager: ${data}`); | ||
| // check that the mm was started correctly: resolve readyDeferred | ||
| const str = data.toString(); | ||
| if (str.indexOf('WEBrick::HTTPServer#start: pid=') !== -1) { | ||
| if (vm.Message.showDebug()) vm.$log.debug('Found WEBrick Start!, resolve promise'); | ||
| vm.mmReadyDeferred.resolve(); | ||
| } | ||
| // TODO: THIS IS TEMPORARY (windows): | ||
| else if (str.indexOf('Only one usage of each socket address') !== -1) { | ||
| if (vm.Message.showDebug()) vm.$log.debug('WEBrick already running...using tempMeasureManager'); | ||
| vm.mmReadyDeferred.resolve(); | ||
| } | ||
| // TODO: THIS IS TEMPORARY (mac): | ||
| else if (str.indexOf('Error: Address already in use') !== -1) { | ||
| if (vm.Message.showDebug()) vm.$log.debug('WEBrick already running...using tempMeasureManager'); | ||
| vm.mmReadyDeferred.resolve(); | ||
| } | ||
| // C++ CLI printing errors when requests fail on stderr, eg when post | ||
| // data is missing: | ||
| // [2024-11-14T13:32:17+01:00] "POST /compute_arguments HTTP/1.1" 400 | ||
| vm.$log.error(`MeasureManager: ${data}`); | ||
|
Comment on lines
+102
to
+105
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure what's wanted here |
||
| }); | ||
| vm.cli.on('error', (err) => { | ||
| console.log('Failed to start measure manager'); | ||
| }); | ||
| vm.cli.on('message', (msg) => { | ||
| console.log(`child message due to receipt of signal ${msg}`); | ||
| }); | ||
|
|
||
| vm.cli.on('close', (code) => { | ||
| vm.$log.info(`Measure Manager exited with code ${code}`); | ||
| }); | ||
| }).catch(() => vm.$log.error('Error locating an open port for measure manager.')); | ||
| vm.cli.on('exit', (code) => { | ||
| if (code !== 0) { | ||
| const msg = `Failed with code = ${code}`; | ||
| console.log(msg); | ||
| } | ||
| }); | ||
|
|
||
| }).catch((err) => { | ||
| vm.$log.error('Error locating an open port for measure manager.'); | ||
| }); | ||
|
Comment on lines
+117
to
+126
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. kept from #267 |
||
| } | ||
|
|
||
| stopMeasureManager() { | ||
|
|
@@ -249,7 +242,6 @@ | |
|
|
||
| // reset MeasureManagerErrors when a new action | ||
| vm.Message.resetMeasureManagerErrors(); | ||
|
|
||
| return vm.$http.post(`${vm.url}:${vm.port}/set`, params) | ||
| .then(res => { | ||
| vm.$log.info('Measure Manager setMyMeasuresDir Success!, status: ', res.status); | ||
|
|
@@ -289,7 +281,10 @@ | |
| .then(res => { | ||
| vm.$log.info('Measure Manager download_bcl_measure Success!, status: ', res.status); | ||
| vm.$log.info('Data: ', res.data); | ||
| return res.data[0]; | ||
| // Classic (Ruby) CLI uses to return a single-element list | ||
| // C++ CLI returns the element directly | ||
| //return res.data[0]; | ||
| return res.data | ||
|
Check failure on line 287 in app/app/main/measureManagerService.js
|
||
| }) | ||
| .catch(res => { | ||
| vm.$log.error('Measure Manager download_bcl_measure Error: ', res.data); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure whether the
{ cwd: '.', stdio : 'pipe' }is needed, it was in #267