Added pipeline info to code sections for executor. Fixes #975 (#976)

* Added pipelineName, pipelineInputNames fields. Fixes #975

* WIP #975 Added logs, removed unnecessary code

* WIP #975 Updated export pipeline to cli
Esse commit está contido em:
Brian Broll
2017-01-31 21:38:02 -06:00
commit de GitHub
commit bbef573418
3 arquivos alterados com 17 adições e 11 exclusões
+10 -2
Ver Arquivo
@@ -151,6 +151,7 @@ define([
staticInputs,
files;
this.logger.info(`About to retrieve ${config.format} exporter`);
exporter = this.getExporterFor(format);
staticInputs = config.staticInputs.map(id => {
@@ -165,7 +166,13 @@ define([
};
});
files = exporter.main(sections, staticInputs, config.extensionConfig);
this.logger.info('Invoking exporter "main" function...');
try {
files = exporter.main(sections, staticInputs, config.extensionConfig);
} catch (e) {
this.logger.error(`Exporter failed: ${e.toString()}`);
throw e;
}
// If it returns a string, just put a single file
if (typeof files === 'string') {
return this.blobClient.putFile(`${name}.lua`, files);
@@ -307,7 +314,8 @@ define([
this.addCodeSerializers(code);
// Define the main input names
code.mainInputNames = Object.keys(this.isInputOp).map(id => this._nameFor[id]);
code.pipelineName = Object.keys(code.pipelines)[0];
code.pipelineInputNames = Object.keys(this.isInputOp).map(id => this._nameFor[id]);
// Add custom class definitions
this.addCustomClasses(code);
+5 -6
Ver Arquivo
@@ -53,8 +53,7 @@ end`;
code.push(this.getAllDefinitions(sections));
// Command line specific stuff
var pipelineName = Object.keys(sections.pipelines)[0],
files = {},
var files = {},
main,
args,
staticNames = staticInputs.map(input => input.name),
@@ -62,12 +61,12 @@ end`;
index = 1;
// Create some names for the inputs
args = sections.mainInputNames.map(name => `${sections.deserializerFor[name]}(${name})`);
args = sections.pipelineInputNames.map(name => `${sections.deserializerFor[name]}(${name})`);
main = `local outputs = ${pipelineName}(${args.join(', ')})`;
main = `local outputs = ${sections.pipelineName}(${args.join(', ')})`;
// Grab the args from the cli
code.push(sections.mainInputNames.map((name, index) => {
code.push(sections.pipelineInputNames.map((name, index) => {
return `local ${name} = arg[${index + 1}]`;
}).join('\n'));
@@ -81,7 +80,7 @@ end`;
});
// Grab the remaining args from the cli
varDefs = varDefs.concat(sections.mainInputNames.map(name => {
varDefs = varDefs.concat(sections.pipelineInputNames.map(name => {
if (!staticNames.includes(name)) {
return `local ${name} = arg[${index++}]`;
}
@@ -455,13 +455,12 @@ define([
var exportFormats = Object.keys(ExportFormatDict),
configDialog = new ConfigDialog(this.client, this._currentNodeId),
inputConfig = _.extend({}, metadata),
extOptions = [];
inputConfig = _.extend({}, metadata);
inputConfig.configStructure = inputOpts;
// Try to get the extension options
if (inputOpts.length || exportFormats.length > 1|| extOptions.length) {
if (inputOpts.length || exportFormats.length > 1) {
configDialog.show(inputConfig, (allConfigs) => {
var context = this.client.getCurrentPluginContext(pluginId),
exportFormat = allConfigs.FormatOptions.exportFormat,