Skip to content

Commit

Permalink
#192 ExecutorPlugin runs, had to add args to executor_config.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeijer committed Feb 26, 2015
1 parent b72f467 commit 691ce1f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
7 changes: 3 additions & 4 deletions src/middleware/executor/ExecutorWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,9 @@ define(['logManager',

var executorConfig = JSON.parse(data);
var cmd = executorConfig.cmd;

logger.debug('working directory: ' + jobDir + ' executing: ' + cmd);

var child = child_process.spawn(cmd, [], {cwd: jobDir, stdio: ['ignore', 'pipe', 'pipe']});
var args = executorConfig.args || [];
logger.debug('working directory: ' + jobDir + ' executing: ' + cmd + ' with args: ' + args.toString());
var child = child_process.spawn(cmd, args, {cwd: jobDir, stdio: ['ignore', 'pipe', 'pipe']});
var outlog = fs.createWriteStream(path.join(jobDir, 'job_stdout.txt'));
child.stdout.pipe(outlog);
child.stdout.pipe(fs.createWriteStream(path.join(self.workingDirectory, jobInfo.hash.substr(0, 6) + '_stdout.txt')));
Expand Down
18 changes: 12 additions & 6 deletions src/plugin/coreplugins/ExecutorPlugin/ExecutorPlugin.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
/*globals define*/
/*jshint node:true, browser:true*/

/**
/** This plugin creates a job for the executor and writes back the results to the model.
* Requirements
* 1) The webgme server must run with enableExecutor: true
* 2) A worker must be attached, see src/middleware/executor/worker/README.txt
* 3) The worker must have 2.7 >= Python < 3 installed.
*
* @author pmeijer / https://github.com/pmeijer
*/

define(['plugin/PluginConfig',
'plugin/PluginBase',
'executor/ExecutorClient',
'ejs',
'middleware/executor/ExecutorClient',
'util/ejs',
'plugin/ExecutorPlugin/ExecutorPlugin/Templates/Templates'],
function (PluginConfig, PluginBase, ExecutorClient, ejs, TEMPLATES) {
'use strict';
Expand Down Expand Up @@ -112,7 +116,9 @@ define(['plugin/PluginConfig',
config = self.getCurrentConfig(),
exitCode = config.success ? 0 : 1,
executorConfig = {
cmd: config.pythonCmd + ' generate_name.py ', // This is the command that will be executed on the worker
cmd: config.pythonCmd, // This is the command that will be executed on the worker
// Make sure no arguments are here, put them in args
args: ['generate_name.py'],
resultArtifacts: [ // These are the results that will be returned
{
name: 'all',
Expand All @@ -137,9 +143,9 @@ define(['plugin/PluginConfig',
callback('No activeNode specified! Set update to false or invoke from a node.', self.result);
return;
}
executorConfig.cmd += self.core.getPath(self.activeNode);
executorConfig.args.push(self.core.getPath(self.activeNode));
} else {
executorConfig.cmd += 'dummy';
executorConfig.args.push('dummy');
}

// The hash of the artifact with these files will define the job. N.B. executor_config.json must exist.
Expand Down

0 comments on commit 691ce1f

Please sign in to comment.