dcp-worker 3.3.1 → 3.3.3-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/.eslintrc.js CHANGED
@@ -28,4 +28,5 @@ module.exports = {
28
28
  sourceType: 'script',
29
29
  },
30
30
  rules: {},
31
+ ignorePatterns: ['etc/*']
31
32
  };
package/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017-2020 Kings Distributed Systems, Inc.
1
+ Copyright (c) 2017-2024 Distributive Corp.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a
4
4
  copy of this software and associated documentation files (the
package/bin/dcp-worker CHANGED
@@ -137,7 +137,7 @@ function parseCliArgs()
137
137
  hidden: true,
138
138
  describe: 'If set, worker will prefer private groups but fall back on the public group if no preferred work is available',
139
139
  type: 'boolean',
140
- default: 'undefined',
140
+ default: undefined,
141
141
  defaultDescription: undefined,
142
142
  },
143
143
 
package/docs/CODEOWNERS CHANGED
@@ -1,17 +1,12 @@
1
- # @file CODEOWNERS - Defines who develops and maintains a feature, and own
2
- # the resulting files or directories in the repository.
3
- #
4
- # See https://docs.gitlab.com/ee/user/project/code_owners.html
5
- #
6
- # @author Bryan Hoang <bryan@distributive.network>
7
- # @date August 2022
8
-
9
- # Username mapping:
10
- # @wesgarland -> Wes Garland <wes@distributive.network>
11
-
1
+ # @file CODEOWNERS - machine-generated via dcp-docs-wes git@gitlab.com:Distributed-Compute-Protocol/dcp-docs-wes.git 95d8ee8e39d502a4e215311b8685a8c18c5dff99
2
+ # @author wes@people
3
+ # @date Wed Apr 24 09:17:03 EDT 2024
12
4
 
13
5
  []
14
6
 
7
+ [Brandon]
8
+ /catalog-info.yaml @BChristieDistributive
9
+
15
10
  [Eddie]
16
11
  /package-lock.json @eroosenmaallen
17
12
 
@@ -19,10 +14,12 @@
19
14
  /npm-hooks/ @wesgarland
20
15
  /README.md @wesgarland
21
16
  /docs/ @wesgarland
17
+ /package-lock.json @wesgarland
22
18
  /.eslintrc.js @wesgarland
23
19
  /.npmrc @wesgarland
24
20
  /.tidelift @wesgarland
25
21
  /lib/ @wesgarland
22
+ /package.json @wesgarland
26
23
  /LICENSE.md @wesgarland
27
24
  /.trunk/ @wesgarland
28
25
  /.gitignore @wesgarland
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @file lib/blessed-components/index.js
3
+ * @author Ryan Rossiter <info@kingsds.network>
4
+ * @date April 2020
5
+ */
6
+
1
7
  'use strict';
2
8
 
3
9
  Object.assign(exports, require('./log'));
@@ -23,7 +23,7 @@ class Log extends Box {
23
23
 
24
24
  log(...args) {
25
25
  let str = args.reduce(
26
- (s, arg) => s += `${typeof arg === 'string'? arg : JSON.stringify(arg, null, 2)} `,
26
+ (s, arg) => (s += `${typeof arg === 'string'? arg : JSON.stringify(arg, null, 2)} `),
27
27
  '');
28
28
 
29
29
  this.logLines.push(str);
@@ -8,6 +8,11 @@
8
8
  */
9
9
  'use strict';
10
10
 
11
+ /**
12
+ * Poll the scheduler's verion codes and verify this worker is supported
13
+ *
14
+ * @param {boolean} quiet Truthy to suppress the default log if scheduler is supported
15
+ */
11
16
  exports.check = function checkSchedulerVersion$$check(quiet)
12
17
  {
13
18
  const dcpConfig = require('dcp/dcp-config');
@@ -32,7 +37,7 @@ exports.check = function checkSchedulerVersion$$check(quiet)
32
37
  let currentWorkerType = require('dcp/build').workerType || 'v4';
33
38
  let currentWorkerVersion = require('dcp/build').workerVersion || '1.0.0';
34
39
 
35
- if (parseInt(currentWorkerVersion) !== 1) {
40
+ if (parseInt(currentWorkerVersion, 10) !== 1) {
36
41
  throw new Error('This version of dcp-client is not compatible with the standalone worker implemention in this dcp-worker package');
37
42
  }
38
43
 
@@ -32,6 +32,9 @@ const screenConf = {
32
32
  output: usingDebugger ? new (require('events').EventEmitter) : undefined,
33
33
  };
34
34
  /**
35
+ * Initialize the blessed dashboard
36
+ * @param {Worker} worker Reference to the DCP Worker
37
+ * @param {object} options Options which may affect behaviour. Not currently used.
35
38
  */
36
39
  exports.init = function dashboard$$init(worker, options)
37
40
  {
@@ -37,6 +37,8 @@ const workerEventHandlers = {};
37
37
  */
38
38
 
39
39
  /**
40
+ * Hook a worker's events
41
+ *
40
42
  * @param worker The instance of Worker to hook
41
43
  * @param options cliArgs from worker
42
44
  */
@@ -38,11 +38,12 @@ function daemonEval()
38
38
  if (typeof dcpConfig === 'undefined')
39
39
  dcpConfig = require('dcp/dcp-config');
40
40
  }
41
- catch(e){};
41
+ catch(e)
42
+ {}
42
43
 
43
44
  if (mainEval)
44
45
  return mainEval(arguments[0]);
45
- return eval(arguments[0]);
46
+ return eval(arguments[0]); /* eslint-disable-line no-eval */
46
47
  }
47
48
 
48
49
  function callbackTelnet(port, client, registry) {
@@ -59,6 +60,12 @@ exports.setMainEval = function removeConsole$$setMainEval()
59
60
  mainEval = arguments[0];
60
61
  }
61
62
 
63
+ /**
64
+ * Initialize the remote console
65
+ *
66
+ * @param {...object} commands Command definitions. See telnet-console documentation
67
+ * for details
68
+ */
62
69
  exports.init = function remoteConsole$$init(...commands)
63
70
  {
64
71
  try
@@ -101,6 +108,9 @@ exports.init = function remoteConsole$$init(...commands)
101
108
  }
102
109
  }
103
110
 
111
+ /**
112
+ * Re-intercept log calls. To be used after a logger may have added its own override.
113
+ */
104
114
  exports.reintercept = function remoteConsole$$reintercept()
105
115
  {
106
116
  if (typeof ci === 'undefined')
package/lib/utils.js CHANGED
@@ -18,7 +18,8 @@ function slicesFetched (task)
18
18
  if (typeof task === 'number') /* <= June 2023 Worker events: remove ~ Sep 2023 /wg */
19
19
  return task;
20
20
  if (typeof task === 'string') /* <= June 2023 Worker events: remove ~ Sep 2023 /wg */
21
- return parseInt(task) || 0;
21
+ return parseInt(task, 10) || 0;
22
+ /* eslint-disable-next-line no-shadow */
22
23
  let slicesFetched = 0;
23
24
  for (const job in task.slices)
24
25
  slicesFetched += task.slices[job];
@@ -8,6 +8,11 @@
8
8
 
9
9
  const process = require('process');
10
10
 
11
+ /**
12
+ * Initialize the console logger
13
+ *
14
+ * @param {object} options Any options affecting console behaviour. Not presently used.
15
+ */
11
16
  exports.init = function console$$init(options)
12
17
  {
13
18
  const myConsole = new (require('console').Console)(process);
@@ -11,6 +11,11 @@
11
11
  const chalk = require('chalk');
12
12
  const _console = new (require('console').Console)(process);
13
13
 
14
+ /**
15
+ * Initialize the Blessed dashboard
16
+ *
17
+ * @param {object} options Options affecting dasboard behaviour
18
+ */
14
19
  exports.init = function dashboardLogger$$init(options)
15
20
  {
16
21
  function logWrapperFactory(logLevel)
@@ -34,7 +39,7 @@ exports.init = function dashboardLogger$$init(options)
34
39
  for (let i in argv)
35
40
  {
36
41
  if (argv[i] instanceof Error || (typeof argv[i] === 'object' && argv[i][inspect]))
37
- argv[i] = util.inspect(argv[i]);
42
+ argv[i] = require('node:util').inspect(argv[i]);
38
43
  else if (logLevel === 'error' && typeof argv[i] === 'string')
39
44
  argv[i] = chalk.red(argv[i]);
40
45
  }
@@ -33,6 +33,7 @@ exports.init = function eventLog$$init(options)
33
33
  }
34
34
 
35
35
  /**
36
+ * Emit a message to the Windows event-log
36
37
  * @param {string} level The node log level to log at
37
38
  * @param {[string]} items An array of strings to log as a single message
38
39
  */
@@ -31,7 +31,7 @@ exports.init = function syslog$$init(cliArgs)
31
31
  transport: cliArgs.syslogTransport, // tcp, udp, unix, tls
32
32
  port: cliArgs.syslogPort,
33
33
  facility: syslog.Facility[cliArgs.syslogFacility[0].toUpperCase() + cliArgs.syslogFacility.slice(1)],
34
- }
34
+ };
35
35
 
36
36
  syslogClient = syslog.createClient(cliArgs.syslogAddress, syslogOptions);
37
37
  processName = require('path').basename(process.mainModule.filename || process.argv0);
@@ -39,6 +39,12 @@ exports.init = function syslog$$init(cliArgs)
39
39
  }
40
40
  }
41
41
 
42
+ /**
43
+ * Emit a message to syslog
44
+ *
45
+ * @param {string} level Event level (info, debug, log, warning, error)
46
+ * @param {...any[]} argv Items to log
47
+ */
42
48
  function log(level, ...argv)
43
49
  {
44
50
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dcp-worker",
3
- "version": "3.3.1",
3
+ "version": "3.3.3-0",
4
4
  "description": "JavaScript portion of DCP Workers for Node.js",
5
5
  "main": "bin/dcp-worker",
6
6
  "keywords": [
@@ -12,7 +12,7 @@
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
18
  "author": "Kings Distributed Systems",
@@ -40,7 +40,7 @@
40
40
  "blessed": "^0.1.81",
41
41
  "blessed-contrib": "^4.11.0",
42
42
  "chalk": "^4.1.0",
43
- "dcp-client": "4.4.1",
43
+ "dcp-client": "4.4.3-0",
44
44
  "kvin": "^1.2.7",
45
45
  "posix-getopt": "^1.2.1",
46
46
  "semver": "^7.3.8",
@@ -53,7 +53,6 @@
53
53
  "devDependencies": {
54
54
  "@distributive/eslint-config": "2.1.1",
55
55
  "@distributive/eslint-plugin": "1.0.2",
56
- "@kingsds/eslint-config": "^1.0.1",
57
56
  "@trunkio/launcher": "1.2.7",
58
57
  "eslint": "8.56.0"
59
58
  },