[WIP] Implements show commands#117
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)' }
|
prasadtalasila
left a comment
There was a problem hiding this comment.
@mukkachaitanya Please see the suggested changes.
| @@ -0,0 +1,16 @@ | |||
| const getInput = async (args) => { | |||
There was a problem hiding this comment.
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.
I have only implemented the status command, sir. That needs no prompt.
| }; | ||
|
|
||
| const onShow = async (args, options, logger) => { | ||
| logger.moduleLog('info', 'Exit', 'Show command invoked.'); |
There was a problem hiding this comment.
This may be logger.moduleLog('info', 'Show', 'Show command invoked.');
| 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.
These two log statements again belong to Show module, not Eval and the statements can be better.
| @@ -0,0 +1,10 @@ | |||
| const validate = (showEvent) => { | |||
There was a problem hiding this comment.
There is no validation logic here. Are you planning to add more later?
There was a problem hiding this comment.
Yes, sir. The status command had not validation.
| spinner.stop(); | ||
| }; | ||
|
|
||
| const sendOutput = (event) => { |
There was a problem hiding this comment.
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.
|
| 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.
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