cloudcms-cli
Version:
Cloud CMS Command-Line client
60 lines (54 loc) • 1.75 kB
JavaScript
var helper = require("../../../helper");
var AbstractCommand = require("../../abstract");
class KillClusterJobsCommand extends AbstractCommand
{
constructor()
{
super({
"group": "admin",
"name": "kill-cluster-jobs",
"description": "Kills cluster jobs in a given state",
"schema": {
"properties": [{
"name": "state",
"type": "string",
"description": "Enter the state",
"required": true,
"args": ["state"]
}, {
"name": "username",
"type": "string",
"description": "Admin username",
"required": true,
"args": ["username", "u"]
}, {
"name": "password",
"type": "string",
"description": "Admin password",
"required": true,
"hidden": true,
"args": ["password", "p"]
}]
}
});
}
handle(options, callback)
{
if (options.state === "running")
{
// call workhorse function
return helper.killClusterRunningJobs(options.username, options.password, function(err) {
callback(err);
});
}
if (options.state === "waiting")
{
// call workhorse function
return helper.killClusterWaitingJobs(options.username, options.password, function(err) {
callback(err);
});
}
callback();
}
}
module.exports = KillClusterJobsCommand;