-
Notifications
You must be signed in to change notification settings - Fork 10
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
[WIP] Implements show
commands
#117
base: dev
Are you sure you want to change the base?
Conversation
4dcff7f
to
9b4155c
Compare
Output of Output| Fetching request results, please wait... { components: [ { role: 'execution_node', hostname: '10.1.*.***', port: '8091', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8092', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8093', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8094', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8095', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8096', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8097', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8098', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8099', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8100', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8101', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8102', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8103', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8104', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8105', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8106', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8107', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8108', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8109', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8110', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8091', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8092', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8093', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8094', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8095', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8096', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8097', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8098', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8099', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8100', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8101', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8102', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8103', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8104', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8105', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8106', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8107', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8108', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8109', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8110', status: 'down' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8091', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8092', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8093', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8094', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8095', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8096', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8097', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8098', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8099', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8100', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8101', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8102', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8103', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8104', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8105', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8106', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8107', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8108', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8109', status: 'up' }, { role: 'execution_node', hostname: '10.1.*.***', port: '8110', status: 'up' }, { role: 'load_balancer', hostname: 'autolab.bits-goa.ac.in', port: '8081', cmd: 'log', status: 'up' } ], job_queue_length: 0, timestamp: 'Wed Jan 23 2019 12:58:55 GMT+0530 (IST)' } |
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.
@mukkachaitanya Please see the suggested changes.
lib/cli/input/show.js
Outdated
@@ -0,0 +1,16 @@ | |||
const getInput = async (args) => { |
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.
Don't we need
const inquirer = require('inquirer');
const PromptGenerator = require('../../utils/PromptGenerator');
How did the output come without these requires?
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.
I have only implemented the status
command, sir. That needs no prompt.
lib/controller/show.js
Outdated
}; | ||
|
||
const onShow = async (args, options, logger) => { | ||
logger.moduleLog('info', 'Exit', 'Show command invoked.'); |
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.
This may be logger.moduleLog('info', 'Show', 'Show command invoked.');
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.
Fixing it.
lib/controller/show.js
Outdated
const showOptions = await showInput.getInput(args, options); | ||
const validatedOptions = showValidate.validate(showOptions); | ||
|
||
logger.moduleLog('debug', 'Eval', 'Show request for'); |
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.
These two log statements again belong to Show
module, not Eval
and the statements can be better.
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.
Fixing it.
@@ -0,0 +1,10 @@ | |||
const validate = (showEvent) => { |
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.
There is no validation logic here. Are you planning to add more 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.
Yes, sir. The status command had not validation.
lib/cli/output/show.js
Outdated
spinner.stop(); | ||
}; | ||
|
||
const sendOutput = (event) => { |
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.
Starting with this PR, perhaps we can move away from arrow functions to proper functions where there is a bulky function. We had this discussion during the refactoring of tests. The added benefit the the following flow in a module.
module.exports...
//functions arranged to follow top-down rule
@mukkachaitanya I can't see the presentation code in |
The IP is hidden here on GitHub. The actual code output doesn't sir. |
Codecov Report
@@ Coverage Diff @@
## dev #117 +/- ##
=========================================
- Coverage 99.28% 99.18% -0.1%
=========================================
Files 24 29 +5
Lines 695 856 +161
=========================================
+ Hits 690 849 +159
- Misses 5 7 +2
Continue to review full report at Codecov.
|
lib/cli/output/show.js
Outdated
const file = '/tmp/autolabjs/scoreboard'; | ||
try { | ||
await fs.outputFile(file, scoreboard); | ||
spawn('cat /tmp/autolabjs/scoreboard | less -r', { |
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.
exec()
spawns a shell then executes the command within that shell, buffering any generated output to the callback provides. That is the reason I have used spawn()
instead.
@mukkachaitanya The output of |
|
63be8c8
to
d9b9487
Compare
Requirements
Description of the Change
Benefits
Possible Drawbacks
Applicable Issues