dcp-worker 4.4.3 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/dcp-evaluator-start +9 -8
- package/bin/dcp-worker +6 -4
- package/lib/web-iface.js +1 -1
- package/package.json +2 -2
package/bin/dcp-evaluator-start
CHANGED
|
@@ -19,11 +19,12 @@ const path = require('path');
|
|
|
19
19
|
|
|
20
20
|
const { logLevels } = require('../lib/consts');
|
|
21
21
|
|
|
22
|
-
async function processExit(code)
|
|
22
|
+
async function processExit(code, silent=true)
|
|
23
23
|
{
|
|
24
24
|
if (typeof code === 'undefined')
|
|
25
25
|
code = process.exitCode;
|
|
26
|
-
|
|
26
|
+
if (!silent)
|
|
27
|
+
console.debug('Exit, code', code);
|
|
27
28
|
await loggers.unhook();
|
|
28
29
|
process.exit(code);
|
|
29
30
|
}
|
|
@@ -35,7 +36,7 @@ function panic(...argv)
|
|
|
35
36
|
processExit(1);
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
function main()
|
|
39
|
+
async function main()
|
|
39
40
|
{
|
|
40
41
|
const dcpConfig = require('dcp/dcp-config');
|
|
41
42
|
const loggingOptions = {
|
|
@@ -117,11 +118,11 @@ Options:
|
|
|
117
118
|
switch (option)
|
|
118
119
|
{
|
|
119
120
|
case '?':
|
|
120
|
-
processExit(1);
|
|
121
|
+
await processExit(1, false);
|
|
121
122
|
break;
|
|
122
123
|
case 'h':
|
|
123
124
|
help();
|
|
124
|
-
processExit(0);
|
|
125
|
+
await processExit(0, false);
|
|
125
126
|
break;
|
|
126
127
|
case 'P':
|
|
127
128
|
options.prefix = optarg;
|
|
@@ -158,7 +159,7 @@ Options:
|
|
|
158
159
|
{
|
|
159
160
|
const dump = Object.keys(require(options.sandboxDefinitions));
|
|
160
161
|
console.log(options.json ? JSON.stringify(dump) : dump);
|
|
161
|
-
processExit(0);
|
|
162
|
+
await processExit(0);
|
|
162
163
|
break;
|
|
163
164
|
}
|
|
164
165
|
case 'D':
|
|
@@ -288,7 +289,7 @@ Options:
|
|
|
288
289
|
console.log('Evaluator command:', [path.resolve(options.prefix, options.evaluator)].concat(files).concat(args).join(' '));
|
|
289
290
|
console.log('Options:', options);
|
|
290
291
|
}
|
|
291
|
-
processExit(0);
|
|
292
|
+
await processExit(0);
|
|
292
293
|
}
|
|
293
294
|
|
|
294
295
|
if (options.dumpFiles)
|
|
@@ -298,7 +299,7 @@ Options:
|
|
|
298
299
|
if (options.json)
|
|
299
300
|
dump = JSON.stringify(dump);
|
|
300
301
|
console.log(dump);
|
|
301
|
-
processExit(0);
|
|
302
|
+
await processExit(0);
|
|
302
303
|
}
|
|
303
304
|
|
|
304
305
|
if (!options.stdio && options.sandboxType === 'node') {
|
package/bin/dcp-worker
CHANGED
|
@@ -582,11 +582,12 @@ async function main()
|
|
|
582
582
|
worker.runInfo.type = 'dcp-worker';
|
|
583
583
|
worker.on('warning', (...payload) => console.warn (...payload));
|
|
584
584
|
worker.on('claim', amount => console.log(` . transfered ${amount} ⊇ to ${worker.config.paymentAddress}`));
|
|
585
|
-
|
|
585
|
+
worker.on('stop', () => workerIsStopping = true );
|
|
586
586
|
await processCliOptsPhase2(remainArgv, operatingMode, loggingOptions);
|
|
587
587
|
|
|
588
588
|
if (operatingMode.show)
|
|
589
589
|
{
|
|
590
|
+
await worker.configure();
|
|
590
591
|
const output = await require('../lib/show').show(worker, operatingMode.show);
|
|
591
592
|
if (operatingMode.showSerializer)
|
|
592
593
|
console.log(operatingMode.showSerializer.stringify(output, null, 2));
|
|
@@ -781,10 +782,11 @@ async function main()
|
|
|
781
782
|
console.info(` ! not claming earnings in the amount of ${amount} ⊇ (can claim later)`);
|
|
782
783
|
}
|
|
783
784
|
|
|
784
|
-
worker.on('stop',
|
|
785
|
-
worker.on('end',
|
|
785
|
+
worker.on('stop', () => { console.log(' - Worker is stopping') });
|
|
786
|
+
worker.on('end', () => { console.log(' * Worker has stopped') });
|
|
786
787
|
worker.on('job', job => console.log(` . Job: ${job.name} ${job.id.slice(0,8)} ${job.description || ''} ${job.link || ''}`));
|
|
787
|
-
console.info(' * Ready.\n');
|
|
788
|
+
worker.on('start', () => console.info(' * Ready.\n'));
|
|
789
|
+
|
|
788
790
|
await worker.start();
|
|
789
791
|
} /* main() */
|
|
790
792
|
|
package/lib/web-iface.js
CHANGED
|
@@ -353,7 +353,7 @@ async function workerRegisterPostHandler(query, req, res)
|
|
|
353
353
|
{
|
|
354
354
|
var failExpn;
|
|
355
355
|
const utils = require('./utils');
|
|
356
|
-
const reg = await utils.registerWorker(worker, query.rkey, msg => failExpn = msg);
|
|
356
|
+
const reg = await utils.registerWorker(worker, query.rkey, undefined /* no label */, msg => failExpn = msg);
|
|
357
357
|
reg.failExpn = failExpn;
|
|
358
358
|
reg.pid = process.pid;
|
|
359
359
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dcp-worker",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "Node.js Worker for Distributive Compute Platform",
|
|
5
5
|
"main": "bin/dcp-worker",
|
|
6
6
|
"keywords": [
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"blessed": "0.1.81",
|
|
40
40
|
"blessed-contrib": "4.11.0",
|
|
41
41
|
"chalk": "4.1.2",
|
|
42
|
-
"dcp-client": "^5.
|
|
42
|
+
"dcp-client": "^5.7.0",
|
|
43
43
|
"kvin": "^9.0.0",
|
|
44
44
|
"posix-getopt": "1.2.1",
|
|
45
45
|
"semver": "7.7.3",
|