dcp-worker 3.2.13 → 3.2.15

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 ADDED
@@ -0,0 +1,30 @@
1
+ # @file .gitlab-ci.yml - GitLab CI configuration file.
2
+ # @author Bryan Hoang <bryan@distributive.network>
3
+ # @date September 2022
4
+
5
+ # Note: The CLI requires `glibc`.
6
+ image: node:14
7
+
8
+ stages:
9
+ - build
10
+
11
+ # Use in-house GitLab runners.
12
+ default:
13
+ tags:
14
+ - dcp
15
+ - linux
16
+
17
+ tidelift:
18
+ stage: build
19
+ variables:
20
+ # This should be kept in a GitLab Variable. Read more:
21
+ # https://docs.gitlab.com/ee/ci/variables/#create-a-custom-variable-in-the-ui
22
+ TIDELIFT_API_KEY: $TIDELIFT_API_KEY
23
+ script:
24
+ - echo "Downloading Tidelift CLI"
25
+ - curl https://download.tidelift.com/cli/tidelift -o tidelift
26
+ - echo "Setting permissions"
27
+ - chmod +x tidelift
28
+ - echo "Running alignment and saving to Tidelift"
29
+ - ./tidelift alignment save --wait
30
+ cache: []
package/.tidelift ADDED
@@ -0,0 +1,2 @@
1
+ TIDELIFT_ORGANIZATION=team/Distributive
2
+ TIDELIFT_PROJECT=dcp-worker
package/bin/dcp-worker CHANGED
@@ -342,23 +342,31 @@ async function startWorking(cliArgs) {
342
342
  syslogPort: cliArgs.syslogPort,
343
343
  });
344
344
 
345
- require('../lib/remote-console').init(cliArgs.replPort, {
346
- help: {
347
- report: 'Print a worker status & slice report',
348
- kill: 'Kill the worker',
349
- },
350
- commands: {
351
- report: printReport,
352
- kill: exitcode => exitGuard.exit(exitcode),
353
- },
354
- });
355
- require('../lib/remote-console').setMainEval(function mainEval() { return eval(arguments[0]) });
345
+ try
346
+ {
347
+ require('../lib/remote-console').init(cliArgs.replPort, {
348
+ help: {
349
+ report: 'Print a worker status & slice report',
350
+ kill: 'Kill the worker',
351
+ },
352
+ commands: {
353
+ report: printReport,
354
+ kill: exitcode => exitGuard.exit(exitcode),
355
+ },
356
+ });
357
+ require('../lib/remote-console').setMainEval(function mainEval() { return eval(arguments[0]) });
358
+ }
359
+ catch (error)
360
+ {
361
+ console.warn('350: Failed to initialize remote console:', error.message);
362
+ }
356
363
 
357
- console.log(` * Starting DCP Worker`);
358
- console.log(` . Configured for scheduler ${dcpConfig.scheduler.location}`);
359
- console.log(` . Bank is ${dcpConfig.bank.location}`);
360
- console.log(` . Earned funds will be deposited in account ${paymentAddress}`);
361
- console.log(` . Identity is ${identityKeystore.address}`);
364
+ let introBanner = '';
365
+ introBanner += ` * Starting DCP Worker` + '\n';
366
+ introBanner += ` . Configured for scheduler ${dcpConfig.scheduler.location}` + '\n';
367
+ introBanner += ` . Bank is ${dcpConfig.bank.location}` + '\n';
368
+ introBanner += ` . Earned funds will be deposited in account ${paymentAddress}` + '\n';
369
+ introBanner += ` . Identity is ${identityKeystore.address}` + '\n';
362
370
 
363
371
  function qty(amount, singular, plural) /* XXX i18n */
364
372
  {
@@ -374,22 +382,24 @@ async function startWorking(cliArgs) {
374
382
  }
375
383
 
376
384
  if (dcpWorkerOptions.jobAddresses)
377
- console.log(` * Processing only ${qty(dcpWorkerOptions.jobAddresses, 'job')}`, dcpWorkerOptions.jobAddresses.join(', '));
385
+ introBanner += ` * Processing only ${qty(dcpWorkerOptions.jobAddresses, 'job')}` + dcpWorkerOptions.jobAddresses.join(', ') + '\n';
378
386
  if (dcpWorkerOptions.computeGroups.length)
379
- console.log(` * Joining compute ${qty(dcpWorkerOptions.computeGroups, 'group')}`, dcpWorkerOptions.computeGroups.map(el => el.joinKey).join(', '));
387
+ introBanner += ` * Joining compute ${qty(dcpWorkerOptions.computeGroups, 'group')}` + dcpWorkerOptions.computeGroups.map(el => el.joinKey).join(', ') + '\n';
380
388
  if (dcpWorkerOptions.publicGroupFallback)
381
- console.log(' * Falling back on public group when preferred groups have no work');
389
+ introBanner += ' * Falling back on public group when preferred groups have no work' + '\n';
382
390
  else if (dcpWorkerOptions.leavePublicGroup)
383
- console.log(' * Leaving the public compute group');
391
+ introBanner += ' * Leaving the public compute group' + '\n';
384
392
  if (cliArgs.verbose)
385
- console.log(` + Verbosity level: ${cliArgs.verbose}`);
393
+ introBanner += ` + Verbosity level: ${cliArgs.verbose}` + '\n';
386
394
  if (cliArgs.eventDebug)
387
- console.log(' + Event debug on');
388
- console.log(' . output mode: ' + cliArgs.output);
395
+ introBanner += ' + Event debug on' + '\n';
396
+ introBanner += ' . output mode: ' + cliArgs.output + '\n';
389
397
 
390
- require('../lib/check-scheduler-version').check();
398
+ introBanner += ' . ready' + '\n';
399
+
400
+ console.log(introBanner);
391
401
 
392
- console.log(' . ready');
402
+ require('../lib/check-scheduler-version').check();
393
403
 
394
404
 
395
405
  /** print the slice report via console.log */
@@ -81,22 +81,14 @@ const consoleLogger = {
81
81
  console.log(" ! Failed to submit results:", ev);
82
82
  },
83
83
 
84
- onError(ev) {
85
- this.options.verbose && console.error(" ! Worker error:", ev);
86
- },
87
-
88
- onWarning(ev) {
89
- this.options.verbose >= 2 && console.warn(" ! Worker warning:", ev);
90
- },
91
-
92
84
  onError(ev)
93
85
  {
94
- this.options.verbose && console.error("Worker Error:", ev);
86
+ this.options.verbose && console.error(" ! Worker Error:", ev);
95
87
  },
96
88
 
97
89
  onWarning(ev)
98
90
  {
99
- this.options.verbose && console.warn("Worker Warning:", ev);
91
+ this.options.verbose && console.warn(" ! Worker Warning:", ev);
100
92
  }
101
93
  };
102
94
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dcp-worker",
3
- "version": "3.2.13",
3
+ "version": "3.2.15",
4
4
  "description": "JavaScript portion of DCP Workers for Node.js",
5
5
  "main": "bin/dcp-worker",
6
6
  "keywords": [
@@ -36,12 +36,13 @@
36
36
  "blessed-contrib": "^4.11.0",
37
37
  "bravojs": "^1.0.15",
38
38
  "chalk": "^4.1.1",
39
- "dcp-client": "^4.2.15",
40
- "kvin": "^1.2.7",
41
- "semver": "^7.3.5",
39
+ "dcp-client": "^4.2.18",
40
+ "kvin": "^1.2.10",
41
+ "semver": "^7.3.5"
42
+ },
43
+ "optionalDependencies": {
42
44
  "telnet-console": "^1.0.4"
43
45
  },
44
- "optionalDependencies": {},
45
46
  "devDependencies": {
46
47
  "@kingsds/eslint-config": "1.0.1",
47
48
  "eslint": "7.30.0"