Skip to content

Commit

Permalink
Merge pull request #22 from pierotofy/run
Browse files Browse the repository at this point in the history
Replaced run.py with run.sh
  • Loading branch information
pierotofy authored Sep 15, 2017
2 parents 3586a31 + d07e8e5 commit f70e78a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion libs/Task.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ let processRunner = require('./processRunner');
let archiver = require('archiver');
let os = require('os');
let Directories = require('./Directories');
let kill = require('tree-kill');

let statusCodes = require('./statusCodes');

Expand Down Expand Up @@ -195,7 +196,7 @@ module.exports = class Task{
// the process will immediately terminate.
// For eaxmple in the case of the ODM process, the process will continue running for a while
// This might need to be fixed on ODM's end.
proc.kill('SIGINT');
kill(proc.pid);
});
this.runningProcesses = [];
}
Expand Down
14 changes: 8 additions & 6 deletions libs/odmRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,26 @@ module.exports = {
assert(projectName !== undefined, "projectName must be specified");
assert(options["project-path"] !== undefined, "project-path must be defined");

let command = [path.join(config.odm_path, "run.py")];
const command = path.join(config.odm_path, "run.sh"),
params = [];

for (var name in options){
let value = options[name];

// Skip false booleans
if (value === false) continue;

command.push("--" + name);
params.push("--" + name);

// We don't specify "--time true" (just "--time")
if (typeof value !== 'boolean'){
command.push(value);
params.push(value);
}
}

command.push(projectName);
params.push(projectName);

logger.info(`About to run: python ${command.join(" ")}`);
logger.info(`About to run: ${command} ${params.join(" ")}`);

if (config.test){
logger.info("Test mode is on, command will not execute");
Expand All @@ -68,7 +70,7 @@ module.exports = {
}

// Launch
let childProcess = spawn("python", command, {cwd: config.odm_path});
let childProcess = spawn(command, params, {cwd: config.odm_path});

childProcess
.on('exit', (code, signal) => done(null, code, signal))
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"request": "^2.81.0",
"rimraf": "^2.5.3",
"swagger-jsdoc": "^1.3.1",
"tree-kill": "^1.1.0",
"unzip": "^0.1.11",
"winston": "^2.2.0"
},
Expand Down

0 comments on commit f70e78a

Please sign in to comment.