-
Notifications
You must be signed in to change notification settings - Fork 19
New C++ MeasureManager #279
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
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9b0333b
testing out new labs MeasureManager
kflemin 62aa7e0
cleanup for labs measure manager
kflemin bb9e17c
Reudate copyright / license (the jS files should be updated too, but …
jmarrec ecf8cd7
Tweak
jmarrec 9624c8f
Bump actions
jmarrec 3f13249
Use nproc
jmarrec fab6a1a
Use a distinct name for each artifact
jmarrec File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,7 +61,6 @@ export class MeasureManager { | |
|
|
||
| startMeasureManager() { | ||
| const vm = this; | ||
|
|
||
| // find an open port | ||
| portfinder.getPortPromise({ | ||
| port: 3100, | ||
|
|
@@ -70,67 +69,61 @@ export class MeasureManager { | |
| 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 @@ export class MeasureManager { | |
|
|
||
| // 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 @@ export class MeasureManager { | |
| .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 | ||
| }) | ||
| .catch(res => { | ||
| vm.$log.error('Measure Manager download_bcl_measure Error: ', res.data); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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