-
Notifications
You must be signed in to change notification settings - Fork 0
New mm reboot #1
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
base: new-mm-rebase
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -59,18 +59,8 @@ export class MeasureManager { | |
| return vm.mmReadyDeferred.promise; | ||
| } | ||
|
|
||
| sleep(milliseconds) { | ||
| var start = new Date().getTime(); | ||
| for (var i = 0; i < 1e7; i++) { | ||
| if ((new Date().getTime() - start) > milliseconds){ | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| startMeasureManager() { | ||
| const vm = this; | ||
| let str = ''; | ||
| // find an open port | ||
| portfinder.getPortPromise({ | ||
| port: 3100, | ||
|
|
@@ -79,9 +69,8 @@ export class MeasureManager { | |
| vm.port = port; | ||
| vm.$log.info('Measure Manager port: ', vm.port); | ||
|
|
||
| vm.$log.info('Start Measure Manager Server: ', vm.cliPath, 'labs measure -s ', vm.port); | ||
| let the_cmd = vm.cliPath + ' labs'; | ||
|
Owner
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. Unused |
||
| vm.cli = vm.spawn(vm.cliPath, ['labs', 'measure', '-s', vm.port], { cwd: '.', stdio : 'pipe' }); | ||
| vm.$log.info('Start Measure Manager Server: ', vm.cliPath, 'measure -s ', vm.port); | ||
|
Owner
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. C++ CLI is default now |
||
| 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) { | ||
|
|
@@ -92,58 +81,32 @@ export class MeasureManager { | |
| 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 | ||
| str = data.toString(); | ||
| if (str.indexOf('WEBrick::HTTPServer#start: pid=') !== -1) { | ||
| vm.$log.info('Found WEBrick Start, MeasureManager is running'); | ||
| vm.mmReadyDeferred.resolve(); | ||
| } | ||
| // TODO: THIS IS TEMPORARY (windows): | ||
| else if (str.indexOf('Only one usage of each socket address') !== -1) { | ||
| vm.$log.info('WEBrick already running...assuming MeasureManager is already up'); | ||
| vm.mmReadyDeferred.resolve(); | ||
| } | ||
| // TODO: THIS IS TEMPORARY (mac): | ||
| else if (str.indexOf('Error: Address already in use') !== -1) { | ||
| vm.$log.info('WEBrick already running...assuming MeasureManager is already running'); | ||
| vm.mmReadyDeferred.resolve(); | ||
| } | ||
| else if (str.indexOf('MeasureManager Ready') !== -1) { | ||
| // New labs command MeasureManager | ||
| vm.$log.info("LABS command 'MeasureManagerReady' detected. MeasureManager is running!"); | ||
| const str = data.toString(); | ||
| if ((str.indexOf('Accepting requests on:') !== -1) || | ||
| (str.indexOf('MeasureManager Ready') !== -1)) { | ||
|
Comment on lines
+95
to
+96
Owner
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. Feebdack saying it's running is limited to this |
||
| vm.$log.info('Found MeasureManager Start, MeasureManager is running'); | ||
| vm.mmReadyDeferred.resolve(); | ||
| } | ||
| }); | ||
| vm.cli.stderr.on('data', (data) => { | ||
| vm.$log.info(`MeasureManager: ${data}`); | ||
| // check that the mm was started correctly: resolve readyDeferred | ||
| 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}`); | ||
| }); | ||
| 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}`); | ||
| }); | ||
|
|
@@ -154,11 +117,12 @@ export class MeasureManager { | |
| 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.') | ||
| vm.$log.error('Error locating an open port for measure manager.'); | ||
| }); | ||
| } | ||
|
|
||
|
|
@@ -317,7 +281,8 @@ export class MeasureManager { | |
| .then(res => { | ||
| vm.$log.info('Measure Manager download_bcl_measure Success!, status: ', res.status); | ||
| vm.$log.info('Data: ', res.data); | ||
| // KAF: format of res.data has changed with labs MM | ||
| // Classic (Ruby) CLI uses to return a single-element list | ||
| // C++ CLI returns the element directly | ||
| //return res.data[0]; | ||
| return 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.
Unused