Commit f761b366 authored by priit's avatar priit

Dockeri alge

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