dcp-worker 3.2.28-1 → 3.2.28

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
@@ -1,31 +1,31 @@
1
1
  # @file .gitlab-ci.yml - GitLab CI configuration file.
2
- # @author Bryan Hoang <bryan@distributive.network>
2
+ # @author Eddie Roosenmallen <eddie@distributive.network>
3
3
  # @date September 2022
4
4
 
5
- # Note: The CLI requires `glibc`.
6
- image: node:14
7
-
8
- stages:
9
- - build
10
-
11
- # Use in-house GitLab runners.
12
5
  default:
6
+ # Use in-house GitLab runners.
13
7
  tags:
14
8
  - dcp
15
9
  - linux
16
10
 
11
+ stages:
12
+ - build
13
+
17
14
  tidelift:
18
15
  stage: build
19
16
  variables:
20
17
  # This should be kept in a GitLab Variable. Read more:
21
18
  # https://docs.gitlab.com/ee/ci/variables/#create-a-custom-variable-in-the-ui
22
19
  TIDELIFT_API_KEY: $TIDELIFT_API_KEY
23
- script:
20
+ # The CLI only requires `glibc`.
21
+ image: frolvlad/alpine-glibc
22
+ before_script:
23
+ - apk add --no-cache curl
24
24
  - echo "Downloading Tidelift CLI"
25
25
  - curl https://download.tidelift.com/cli/tidelift -o tidelift
26
26
  - echo "Setting permissions"
27
27
  - chmod +x tidelift
28
+ script:
28
29
  - echo "Running alignment and saving to Tidelift"
29
30
  - ./tidelift alignment save --wait
30
- allow_failure: true
31
31
  cache: []
package/bin/dcp-worker CHANGED
@@ -9,14 +9,19 @@
9
9
  'use strict';
10
10
 
11
11
  const process = require('process');
12
- const os = require('os');
13
12
  const fs = require('fs');
14
13
  const crypto = require('crypto');
15
14
  const chalk = require('chalk');
16
15
 
17
16
  const configName = process.env.DCP_CONFIG || '../etc/dcp-worker-config';
18
- const TOTAL_CPU_VCORES = os.cpus().length;
19
- var worker, dcpConfig;
17
+ var worker, dcpConfig, debugging;
18
+
19
+ const debug = (...args) => {
20
+ if (!debugging)
21
+ debugging = require('dcp/internal/debugging').scope('dcp-worker');
22
+ if (debugging())
23
+ console.debug('dcp-worker:', ...args);
24
+ };
20
25
 
21
26
  const EXIT_UNHANDLED = 5;
22
27
 
@@ -55,9 +60,14 @@ function parseCliArgs()
55
60
  },
56
61
  cores: {
57
62
  alias: 'c',
58
- describe: 'Number of cores to work with',
59
- type: 'number',
60
- default: TOTAL_CPU_VCORES - 1,
63
+ describe: 'Number of CPU and GPU cores to work with: the format is 7,1 (or just 7) for 7 CPU cores and 1 GPU',
64
+ type: 'string',
65
+ },
66
+ density: {
67
+ alias: 'd',
68
+ describe: 'default proportion of CPU,GPU to use when cores not specified',
69
+ type: 'string',
70
+ default: JSON.stringify(dcpConfig.worker.defaultCoreDensity),
61
71
  },
62
72
  verbose: {
63
73
  alias: 'v',
@@ -232,6 +242,8 @@ async function main()
232
242
  port: cliArgs.port
233
243
  };
234
244
 
245
+ verifyDefaultConfigIntegrity();
246
+
235
247
  process.on('SIGINT', handleSigDeath);
236
248
  process.on('SIGTERM', handleSigDeath);
237
249
  process.on('SIGQUIT', handleSigDeath);
@@ -271,7 +283,6 @@ async function main()
271
283
  const forceOptions = {
272
284
  paymentAddress,
273
285
  leavePublicGroup: cliArgs.leavePublicGroup || dcpConfig.worker.leavePublicGroup || cliArgs.publicGroupFallback || false,
274
- maxWorkingSandboxes: cliArgs.cores,
275
286
  };
276
287
  const defaultOptions = {
277
288
  sandboxOptions: {
@@ -280,6 +291,7 @@ async function main()
280
291
  };
281
292
 
282
293
  addConfig(dcpWorkerOptions, defaultOptions, dcpConfig.worker, forceOptions);
294
+ processCoresAndDensity(dcpWorkerOptions, cliArgs);
283
295
 
284
296
  /* cliArgs.join is the list of compute groups to join */
285
297
  if (cliArgs.join && cliArgs.join.length)
@@ -325,20 +337,13 @@ async function main()
325
337
  worker.on('end', () => setTimeout(process.exit, getCleanupTimeoutMs()).unref());
326
338
 
327
339
  if (cliArgs.eventDebug)
328
- {
329
- worker.debug = true;
330
- worker.supervisor.debug = true;
331
- }
340
+ worker.enableDebugEvents = true;
332
341
 
333
342
  worker.on('stop', () => { console.log('Worker is stopping') });
334
343
  worker.on('end', () => { logClosing('log', 'Worker has stopped') });
335
344
  startWorkerLogger(worker, cliArgs);
336
345
 
337
346
  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();
342
347
 
343
348
  // Activate public group fallback
344
349
  // If requested by CLI
@@ -365,11 +370,11 @@ async function main()
365
370
  }
366
371
 
367
372
  let introBanner = '';
368
- introBanner += ` * Starting DCP Worker` + '\n';
373
+ introBanner += ` * Starting DCP Worker ${worker.workerId}` + '\n';
369
374
  introBanner += ` . Configured for scheduler ${dcpConfig.scheduler.location}` + '\n';
370
375
  introBanner += ` . Bank is ${dcpConfig.bank.location}` + '\n';
371
- introBanner += ` . Earned funds will be deposited in account ${paymentAddress}` + '\n';
372
- introBanner += ` . Identity is ${identityKeystore.address}` + '\n';
376
+ introBanner += ` . Earned funds will be deposited in account ${worker.paymentAddress}` + '\n';
377
+ introBanner += ` . Identity is ${worker.identityKeystore.address}` + '\n';
373
378
 
374
379
  function qty(amount, singular, plural) /* XXX i18n */
375
380
  {
@@ -384,21 +389,26 @@ async function main()
384
389
  return plural;
385
390
  }
386
391
 
387
- if (dcpWorkerOptions.jobAddresses.length)
392
+ if (dcpWorkerOptions.jobAddresses?.length > 0)
388
393
  introBanner += ` * Processing only ${qty(dcpWorkerOptions.jobAddresses, 'job')} ` + dcpWorkerOptions.jobAddresses.join(', ') + '\n';
389
- if (dcpWorkerOptions.computeGroups.length)
390
- introBanner += ` * Joining compute ${qty(dcpWorkerOptions.computeGroups, 'group')} ` + dcpWorkerOptions.computeGroups.map(el => el.joinKey).join(', ') + '\n';
394
+ if (dcpWorkerOptions.computeGroups?.length > 0)
395
+ introBanner += ` . Joining compute ${qty(dcpWorkerOptions.computeGroups, 'group')} ` + dcpWorkerOptions.computeGroups.map(el => el.joinKey).join(', ') + '\n';
391
396
  if (dcpWorkerOptions.publicGroupFallback)
392
- introBanner += ' * Falling back on public group when preferred groups have no work' + '\n';
397
+ introBanner += ' . Falling back on public group when preferred groups have no work' + '\n';
393
398
  else if (dcpWorkerOptions.leavePublicGroup)
394
- introBanner += ' * Leaving the public compute group' + '\n';
399
+ introBanner += ' . Leaving the public compute group' + '\n';
400
+ if (dcpWorkerOptions.cores)
401
+ introBanner += ` . Target cores: ${JSON.stringify(dcpWorkerOptions.cores)}\n`;
402
+ else
403
+ introBanner += ` . Target core density: ${JSON.stringify(dcpWorkerOptions.defaultCoreDensity)}\n`;
395
404
  if (cliArgs.verbose)
396
405
  introBanner += ` + Verbosity level: ${cliArgs.verbose}` + '\n';
397
406
  if (cliArgs.eventDebug)
398
407
  introBanner += ' + Event debug on' + '\n';
399
- introBanner += ' . output mode: ' + cliArgs.outputMode + '\n';
400
-
401
- introBanner += ' . ready' + '\n';
408
+
409
+ introBanner += ' . Supervisor version: ' + worker.supervisorVersion;
410
+ introBanner += ' . Output mode: ' + cliArgs.outputMode + '\n';
411
+ introBanner += ' * Ready' + '\n';
402
412
 
403
413
  console.log(introBanner);
404
414
  require('../lib/check-scheduler-version').check();
@@ -415,6 +425,43 @@ async function main()
415
425
  await worker.start();
416
426
  }
417
427
 
428
+ /**
429
+ * Process the cores and density cli arguments.
430
+ *
431
+ * cliArgs.cores is the core count of the hardware to use.
432
+ * It can be specified with only the cpu or gpu component, or both.
433
+ *
434
+ * E.g. -c 2,1 => cores = { cpu: 2, gpu: 1 }
435
+ * -c 10 => cores = { cpu: 10, gpu: <default> }
436
+ * -c ,10 => cores = { cpu: <default>, gpu: 10 }
437
+ */
438
+ function processCoresAndDensity (dcpWorkerOptions, cliArgs)
439
+ {
440
+ const DCPWorker = require('dcp/worker').Worker;
441
+ const defaultTargets = {
442
+ density: dcpWorkerOptions.defaultCoreDensity || { cpu: 0, gpu: 0 }, /* 0,0 => user specified corrupt conf */
443
+ cores: DCPWorker.defaultCores(dcpWorkerOptions),
444
+ };
445
+
446
+ const parseArg = (which) => {
447
+ if (!cliArgs[which])
448
+ return false;
449
+
450
+ const [cpu, gpu] = cliArgs[which].split(',');
451
+ dcpWorkerOptions[which] = { cpu: Number(cpu || defaultTargets[which].cpu),
452
+ gpu: Number(gpu || defaultTargets[which].gpu) };
453
+ return true;
454
+ };
455
+
456
+ parseArg('density');
457
+ parseArg('cores');
458
+
459
+ if (dcpWorkerOptions.cores)
460
+ debug('cores = ', dcpWorkerOptions.cores);
461
+ else
462
+ debug('core density = ', dcpWorkerOptions.defaultCoreDensity);
463
+ }
464
+
418
465
  /**
419
466
  * Log a closing message (or messages). Since the dashboard clears the screen on exit, we use the
420
467
  * memoized console property to log the message after we destroy the instance of screen.
@@ -436,7 +483,7 @@ function logClosing(facility, ...message)
436
483
  screen = false;
437
484
  console = new (require('console').Console)(process);
438
485
  require('../lib/remote-console').reintercept();
439
- console[facility](...message);
486
+ console[facility].call(null, ...message);
440
487
  }
441
488
  }
442
489
 
@@ -504,7 +551,6 @@ function toInterval(el)
504
551
  /** retrieve a slice report screen */
505
552
  function sliceReport()
506
553
  {
507
- const sup = worker.supervisor;
508
554
  let report = '';
509
555
 
510
556
  report += ('='.repeat(78)) + '\n';
@@ -521,7 +567,7 @@ function sliceReport()
521
567
  READY: 'Ready',
522
568
  TERMINATED: 'Terminated',
523
569
  };
524
- sup.sandboxes.forEach(sb => {
570
+ worker.sandboxes.forEach(sb => {
525
571
  const { state } = sb;
526
572
  if (!sbStates[state])
527
573
  sbStates[state] = 0;
@@ -534,10 +580,10 @@ function sliceReport()
534
580
  const stateName = stateNames[state] || state;
535
581
  report += (` ${(stateName + ':').padEnd(12)} ${sbStates[state]}`) + '\n';
536
582
  })
537
- report += (` * ALL: ${sup.sandboxes.length}`) + '\n';
583
+ report += (` * ALL: ${worker.sandboxes.length}`) + '\n';
538
584
 
539
585
  report += ('Progress:') + '\n';
540
- sup.workingSandboxes.forEach(sb => {
586
+ worker.workingSandboxes.forEach(sb => {
541
587
  const jobName = sb.job && sb.job.public && sb.job.public.name || `idek (${sb.jobAddress})`;
542
588
  let el = Date.now() - sb.sliceStartTime;
543
589
  const t = el < 1000000
@@ -556,8 +602,8 @@ function sliceReport()
556
602
  });
557
603
 
558
604
  report += ('Slices:') + '\n';
559
- report += (` working: ${sup.allocatedSlices.length}`) + '\n';
560
- report += (` queued: ${sup.queuedSlices.length}`) + '\n';
605
+ report += (` working: ${worker.workingSlices.length}`) + '\n';
606
+ report += (` queued: ${worker.queuedSlices.length}`) + '\n';
561
607
 
562
608
  report += ('='.repeat(78)) + '\n';
563
609
 
@@ -581,7 +627,7 @@ function handleSigDeath(signalName, signal)
581
627
  else
582
628
  {
583
629
  console.error(`trapped ${signalName}, signal ${signal} -- stopping worker`);
584
- worker.stop();
630
+ worker.stop(signalName === 'SIGQUIT');
585
631
  }
586
632
 
587
633
  setTimeout(() => process.exit(signal - 128), getCleanupTimeoutMs()).unref();
@@ -633,7 +679,7 @@ function verifyDefaultConfigIntegrity()
633
679
  {
634
680
  const originalMd5sum = fs.readFileSync(md5sumPath, 'ascii');
635
681
  const actualMd5sum = crypto.createHash('md5')
636
- .update(fs.readFileSync(workerConfPath))
682
+ .update(fs.readFileSync(workerConfPath, 'ascii'))
637
683
  .digest('hex');
638
684
 
639
685
  if (!originalMd5sum.startsWith(actualMd5sum))
@@ -647,10 +693,6 @@ function verifyDefaultConfigIntegrity()
647
693
  console.warn(' - /etc/override/dcp/dcp-worker/dcp-config.js');
648
694
  console.warn(' - the Windows Registry');
649
695
 
650
- // md5 calculation is incorrect on Windows. Possibly git/npm mangling line-endings?
651
- if (require('os').platform() === 'win32')
652
- return;
653
-
654
696
  if (require('dcp/build').config.build !== 'debug')
655
697
  process.exit(1);
656
698
 
@@ -20,6 +20,7 @@
20
20
  */
21
21
  {
22
22
  worker: {
23
+ defaultCoreDensity: { cpu: 0.9, gpu: 0.75 }, /* proportion of this machine's cores to use by default */
23
24
  trustComputeGroupOrigins: true, /* Trust the scheduler to modify allowOrigins via Compute Group configuration */
24
25
 
25
26
  /* Allow lists permitting supervisor network access beyond DCP messages to services */
@@ -1,2 +1,2 @@
1
- db140f1050d7506373319cc282e3c76d etc/dcp-worker-config.js
1
+ 8edf1c57bee521ed7f151a21b8f3f34d
2
2
  ### DO NOT MODIFY THIS FILE!!! ###
@@ -6,6 +6,7 @@
6
6
  * This blessed component produces labeled progress bars
7
7
  * to render the progress of worker sandboxes.
8
8
  */
9
+ 'use strict';
9
10
 
10
11
  const { Box, ProgressBar, Text } = require('blessed');
11
12
 
@@ -69,7 +70,7 @@ class Sandboxes extends Box {
69
70
  if (i < this.progressBars.length) {
70
71
  this.updateProgressBar(i, this.data[i]);
71
72
  } else {
72
- this.createProgressBar(progress);
73
+ this.createProgressBar();
73
74
  }
74
75
  }
75
76
 
@@ -79,7 +80,7 @@ class Sandboxes extends Box {
79
80
  }
80
81
  }
81
82
 
82
- this.setLabel(`${this.options.label} (${this.data.length}/${this.options.defaultProgressBars})`);
83
+ this.setLabel(`${this.options.label} (${this.data.length})`);
83
84
  }
84
85
  }
85
86
 
@@ -9,7 +9,7 @@
9
9
  * priviledges as the DCP Service Worker.
10
10
  *
11
11
  * To enable this feature, create a file in ../etc named enable-debug-console. That
12
- * file should contain a number which identities the port number this service will
12
+ * file should contain a number which identifies the port number this service will
13
13
  * listen on.
14
14
  *
15
15
  * The port file could also contain the string "false", which is just an explicit
@@ -46,6 +46,7 @@ function daemonEval()
46
46
  }
47
47
 
48
48
  function callbackTelnet(port, client, registry) {
49
+ client.unref();
49
50
  debugging() && console.debug(' ! telnetd - listening on port', port);
50
51
  }
51
52
 
@@ -75,7 +75,7 @@ Object.assign(exports, {
75
75
  for (const [ev, handler] of Object.entries(supervisorEvents))
76
76
  {
77
77
  if (typeof logger[handler] === 'function')
78
- worker.supervisor.on(ev, logger[handler].bind(logger));
78
+ worker.addSupervisorEventListener(ev, logger[handler].bind(logger));
79
79
  }
80
80
 
81
81
  worker.on('sandbox', (sandbox) => {
@@ -9,12 +9,34 @@
9
9
 
10
10
  require('./common-types');
11
11
 
12
- /** @type {WorkerLogger} */
12
+ /**
13
+ * When this.enhancedDisplay is true
14
+ * Sandbox 1: Slice Started: slice 1, 0x5b5214D48F0428669c4E: Simple Job
15
+ * Sandbox 1: Slice Completed: slice 1, 0x5b5214D48F0428669c4E: Simple Job: dt 114ms
16
+ * When this.enhancedDisplay is false
17
+ * Sandbox 1: Slice Started: 0x5b5214D48F0428669c4E68779896D29D77c42903 Simple Job
18
+ * Sandbox 1: Slice Completed: 0x5b5214D48F0428669c4E68779896D29D77c42903 Simple Job
19
+ * @type {WorkerLogger}
20
+ */
13
21
  const consoleLogger = {
14
22
  init(worker, options) {
15
23
  this.worker = worker;
16
- this.supervisor = worker.supervisor;
17
24
  this.options = Object.assign({}, options);
25
+ this.sliceMap = {}; // jobAddress --> ( sliceNumber, t0 )
26
+ this.enhancedDisplay = true; // When false, no timing, no sliceNumber, full jobAddress
27
+ this.truncationLength = 22; // Extra 2 for '0x'
28
+ },
29
+
30
+ id (sandbox, sliceNumber) {
31
+ if (!this.enhancedDisplay)
32
+ return sandbox.public ? `${sandbox.jobAddress} ${sandbox.public.name}` : `${sandbox.jobAddress}`;
33
+
34
+ const address = sandbox.jobAddress ? sandbox.jobAddress.slice(0, this.truncationLength) : 'null';
35
+ const baseInfo = sandbox.public ? `${address}: ${sandbox.public.name}` : `${address}:`;
36
+
37
+ if (!sliceNumber)
38
+ sliceNumber = sandbox.slice ? sandbox.slice.sliceNumber : 0;
39
+ return sliceNumber ? `slice ${sliceNumber}, ${baseInfo}` : baseInfo;
18
40
  },
19
41
 
20
42
  onSandboxReady(sandbox) {
@@ -29,21 +51,28 @@ const consoleLogger = {
29
51
  return sandboxData;
30
52
  },
31
53
 
32
- sandbox$onSliceStart(sandbox, sandboxData, slice) {
33
- console.log(` * Sandbox ${sandboxData.shortId}: Slice Started: ${sandbox.jobAddress} ${sandbox.public.name}`);
54
+ sandbox$onSliceStart(sandbox, sandboxData, ev) {
55
+ const sliceNumber = sandbox.slice ? sandbox.slice.sliceNumber : 0;
56
+ this.sliceMap[sandbox.id] = { slice: sliceNumber, t0: Date.now() };
57
+ console.log(` * Sandbox ${sandboxData.shortId}: Slice Started: ${this.id(sandbox)}`);
34
58
  },
35
59
 
36
60
  sandbox$onSliceProgress(sandbox, sandboxData, ev) {
37
61
  // something
38
62
  },
39
-
63
+
40
64
  sandbox$onSliceFinish(sandbox, sandboxData, ev) {
41
- console.log(` * Sandbox ${sandboxData.shortId}: Slice Completed: ${sandbox.jobAddress} ${sandbox.public.name}`);
65
+ const sliceInfo = this.sliceMap[sandbox.id];
66
+ if (sliceInfo && this.enhancedDisplay)
67
+ console.log(` * Sandbox ${sandboxData.shortId}: Slice Completed: ${this.id(sandbox, sliceInfo.slice)}: dt ${Date.now() - sliceInfo.t0}ms`);
68
+ else
69
+ console.log(` * Sandbox ${sandboxData.shortId}: Slice Completed: ${this.id(sandbox)}`);
42
70
  },
43
71
 
44
- sandbox$onWorkerStop(sandbox, sandboxData, _event) {
45
- const job = sandbox.public ? `${sandbox.jobAddress} ${sandbox.public.name}` : sandbox.job;
46
- console.log(` * Sandbox ${sandboxData.shortId}: Terminated: ${job}`);
72
+ sandbox$onWorkerStop(sandbox, sandboxData, ev) {
73
+ const sliceInfo = this.sliceMap[sandbox.id];
74
+ delete this.sliceMap[sandbox.id];
75
+ console.log(` * Sandbox ${sandboxData.shortId}: Terminated: ${this.id(sandbox, sliceInfo?.slice)}`);
47
76
  },
48
77
 
49
78
  onPayment({ payment }) {
@@ -62,7 +91,7 @@ const consoleLogger = {
62
91
  },
63
92
 
64
93
  onFetchedSlices(ev) {
65
- this.options.verbose && console.log(" * Fetched", ev, 'slices');
94
+ this.options.verbose && console.log(" * Fetched", ev);
66
95
  },
67
96
 
68
97
  onFetchSlicesFailed(ev) {
@@ -28,7 +28,6 @@ const dashboardLogger = {
28
28
  init(worker, options) {
29
29
  this.worker = worker;
30
30
  this.options = options;
31
- this.supervisor = worker.supervisor;
32
31
  this.totalDCCs = 0;
33
32
  this.sliceFetchStatus = SLICE_FETCH_STATUS.IDLE;
34
33
  exports.screen = this.screen = blessed.screen();
@@ -57,7 +56,7 @@ const dashboardLogger = {
57
56
 
58
57
  this.sandboxes = grid.set(0, 0, 2, 2, components.sandboxes, {
59
58
  label: 'Sandboxes',
60
- defaultProgressBars: this.supervisor.maxWorkingSandboxes,
59
+ defaultProgressBars: this.worker.cpuCores,
61
60
  scrollable: true,
62
61
  alwaysScroll: true,
63
62
  mouse: true,
@@ -69,7 +68,7 @@ const dashboardLogger = {
69
68
  this.workerInfo = grid.set(2, 0, 1, 5, blessed.text);
70
69
  this.updateWorkerInfo();
71
70
 
72
- setInterval(() => this.screen.render(), 1000).unref();
71
+ setInterval(() => this.screen.render(), 50).unref(); /* 50ms = 20 fps */
73
72
 
74
73
  function raise(sig)
75
74
  {
@@ -79,7 +78,7 @@ const dashboardLogger = {
79
78
  /* Apply key bindings which mimic canonical input mode */
80
79
  this.screen.key(['C-c'], () => raise('SIGINT'));
81
80
  this.screen.key(['C-z'], () => raise('SIGTSTP'));
82
- this.screen.key(['C-\\'], () => raise('SIGQUIT'));
81
+ this.screen.key(['\u001c'], () => raise('SIGQUIT')); /* C-\ */
83
82
 
84
83
  this.screen.key(['escape'], () => {
85
84
  console.log('Stopping worker...');
@@ -96,8 +95,8 @@ const dashboardLogger = {
96
95
  '',
97
96
  ` Scheduler: ${chalk.yellow(dcpConfig.scheduler.location.href)}`,
98
97
  ` Bank: ${chalk.yellow(dcpConfig.bank.location.href)}`,
99
- `Bank Account: ${chalk.yellow(this.supervisor.paymentAddress || 'Starting...')}`,
100
- ` Identity: ${chalk.yellow(this.supervisor.identityKeystore? this.supervisor.identityKeystore.address : 'Starting...')}`,
98
+ `Bank Account: ${chalk.yellow(this.worker.paymentAddress || 'Starting...')}`,
99
+ ` Identity: ${chalk.yellow(this.worker.identityKeystore? this.worker.identityKeystore.address : 'Starting...')}`,
101
100
  ` Jobs: ${workerOptions.jobAddresses?.length ? workerOptions.jobAddresses.join(', ') : '<any>'}`,
102
101
  ` Priv Groups: ${Object.keys(workerOptions.computeGroups).length}`,
103
102
  ` Pub Group: ${workerOptions.leavePublicGroup ? 'no' : 'yes'}`,
package/npm-hooks/prepack CHANGED
@@ -1,17 +1,21 @@
1
- #! /bin/bash
2
- #
3
- # @file prepack
4
- # Hook which generates the config md5 on pack (or publish)
5
- # @author Wes Garland, wes@distributive.network
6
- # @date April 2023
7
- #
8
- set -e
9
- set -u
10
- set -o pipefail
1
+ #! /usr/bin/env node
2
+ /**
3
+ * @file prepack
4
+ * Hook which generates the config md5 on pack (or publish)
5
+ * @author Wes Garland, wes@distributive.network
6
+ * @date April 2023, June 2023
7
+ */
11
8
 
12
- cd `dirname "$0"`/..
9
+ const fs = require('fs');
10
+ const process = require('process');
11
+ const path = require('path');
13
12
 
14
- (
15
- md5sum etc/dcp-worker-config.js
16
- echo "### DO NOT MODIFY THIS FILE!!! ###"
17
- ) > etc/dcp-worker-config.js.md5
13
+ function md5(content)
14
+ {
15
+ return require('crypto').createHash('md5').update(content).digest('hex');
16
+ }
17
+
18
+ process.chdir(path.resolve(__dirname, '..'));
19
+ fs.writeFileSync('etc/dcp-worker-config.js.md5', ''
20
+ + `${md5(fs.readFileSync('etc/dcp-worker-config.js'))}\n`
21
+ + '### DO NOT MODIFY THIS FILE!!! ###\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dcp-worker",
3
- "version": "3.2.28-1",
3
+ "version": "3.2.28",
4
4
  "description": "JavaScript portion of DCP Workers for Node.js",
5
5
  "main": "bin/dcp-worker",
6
6
  "keywords": [
@@ -12,13 +12,10 @@
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "git+ssh://git@gitlab.com/Distributed-Compute-Protocol/dcp-worker.git"
15
+ "url": "git@github.com:Distributed-Compute-Labs/dcp-worker.git"
16
16
  },
17
17
  "license": "MIT",
18
18
  "author": "Kings Distributed Systems",
19
- "engines": {
20
- "node": ">=14.0.0"
21
- },
22
19
  "bin": {
23
20
  "dcp-evaluator-start": "bin/dcp-evaluator-start",
24
21
  "dcp-worker": "bin/dcp-worker"
@@ -30,8 +27,9 @@
30
27
  "scripts": {
31
28
  "start": "node bin/dcp-worker start",
32
29
  "start-evaluator": "node bin/dcp-evaluator-start",
30
+ "hook": "PATH=npm-hooks:$PATH &&",
33
31
  "test": "peter tests",
34
- "x-prepack": "npm-hooks/prepack",
32
+ "prepack": "node npm-hooks/prepack",
35
33
  "postpublish": "npm-hooks/postpublish",
36
34
  "prepublishOnly": "npm-hooks/prepublish"
37
35
  },
@@ -39,14 +37,18 @@
39
37
  "blessed": "^0.1.81",
40
38
  "blessed-contrib": "^4.11.0",
41
39
  "chalk": "^4.1.0",
42
- "dcp-client": "^4.2.30",
40
+ "dcp-client": "4.2.31",
43
41
  "semver": "^7.3.8"
44
42
  },
45
43
  "optionalDependencies": {
46
44
  "telnet-console": "^1.0.4"
47
45
  },
48
46
  "devDependencies": {
49
- "@kingsds/eslint-config": "1.0.1",
47
+ "@kingsds/eslint-config": "^1.0.1",
50
48
  "eslint": "7.30.0"
49
+ },
50
+ "engines": {
51
+ "node": ">=16",
52
+ "npm": ">=6"
51
53
  }
52
54
  }