Skip to content

Commit 5321d7a

Browse files
committed
Merge branch 'develop' into feature/plugins
2 parents d9a1631 + 7e0c10a commit 5321d7a

File tree

11 files changed

+376
-33
lines changed

11 files changed

+376
-33
lines changed

bin/hflow

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
#!/usr/bin/env node
2+
3+
var redisURL = process.env.REDIS_URL ? {url: process.env.REDIS_URL} : {};
4+
5+
26
var docopt = require('docopt').docopt,
37
spawn = require('child_process').spawn,
48
fs = require('fs'),
59
pathtool = require('path'),
610
redis = require('redis'),
7-
rcl = redis.createClient(),
11+
rcl = redis.createClient(redisURL),
812
wflib = require('../wflib').init(rcl),
913
Engine = require('../engine2'),
1014
async = require('async'),
@@ -92,11 +96,11 @@ function hflow_run() {
9296

9397
var createWf = function(cb) {
9498
rcl.select(dbId, function(err, rep) {
95-
rcl.flushdb(function(err, rep) {
99+
//rcl.flushdb(function(err, rep) { // flushing db here deletes the global 'hfid' entry (created earlier)
96100
wflib.createInstanceFromFile(wffile, '', function(err, id) {
97101
cb(err, id);
98102
});
99-
});
103+
//});
100104
});
101105
}
102106

engine2/process.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,10 @@ var ProcLogic = function() {
306306
}
307307
}
308308

309-
proc.wflib.invokeTaskFunction2(
309+
proc.wflib.invokeProcFunction(
310310
proc.appId,
311311
proc.procId,
312+
proc.firingId,
312313
funcIns,
313314
proc.sigValues,
314315
funcOuts, emul,

examples/MolecularDynamicsParameterStudy/make-movie.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ if [ -n "$2" ]; then
1717
MOVIE=$2
1818
fi
1919

20+
BASEDIR=$(dirname $BASH_SOURCE)
21+
cp -vf $BASEDIR/pov-template.inc pov-template.inc
22+
2023
DIR=$(mktemp -d --tmpdir=.)
2124

2225

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"processes": [
3+
{
4+
"name": "run-cmd-openmp-0.5",
5+
"function": "amqpCommand",
6+
"type": "dataflow",
7+
"config": {
8+
"executor": {
9+
"executable": "/home/ubuntu/MD_v4_OMP/run-cmd-openmp.sh",
10+
"args": [
11+
1000,
12+
0.5,
13+
0.5
14+
]
15+
}
16+
},
17+
"ins": [
18+
"start"
19+
],
20+
"outs": [
21+
"psp-output-0.5.tgz"
22+
]
23+
},
24+
{
25+
"name": "run-cmd-openmp-0.6",
26+
"function": "amqpCommand",
27+
"type": "dataflow",
28+
"config": {
29+
"executor": {
30+
"executable": "/home/ubuntu/MD_v4_OMP/run-cmd-openmp.sh",
31+
"args": [
32+
1000,
33+
0.5,
34+
0.6
35+
]
36+
}
37+
},
38+
"ins": [
39+
"start"
40+
],
41+
"outs": [
42+
"psp-output-0.6.tgz"
43+
]
44+
},
45+
{
46+
"name": "make-movie-0.5",
47+
"function": "amqpCommand",
48+
"type": "dataflow",
49+
"config": {
50+
"executor": {
51+
"executable": "/home/ubuntu/MD_v4_OMP/make-movie.sh",
52+
"args": [
53+
"psp-output-0.5.tgz",
54+
"psp-output-0.5.avi"
55+
]
56+
}
57+
},
58+
"ins": [
59+
"psp-output-0.5.tgz"
60+
],
61+
"outs": [
62+
"psp-output-0.5.avi"
63+
]
64+
},
65+
{
66+
"name": "make-movie-0.6",
67+
"function": "amqpCommand",
68+
"type": "dataflow",
69+
"config": {
70+
"executor": {
71+
"executable": "/home/ubuntu/MD_v4_OMP/make-movie.sh",
72+
"args": [
73+
"psp-output-0.6.tgz",
74+
"psp-output-0.6.avi"
75+
]
76+
}
77+
},
78+
"ins": [
79+
"psp-output-0.6.tgz"
80+
],
81+
"outs": [
82+
"psp-output-0.6.avi"
83+
]
84+
}
85+
],
86+
"signals": [
87+
{
88+
"name": "start",
89+
"data": [
90+
"start"
91+
]
92+
},
93+
{
94+
"name": "psp-output-0.5.tgz"
95+
},
96+
{
97+
"name": "psp-output-0.5.avi"
98+
},
99+
{
100+
"name": "psp-output-0.6.tgz"
101+
},
102+
{
103+
"name": "psp-output-0.6.avi"
104+
}
105+
],
106+
"ins": [
107+
"start"
108+
],
109+
"outs": [
110+
"psp-output-0.5.avi",
111+
"psp-output-0.6.avi"
112+
]
113+
}

examples/MolecularDynamicsParameterStudy/run-cmd-openmp.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
# Copyright 2013 University of Stuttgart, Germany
33
# Author: Anthony Sulistio (HLRS)
44
# Modified by Maciej Malawski (AGH)
@@ -10,11 +10,15 @@
1010
# ./run.sh 1000 2 0.8
1111

1212

13+
BASEDIR=$(dirname $BASH_SOURCE)
14+
15+
1316
MYDIR=$(mktemp -d --tmpdir=.)
1417

15-
cp -vf pov-template.inc $MYDIR/psp-header.inc
18+
cp -vf $BASEDIR/pov-template.inc $MYDIR/psp-header.inc
19+
20+
cp $BASEDIR/src/main $MYDIR
1621

17-
cp src/main $MYDIR
1822

1923
cd $MYDIR
2024
rm -f *.pov *.dat *.xyz
@@ -57,4 +61,4 @@ OUTPUT_FILE=psp-output-$TEMPERATURE.tgz
5761

5862
tar zcvf $OUTPUT_FILE psp-*
5963

60-
mv $OUTPUT_FILE ..
64+
mv $OUTPUT_FILE ..

functions/amqpCommand.js

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ function connect() {
1515

1616
connection.then(function(conn) {
1717
console.log("[AMQP] Connected!");
18+
19+
return when(conn.createChannel().then(function(ch) {
20+
var ok = ch.assertQueue('hyperflow.jobs', {durable: true}).then(function(qok) { return qok.queue; });
21+
}));
1822
}, function(err) {
1923
console.error('[AMQP] Connect failed: %s', err);
2024
})
@@ -23,17 +27,27 @@ var taskCount = 0;
2327

2428
function amqpCommand(ins, outs, config, cb) {
2529
if(!connection) connect();
26-
30+
2731
connection.then(function(connection) {
2832
return when(connection.createChannel().then(function(ch) {
33+
var options = executor_config.options;
34+
if(config.executor.hasOwnProperty('options')) {
35+
var executorOptions = config.executor.options;
36+
for (var opt in executorOptions) {
37+
if(executorOptions.hasOwnProperty(opt)) {
38+
options[opt] = executorOptions[opt];
39+
}
40+
}
41+
}
2942
var jobMessage = {
3043
"executable": config.executor.executable,
31-
"args": config.executor.args,
32-
"inputs": ins.map(identity),
33-
"outputs": outs.map(identity),
34-
"options": executor_config.options
44+
"args": config.executor.args,
45+
"env": (config.executor.env || {}),
46+
"inputs": ins.map(identity),
47+
"outputs": outs.map(identity),
48+
"options": options
3549
};
36-
50+
3751
var answer = defer();
3852
var corrId = uuid.v4();
3953
function maybeAnswer(msg) {
@@ -55,7 +69,7 @@ function amqpCommand(ins, outs, config, cb) {
5569
// console.log("[AMQP][" + corrId + "][" + taskCount + "] Publishing job " + JSON.stringify(jobMessage));
5670
ch.sendToQueue('hyperflow.jobs', new Buffer(JSON.stringify(jobMessage)), {replyTo: queue, contentType: 'application/json', correlationId: corrId});
5771
return answer.promise;
58-
});
72+
});
5973

6074
return ok.then(function(message) {
6175
var parsed = JSON.parse(message);
@@ -71,7 +85,7 @@ function amqpCommand(ins, outs, config, cb) {
7185
});
7286
}))
7387
}).then(null, function(err) { console.trace(err.stack); });
74-
}
88+
}
7589

7690

7791
exports.amqpCommand = amqpCommand;

functions/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ function print2(ins, outs, config, cb) {
2626
console.log(input.data);
2727
}
2828
});
29+
console.log("CONFIG");
30+
console.log(config);
2931
cb(null, outs);
3032
}
3133

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
},
1111
"dependencies": {
1212
"express": "3.x",
13-
"consolidate": "0.9.1",
13+
"consolidate": "0.10.x",
1414
"cradle": "0.6.6",
1515
"ejs": "0.8.4",
1616
"eyes": "0.1.8",
1717
"async": "0.2.x",
18-
"redis": "0.9.1",
18+
"redis": "2.4.2",
1919
"xml2js": "0.2.7",
2020
"underscore": "1.x",
2121
"uuid": "",

0 commit comments

Comments
 (0)