Skip to content

Commit 12f7ad1

Browse files
committed
Add logging of node name
1 parent 44f2fdf commit 12f7ad1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

functions/redisCommand.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
var spawn = require('child_process').spawn;
55
var log4js = require('log4js');
66
var createJobMessage = require('../common/jobMessage.js').createJobMessage;
7+
var os = require('os');
78

89
// limit of parallel jobs
910
const MAX_PARALLELISM = process.env.HF_VAR_REDIS_CMD_MAX_PARALLELISM || 10;
@@ -13,6 +14,9 @@ const WAIT_TIME_MS = process.env.HF_VAR_REDIS_CMD_WAIT_TIME_MS || 2000;
1314
// number of jobs currently running
1415
var numParallelJobs = 0;
1516

17+
// set host name to be logged by the executor
18+
process.env.HF_LOG_NODE_NAME = os.hostname();
19+
1620
function sleep(ms) {
1721
return new Promise(resolve => setTimeout(resolve, ms));
1822
}
@@ -50,6 +54,7 @@ async function redisCommand(ins, outs, context, cb) {
5054
if (input_dir) cmd += ' -v ' + input_dir + ':/input_dir ';
5155
if (work_dir) cmd += ' -v ' + work_dir + ':/work_dir ';
5256
if (output_dir) cmd += ' -v ' + output_dir + ':/output_dir ';
57+
cmd += ' -e HF_LOG_NODE_NAME="' + os.hostname() + '"';
5358
cmd += context.container + ' hflow-job-execute';
5459
} else cmd = 'hflow-job-execute'
5560

0 commit comments

Comments
 (0)