Commit f761b366 authored by priit's avatar priit

Dockeri alge

parent cb998c1d
...@@ -16,8 +16,8 @@ var Session = function( id ){ ...@@ -16,8 +16,8 @@ var Session = function( id ){
this.pid = null; //system process id this.pid = null; //system process id
}; };
Session.prototype.addOutputFile = function(key, path){ Session.prototype.addOutputFile = function(key, file){
this.outputFiles[key] = path; this.outputFiles[key] = file;
}; };
Session.prototype.setErrors = function(errors){ Session.prototype.setErrors = function(errors){
...@@ -26,7 +26,7 @@ Session.prototype.setErrors = function(errors){ ...@@ -26,7 +26,7 @@ Session.prototype.setErrors = function(errors){
this.message = Session.messages.ERROR this.message = Session.messages.ERROR
}; };
Session.prototype.getFile = function( key ){ Session.prototype.getRequestFile = function( key ){
var fileValue = this.requestFiles[ key ]; var fileValue = this.requestFiles[ key ];
if(Array.isArray(fileValue)){ if(Array.isArray(fileValue)){
...@@ -35,7 +35,7 @@ Session.prototype.getFile = function( key ){ ...@@ -35,7 +35,7 @@ Session.prototype.getFile = function( key ){
return fileValue; return fileValue;
}; };
Session.prototype.getFiles = function( key ){ Session.prototype.getRequestFiles = function( key ){
var fileValues = this.requestFiles[ key ]; var fileValues = this.requestFiles[ key ];
if(Array.isArray(fileValues)){ if(Array.isArray(fileValues)){
......
...@@ -27,8 +27,8 @@ function LocalExecutor() { ...@@ -27,8 +27,8 @@ function LocalExecutor() {
var command = localCommand.command; var command = localCommand.command;
var commandParams = localCommand.commandParams; var commandParams = localCommand.commandParams;
logger.debug(localCommand.command); //logger.debug(localCommand.command);
logger.debug(localCommand.commandParams); //logger.debug(localCommand.commandParams);
var process = spawn(command, commandParams); var process = spawn(command, commandParams);
......
...@@ -3,9 +3,7 @@ var config = require('./../config'); ...@@ -3,9 +3,7 @@ var config = require('./../config');
var localExecutor = require('./../src/service/executor/localExecutor'); var localExecutor = require('./../src/service/executor/localExecutor');
var Session = require('../src/model/session'); var Session = require('../src/model/session');
var CommandModel = require('../src/mapper/commandModel'); var CommandModel = require('../src/mapper/commandModel');
var fs = require('fs');
var mime = require('mime'); var mime = require('mime');
var path = require('path');
var FileUtil = require('./../src/util/file'); var FileUtil = require('./../src/util/file');
function LocalCommandTemplate(){ function LocalCommandTemplate(){
...@@ -34,8 +32,11 @@ function LocalCommandTemplate(){ ...@@ -34,8 +32,11 @@ function LocalCommandTemplate(){
session.setErrors(response.errors); session.setErrors(response.errors);
} }
session.addOutputFile('output', { var outputType = config.wrapper.outputTypes.pop();
type: 'output',
session.addOutputFile('id_x', {
key : outputType.key,
type: outputType.type,
fileName: config.wrapper.id + '_output.' + FileUtil.getExtension( response.stdOutPath ), fileName: config.wrapper.id + '_output.' + FileUtil.getExtension( response.stdOutPath ),
filePath: response.stdOutPath, filePath: response.stdOutPath,
contentType: mime.lookup(response.stdOutPath) contentType: mime.lookup(response.stdOutPath)
...@@ -51,7 +52,7 @@ function LocalCommandTemplate(){ ...@@ -51,7 +52,7 @@ function LocalCommandTemplate(){
model.serviceProperties.commandTemplate = config.wrapper.command.commandTemplate; model.serviceProperties.commandTemplate = config.wrapper.command.commandTemplate;
model.init( session ); model.init( session );
model.setKeyValue('data', session.getFiles('content')); model.setKeyValue('data', session.getRequestFiles('content'));
//model.setStdOutExtension('txt'); //stdout faili laiend //model.setStdOutExtension('txt'); //stdout faili laiend
//model.setFileValue(key, value); //model.setFileValue(key, value);
......
...@@ -50,7 +50,7 @@ function InputOutputLocalCommand(){ ...@@ -50,7 +50,7 @@ function InputOutputLocalCommand(){
model.serviceProperties.commandTemplate = config.wrapper.command.commandTemplate; model.serviceProperties.commandTemplate = config.wrapper.command.commandTemplate;
model.init( session ); model.init( session );
model.setKeyValue('data', session.getFile('content')); model.setKeyValue('data', session.getRequestFile('content'));
model.addOutputPath('output', {extension: 'txt'}); model.addOutputPath('output', {extension: 'txt'});
model.render(function (err) { model.render(function (err) {
logger.debug('Render callback'); logger.debug('Render callback');
......
...@@ -50,7 +50,7 @@ function SimpleLocalCommand(){ ...@@ -50,7 +50,7 @@ function SimpleLocalCommand(){
var model = new CommandModel(); var model = new CommandModel();
model.serviceProperties.commandTemplate = config.wrapper.command.commandTemplate; model.serviceProperties.commandTemplate = config.wrapper.command.commandTemplate;
model.init( session ); model.init( session );
model.setKeyValue('data', session.getFiles('content')); model.setKeyValue('data', session.getRequestFiles('content'));
model.render(function (err) { model.render(function (err) {
logger.debug('Render callback'); logger.debug('Render callback');
callback(err, model); callback(err, model);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment