dcp-worker 3.2.26 → 3.2.28-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/.gitlab-ci.yml CHANGED
@@ -27,4 +27,5 @@ tidelift:
27
27
  - chmod +x tidelift
28
28
  - echo "Running alignment and saving to Tidelift"
29
29
  - ./tidelift alignment save --wait
30
+ allow_failure: true
30
31
  cache: []
@@ -254,26 +254,34 @@ function main() {
254
254
  console.log('. cwd:', path.join(options.prefix));
255
255
  console.log('. run:', [evaluator].concat(files).concat(args).map(a => `"${a}"`).join(' '));
256
256
  }
257
- const ran = require('child_process').spawnSync(evaluator, files.concat(args), {
257
+
258
+ const child = require('child_process').spawn(evaluator, files.concat(args), {
258
259
  cwd: path.join(options.prefix),
259
260
  windowsHide: true,
260
- stdio: ['inherit', 'inherit', 'inherit']
261
+ stdio: ['inherit', 'inherit', 'inherit'],
261
262
  });
262
263
 
263
- if (ran.signal && !options.stdio)
264
- console.log(`Evaluator server caught signal ${ran.signal}`);
265
- if (ran.error) {
266
- delete ran.error.stack;
267
- console.error(ran.error);
268
- }
264
+ process.exitCode = 1;
265
+ child.on('error', (error) => {
266
+ delete error.stack;
267
+ console.error(error);
268
+ child.unref();
269
+ });
269
270
 
270
- if (!ran.signal && !ran.error) {
271
+ child.on('close', (code, signal) => {
271
272
  if (!options.stdio)
272
- console.log('Evaluator server process exited, status', ran.status);
273
- process.exit(ran.status);
274
- }
273
+ {
274
+ if (signal)
275
+ console.log(`Evaluator server caught signal ${signal}`);
276
+ else
277
+ console.log('Evaluator server process exited, status', code);
278
+ }
275
279
 
276
- process.exit(1);
280
+ process.exit(code);
281
+ });
282
+
283
+ process.on('SIGINT', () => process.kill(child.pid, 'SIGINT'));
284
+ process.on('SIGTERM', () => process.kill(child.pid, 'SIGTERM'));
277
285
  }
278
286
 
279
287
  /* Initialize dcp-client to use only local resources before launching the main function */
package/bin/dcp-worker CHANGED
@@ -110,13 +110,14 @@ function parseCliArgs()
110
110
 
111
111
  leavePublicGroup: {
112
112
  type: 'boolean',
113
- describe: 'Do not fetch slices from public compute group',
113
+ describe: 'Do not fetch slices from public compute group. Ignored if --publicGroupFallback is set',
114
114
  default: false,
115
115
  },
116
116
  publicGroupFallback: {
117
117
  describe: 'If set, worker will prefer private groups but fall back on the public group if no preferred work is available',
118
118
  type: 'boolean',
119
- default: false,
119
+ default: 'false',
120
+ defaultDescription: false,
120
121
  },
121
122
 
122
123
  identityKey: {
@@ -231,8 +232,6 @@ async function main()
231
232
  port: cliArgs.port
232
233
  };
233
234
 
234
- verifyDefaultConfigIntegrity();
235
-
236
235
  process.on('SIGINT', handleSigDeath);
237
236
  process.on('SIGTERM', handleSigDeath);
238
237
  process.on('SIGQUIT', handleSigDeath);
@@ -314,8 +313,8 @@ async function main()
314
313
  dcpWorkerOptions.watchdogInterval = cliArgs.watchdogInterval;
315
314
 
316
315
  worker = new DCPWorker(identityKeystore, dcpWorkerOptions);
317
- worker.on('error', console.error);
318
- worker.on('warning', console.warn);
316
+ worker.on('error', (...payload) => console.error(...payload));
317
+ worker.on('warning', (...payload) => console.warn(...payload));
319
318
 
320
319
  /* Let incorrect event-loop references keep us alive when linked with a debug library, but
321
320
  * exit quickly/accurately for production code even when the library isn't perfect.
@@ -336,6 +335,10 @@ async function main()
336
335
  startWorkerLogger(worker, cliArgs);
337
336
 
338
337
  require('../lib/remote-console').setMainEval(function mainEval() { return eval(arguments[0]) });
338
+ require('../lib/remote-console').reintercept();
339
+
340
+ // Only after intercepting console for remote and for event-log
341
+ verifyDefaultConfigIntegrity();
339
342
 
340
343
  // Activate public group fallback
341
344
  // If requested by CLI
@@ -381,7 +384,7 @@ async function main()
381
384
  return plural;
382
385
  }
383
386
 
384
- if (dcpWorkerOptions.jobAddresses)
387
+ if (dcpWorkerOptions.jobAddresses.length)
385
388
  introBanner += ` * Processing only ${qty(dcpWorkerOptions.jobAddresses, 'job')} ` + dcpWorkerOptions.jobAddresses.join(', ') + '\n';
386
389
  if (dcpWorkerOptions.computeGroups.length)
387
390
  introBanner += ` * Joining compute ${qty(dcpWorkerOptions.computeGroups, 'group')} ` + dcpWorkerOptions.computeGroups.map(el => el.joinKey).join(', ') + '\n';
@@ -630,7 +633,7 @@ function verifyDefaultConfigIntegrity()
630
633
  {
631
634
  const originalMd5sum = fs.readFileSync(md5sumPath, 'ascii');
632
635
  const actualMd5sum = crypto.createHash('md5')
633
- .update(fs.readFileSync(workerConfPath, 'ascii'))
636
+ .update(fs.readFileSync(workerConfPath))
634
637
  .digest('hex');
635
638
 
636
639
  if (!originalMd5sum.startsWith(actualMd5sum))
@@ -644,6 +647,11 @@ function verifyDefaultConfigIntegrity()
644
647
  console.warn(' - /etc/override/dcp/dcp-worker/dcp-config.js');
645
648
  console.warn(' - the Windows Registry');
646
649
 
650
+ // md5 calculation is incorrect on Windows. Possibly git/npm mangling line-endings?
651
+ const os = requireNative('os');
652
+ if (os?.platform() === 'win32')
653
+ return;
654
+
647
655
  if (require('dcp/build').config.build !== 'debug')
648
656
  process.exit(1);
649
657
 
@@ -1,2 +1,2 @@
1
- ee17a8c00be52fbefd8c642d312317e7 etc/dcp-worker-config.js
1
+ db140f1050d7506373319cc282e3c76d etc/dcp-worker-config.js
2
2
  ### DO NOT MODIFY THIS FILE!!! ###
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dcp-worker",
3
- "version": "3.2.26",
3
+ "version": "3.2.28-0",
4
4
  "description": "JavaScript portion of DCP Workers for Node.js",
5
5
  "main": "bin/dcp-worker",
6
6
  "keywords": [
@@ -12,9 +12,10 @@
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "git@github.com:Distributed-Compute-Labs/dcp-worker.git"
15
+ "url": "git+ssh://git@gitlab.com/Distributed-Compute-Protocol/dcp-worker.git"
16
16
  },
17
17
  "license": "MIT",
18
+ "author": "Kings Distributed Systems",
18
19
  "engines": {
19
20
  "node": ">=14.0.0"
20
21
  },
@@ -38,7 +39,7 @@
38
39
  "blessed": "^0.1.81",
39
40
  "blessed-contrib": "^4.11.0",
40
41
  "chalk": "^4.1.0",
41
- "dcp-client": "^4.2.28",
42
+ "dcp-client": "^4.2.30",
42
43
  "semver": "^7.3.8"
43
44
  },
44
45
  "optionalDependencies": {