Skip to content

Commit

Permalink
Remove old worker functions from bin/deepforge. Fixes #1616 (#1617)
Browse files Browse the repository at this point in the history
  • Loading branch information
brollb authored Apr 9, 2020
1 parent 6387b96 commit b4a116c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 41 deletions.
45 changes: 5 additions & 40 deletions bin/deepforge
Original file line number Diff line number Diff line change
Expand Up @@ -192,40 +192,6 @@ var startMongo = function (args, port, silent) {
});
};

const startLocal = function(serverCommand) {
let stdout, workerJob=null;
const env = {cwd: path.join(__dirname, '..'), NODE_ENV: process.env.NODE_ENV, PATH: process.env.PATH};
// Set the cache to the blob
if (gmeConfig.blob.type === 'FS') {
process.env.DEEPFORGE_WORKER_CACHE = path.resolve(gmeConfig.blob.fsDir + '/wg-content');
}

// process.env.NODE_ENV = 'local';
const execJob = rawSpawn(serverCommand, [
path.join(__dirname, '..', 'app.js')
], {
env: env,
shell: SHELL
});

execJob.stdout.pipe(process.stdout);
execJob.stderr.pipe(process.stderr);

execJob.stdout.on('data', function(chunk) {
if (!workerJob) {
stdout += chunk;
if (stdout.indexOf('DeepForge') > -1) {
workerJob = rawSpawn('npm', ['run', 'worker'], env);
workerJob.stdout.pipe(process.stdout);
workerJob.stderr.pipe(process.stderr);
workerJob.on('close', code => code && process.exit(code));
}
}
});

execJob.on('close', code => code && process.exit(code));
};

var spawn = function (cmd, args, opts) {
var deferred = Q.defer(),
job,
Expand Down Expand Up @@ -278,6 +244,11 @@ program.command('start')
.option('-m, --mongo', 'start MongoDB')
.action(async args => {
const serverCommand = getDeepForgeServerCommand(args.conda);
const startAll = !args.server && !args.mongo;
if (startAll) {
args.server = true;
args.mongo = true;
}

if (args.port) {
process.env.PORT = args.port;
Expand All @@ -294,12 +265,6 @@ program.command('start')
shell: SHELL
});
}

const startAll = !args.server && !args.mongo;
if (startAll) {
await checkMongo(args);
startLocal(serverCommand);
}
});

// update
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"start-authenticated": "NODE_ENV=production ./bin/deepforge start",
"server": "node ./bin/deepforge start --server",
"no-conda-server": "node ./bin/deepforge start --server --no-conda",
"worker": "node ./bin/start-worker.js",
"test": "npm run test-unit && npm run test-int",
"test-unit": "NODE_ENV=test mkdir ./test-tmp; mocha --recursive test/unit",
"test-int": "NODE_ENV=test mkdir ./test-tmp; mocha --recursive test/integration",
Expand Down

0 comments on commit b4a116c

Please sign in to comment.