teraslice 3.0.0-dev.8 → 3.0.0-rc.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.
@@ -558,7 +558,7 @@ export class ApiService {
558
558
  name,
559
559
  node_version: process.version,
560
560
  platform: this.context.platform,
561
- teraslice_version: `v${getPackageJSON().version}`
561
+ teraslice_version: `v${terasliceVersion}`
562
562
  }, 1);
563
563
  this.context.apis.foundation.promMetrics.set('slices_processed', {}, stats.controllers.processed);
564
564
  this.context.apis.foundation.promMetrics.set('slices_failed', {}, stats.controllers.failed);
@@ -46,7 +46,6 @@ export class AssetsService {
46
46
  const code = created ? 201 : 200;
47
47
  const assetResponse = {
48
48
  asset_id: assetId,
49
- _id: assetId
50
49
  };
51
50
  res.status(code).json(assetResponse);
52
51
  }
@@ -74,7 +73,6 @@ export class AssetsService {
74
73
  else {
75
74
  const assetResponse = {
76
75
  asset_id: assetId,
77
- _id: assetId
78
76
  };
79
77
  requestHandler(async () => {
80
78
  await this.assetsStorage.remove(assetId);
@@ -55,8 +55,6 @@ export class K8sResource {
55
55
  const shutdownTimeoutMs = get(this.terasliceConfig, 'shutdown_timeout', 60000);
56
56
  const shutdownTimeoutSeconds = Math.round(shutdownTimeoutMs / 1000);
57
57
  const config = {
58
- // assetsDirectory: get(this.terasliceConfig, 'assets_directory', ''),
59
- // assetsVolume: get(this.terasliceConfig, 'assets_volume', ''),
60
58
  clusterName,
61
59
  clusterNameLabel,
62
60
  configMapName,
@@ -382,17 +382,17 @@ export class JobsService {
382
382
  }
383
383
  adjustNamesByAsset(jobConfig, dict) {
384
384
  jobConfig.operations = jobConfig.operations.map((op) => {
385
- if (op.api_name?.includes('@')) {
386
- const { name, assetIdentifier, tag } = parseName(op.api_name);
385
+ if (op._api_name?.includes('@')) {
386
+ const { name, assetIdentifier, tag } = parseName(op._api_name);
387
387
  const hashId = dict.get(assetIdentifier);
388
388
  if (!hashId) {
389
- throw new Error(`Invalid operation api_name for _op: ${name}, could not find the hashID for asset identifier ${assetIdentifier}`);
389
+ throw new Error(`Invalid operation _api_name for _op: ${name}, could not find the hashID for asset identifier ${assetIdentifier}`);
390
390
  }
391
391
  let hashedName = `${name}@${hashId}`;
392
392
  if (tag) {
393
393
  hashedName = `${hashedName}:${tag}`;
394
394
  }
395
- op.api_name = hashedName;
395
+ op._api_name = hashedName;
396
396
  }
397
397
  if (op._op.includes('@')) {
398
398
  const { name, assetIdentifier } = parseName(op._op);
@@ -1,7 +1,6 @@
1
1
  import path from 'node:path';
2
2
  import { get } from '@terascope/core-utils';
3
3
  import { fileURLToPath } from 'node:url';
4
- import { formats } from '@terascope/job-components';
5
4
  import { configSchema } from './schemas/system.js';
6
5
  const filePath = fileURLToPath(new URL('.', import.meta.url));
7
6
  export function clusterName(configFile) {
@@ -12,11 +11,10 @@ export function getTerasliceConfig(sysconfig) {
12
11
  name: 'teraslice',
13
12
  default_config_file: path.join(filePath, 'default-sysconfig.js'),
14
13
  config_schema: configSchema,
15
- schema_formats: formats,
16
14
  cluster_name: clusterName,
17
15
  shutdownMessaging: false,
18
16
  start_workers: false,
19
17
  }, sysconfig);
20
18
  }
21
- export { formats, configSchema, };
19
+ export { configSchema, };
22
20
  //# sourceMappingURL=index.js.map
@@ -32,18 +32,18 @@ export const schema = {
32
32
  },
33
33
  assets_volume: {
34
34
  doc: 'name of shared asset volume (k8s)',
35
- default: '',
36
- format: 'optional_String'
35
+ default: undefined,
36
+ format: 'optional_string'
37
37
  },
38
38
  autoload_directory: {
39
39
  doc: 'directory to look for assets to auto deploy when teraslice boots up',
40
40
  default: path.join(process.cwd(), './autoload'),
41
- format: 'optional_String'
41
+ format: 'optional_string'
42
42
  },
43
43
  hostname: {
44
44
  doc: 'IP or hostname for server',
45
45
  default: ip.address(),
46
- format: 'required_String'
46
+ format: 'required_string'
47
47
  },
48
48
  workers: {
49
49
  doc: 'Number of workers per server',
@@ -58,7 +58,7 @@ export const schema = {
58
58
  master_hostname: {
59
59
  doc: 'hostname where the cluster_master resides, used to notify all node_masters where to connect',
60
60
  default: 'localhost',
61
- format: 'required_String'
61
+ format: 'required_string'
62
62
  },
63
63
  port: {
64
64
  doc: 'port for the cluster_master to listen on',
@@ -68,7 +68,7 @@ export const schema = {
68
68
  name: {
69
69
  doc: 'Name for the cluster itself, its used for naming log files/indices',
70
70
  default: 'teracluster',
71
- format: 'elasticsearch_Name'
71
+ format: 'elasticsearch_name'
72
72
  },
73
73
  state: {
74
74
  doc: 'Elasticsearch cluster where job state, analytics and logs are stored',
@@ -273,12 +273,12 @@ export const schema = {
273
273
  kubernetes_image: {
274
274
  doc: 'Specify a custom image name for kubernetes, this only applies to kubernetes systems',
275
275
  default: 'terascope/teraslice',
276
- format: 'optional_String'
276
+ format: 'optional_string'
277
277
  },
278
278
  kubernetes_namespace: {
279
279
  doc: 'Specify a custom kubernetes namespace, this only applies to kubernetes systems',
280
280
  default: 'default',
281
- format: 'optional_String'
281
+ format: 'optional_string'
282
282
  },
283
283
  kubernetes_overrides_enabled: {
284
284
  doc: '',
@@ -288,17 +288,17 @@ export const schema = {
288
288
  kubernetes_priority_class_name: {
289
289
  doc: 'Priority class that the Teraslice master, execution controller, and stateful workers should run with',
290
290
  default: undefined,
291
- format: 'optional_String'
291
+ format: 'optional_string'
292
292
  },
293
293
  kubernetes_config_map_name: {
294
294
  doc: 'Specify the name of the Kubernetes ConfigMap used to configure worker pods',
295
295
  default: 'teraslice-worker',
296
- format: 'optional_String'
296
+ format: 'optional_string'
297
297
  },
298
298
  kubernetes_image_pull_secret: {
299
299
  doc: 'Name of Kubernetes secret used to pull docker images from private repository',
300
- default: '',
301
- format: 'optional_String'
300
+ default: undefined,
301
+ format: 'optional_string'
302
302
  },
303
303
  kubernetes_worker_antiaffinity: {
304
304
  doc: 'Enable Teraslice woker pod AntiAffinity in Kubernetes',
@@ -318,7 +318,7 @@ export const schema = {
318
318
  asset_storage_bucket: {
319
319
  doc: 'Name of S3 bucket used to store assets. Can only be used if "asset_storage_connection_type" is "s3".',
320
320
  default: undefined,
321
- format: String
321
+ format: 'optional_string'
322
322
  },
323
323
  };
324
324
  export function configSchema() {
@@ -50,6 +50,9 @@ export default {
50
50
  },
51
51
  _deleted_on: {
52
52
  type: 'date'
53
+ },
54
+ teraslice_version: {
55
+ type: 'keyword'
53
56
  }
54
57
  }
55
58
  }
@@ -3,6 +3,7 @@ import { RecoveryCleanupType } from '@terascope/job-components';
3
3
  import { v4 as uuid } from 'uuid';
4
4
  import { makeLogger } from '../workers/helpers/terafoundation.js';
5
5
  import { TerasliceElasticsearchStorage } from './backends/elasticsearch_store.js';
6
+ import { getPackageJSON } from '../utils/file_utils.js';
6
7
  const INIT_STATUS = ['pending', 'scheduling', 'initializing'];
7
8
  const RUNNING_STATUS = ['recovering', 'running', 'failing', 'paused', 'stopping'];
8
9
  const TERMINAL_STATUS = ['completed', 'stopped', 'rejected', 'failed', 'terminated'];
@@ -78,7 +79,8 @@ export class ExecutionStorage {
78
79
  _updated: date,
79
80
  _has_errors: false,
80
81
  _slicer_stats: {},
81
- _failureReason: ''
82
+ _failureReason: '',
83
+ teraslice_version: `v${getPackageJSON().version}`
82
84
  });
83
85
  // @ts-expect-error
84
86
  delete doc.slicer_port;
@@ -54,7 +54,7 @@ function _isCompatibleAsset(name, range, skipRestrictions = false) {
54
54
  return function checkIfCompatibleAsset(record) {
55
55
  if (record.name !== name)
56
56
  return false;
57
- if (!semver.satisfies(record.version, range)) {
57
+ if (!semver.satisfies(record.version, range, { includePrerelease: true })) {
58
58
  return false;
59
59
  }
60
60
  if (skipRestrictions)
@@ -28,7 +28,7 @@ export function shutdownHandler(context, shutdownFn) {
28
28
  || process.env.assignment
29
29
  || 'unknown-assignment';
30
30
  // this is native clustering only
31
- const isProcessRestart = process.env.process_restart;
31
+ const isProcessRestart = process.env.__process_restart;
32
32
  const api = {
33
33
  exiting: false,
34
34
  exit
@@ -132,13 +132,6 @@ export function shutdownHandler(context, shutdownFn) {
132
132
  }
133
133
  process.stdout.on('error', handleStdError);
134
134
  process.stderr.on('error', handleStdError);
135
- // event is fired from terafoundation when an error occurs during instantiation of a client
136
- // **DEPRECATED:** This handler should be removed on teraslice v1
137
- events.once('client:initialization:error', (err) => {
138
- logError(logger, err, `${assignment} received a client initialization error, ${exitingIn()}`);
139
- setStatusCode(1);
140
- exit('client:initialization:error', err);
141
- });
142
135
  events.once('worker:shutdown:complete', (err) => {
143
136
  setStatusCode(0);
144
137
  if (err) {
@@ -1,22 +1,11 @@
1
- import convict from 'convict';
2
- // @ts-expect-error no types
3
- import convict_format_with_validator from 'convict-format-with-validator';
4
- // @ts-expect-error no types
5
- import convict_format_with_moment from 'convict-format-with-moment';
6
- import { formats } from '@terascope/job-components';
1
+ import { SchemaValidator } from '@terascope/core-utils';
7
2
  import { config_schema } from '../../../src/lib/config/schemas/system.js';
8
- // load any convict schema
9
- convict.addFormats(convict_format_with_validator);
10
- convict.addFormats(convict_format_with_moment);
11
- formats.forEach((format) => convict.addFormat(format));
12
3
  describe('system_schema', () => {
13
4
  const schema = config_schema().schema.teraslice;
14
5
  function checkValidation(config) {
15
6
  try {
16
- const validator = convict(schema);
17
- validator.load(config);
18
- validator.validate();
19
- return validator.getProperties();
7
+ const validator = new SchemaValidator(schema, 'teraslice');
8
+ return validator.validate(config);
20
9
  }
21
10
  catch (err) {
22
11
  return err.message;
@@ -31,7 +20,7 @@ describe('system_schema', () => {
31
20
  expect(schema.state.default).toEqual({ connection: 'default' });
32
21
  });
33
22
  it('assets_directory is optional but requires a string', () => {
34
- expect(checkValidation({ assets_directory: 234 })).toEqual('assets_directory: Invalid parameter assets_directory, it must either be a string or an array of strings: value was 234');
23
+ expect(checkValidation({ assets_directory: 234 })).toContain('Invalid parameter assets_directory, it must either be a string or an array of strings');
35
24
  });
36
25
  });
37
26
  //# sourceMappingURL=system_schema-spec.js.map
@@ -11,6 +11,14 @@ describe('Node master', () => {
11
11
  lifecycle: 'persistent',
12
12
  workers: 1,
13
13
  assets: ['elasticsearch', 'standard'],
14
+ apis: [
15
+ {
16
+ _name: 'elasticsearch_sender_api',
17
+ index: 'example-logs',
18
+ type: 'events',
19
+ size: 5000
20
+ }
21
+ ],
14
22
  operations: [
15
23
  {
16
24
  _op: 'data_generator',
@@ -18,9 +26,7 @@ describe('Node master', () => {
18
26
  },
19
27
  {
20
28
  _op: 'elasticsearch_bulk',
21
- index: 'example-logs',
22
- type: 'events',
23
- size: 5000
29
+ _api_name: 'elasticsearch_sender_api'
24
30
  }
25
31
  ]
26
32
  };
@@ -4,7 +4,7 @@ import got from 'got';
4
4
  import { createClient } from '@terascope/opensearch-client';
5
5
  import { createS3Client } from '@terascope/file-asset-apis';
6
6
  import { AssetsService } from '../../src/lib/cluster/services/assets';
7
- import { TEST_INDEX_PREFIX } from '../test.config';
7
+ import { SEARCH_TEST_HOST, TEST_INDEX_PREFIX } from '../test.config';
8
8
  import { findPort } from '../../src/lib/utils/port_utils.js';
9
9
  describe('Assets Service', () => {
10
10
  const contextOptions = {
@@ -48,7 +48,7 @@ describe('Assets Service', () => {
48
48
  },
49
49
  'elasticsearch-next': {
50
50
  default: {
51
- node: [process.env.SEARCH_TEST_HOST]
51
+ node: [SEARCH_TEST_HOST]
52
52
  },
53
53
  },
54
54
  }
@@ -3,7 +3,7 @@ import { TestContext } from '@terascope/job-components';
3
3
  import { createClient } from '@terascope/opensearch-client';
4
4
  import { createS3Client } from '@terascope/file-asset-apis';
5
5
  import { AssetsStorage } from '../../src/lib/storage';
6
- import { TEST_INDEX_PREFIX } from '../test.config';
6
+ import { SEARCH_TEST_HOST, TEST_INDEX_PREFIX } from '../test.config';
7
7
  describe('AssetsStorage using S3 backend', () => {
8
8
  let storage;
9
9
  const options = {
@@ -32,7 +32,7 @@ describe('AssetsStorage using S3 backend', () => {
32
32
  connectors: {
33
33
  'elasticsearch-next': {
34
34
  default: {
35
- node: [process.env.SEARCH_TEST_HOST]
35
+ node: [SEARCH_TEST_HOST]
36
36
  }
37
37
  },
38
38
  s3: {
@@ -1,8 +1,23 @@
1
+ import { SchemaValidator } from '@terascope/core-utils';
1
2
  import { newId } from '../src/lib/utils/id_utils.js';
2
- const { TEST_INDEX_PREFIX = 'teratest_', ELASTICSEARCH_HOST = 'http://localhost:9200', TERASLICE_CLUSTER_NAME = newId(`${TEST_INDEX_PREFIX}teraslice`, true, 2), ELASTICSEARCH_VERSION = '6.8', SEARCH_TEST_HOST = ELASTICSEARCH_HOST } = process.env;
3
- process.env.TERASLICE_CLUSTER_NAME = TERASLICE_CLUSTER_NAME;
4
- process.env.ELASTICSEARCH_HOST = ELASTICSEARCH_HOST;
5
- process.env.ELASTICSEARCH_VERSION = ELASTICSEARCH_VERSION;
6
- process.env.SEARCH_TEST_HOST = SEARCH_TEST_HOST;
7
- export { TEST_INDEX_PREFIX, SEARCH_TEST_HOST, TERASLICE_CLUSTER_NAME, ELASTICSEARCH_VERSION, };
3
+ const terasliceTestEnvSchema = {
4
+ SEARCH_TEST_HOST: {
5
+ default: undefined,
6
+ format: String,
7
+ },
8
+ TERASLICE_CLUSTER_NAME: {
9
+ default: null,
10
+ format: 'optional_string',
11
+ },
12
+ TEST_INDEX_PREFIX: {
13
+ default: undefined,
14
+ format: String,
15
+ },
16
+ };
17
+ const validator = new SchemaValidator(terasliceTestEnvSchema, 'terasliceTestEnvSchema', undefined, 'allow');
18
+ const envConfig = validator.validate(process.env);
19
+ const { SEARCH_TEST_HOST, TEST_INDEX_PREFIX } = envConfig;
20
+ const TERASLICE_CLUSTER_NAME = envConfig.TERASLICE_CLUSTER_NAME
21
+ || newId(`${TEST_INDEX_PREFIX}teraslice`, true, 2);
22
+ export { TEST_INDEX_PREFIX, SEARCH_TEST_HOST, TERASLICE_CLUSTER_NAME, };
8
23
  //# sourceMappingURL=test.config.js.map
@@ -8,7 +8,6 @@ import { ExecutionController } from '../../../src/lib/workers/execution-controll
8
8
  import { findPort } from '../../../src/lib/utils/port_utils.js';
9
9
  import { newId } from '../../../src/lib/utils/id_utils.js';
10
10
  const ExecutionControllerClient = ExController.Client;
11
- process.env.BLUEBIRD_LONG_STACK_TRACES = '1';
12
11
  describe('ExecutionController Special Tests', () => {
13
12
  // [ message, config ]
14
13
  const testCases = [
@@ -4,6 +4,7 @@ import { TestContext } from '../helpers/index.js';
4
4
  import { getTestCases } from '../helpers/execution-controller-helper.js';
5
5
  import { findPort } from '../../../src/lib/utils/port_utils.js';
6
6
  import { newId } from '../../../src/lib/utils/id_utils.js';
7
+ import { getPackageJSON } from '../../../src/lib/utils/file_utils.js';
7
8
  import { ExecutionController } from '../../../src/lib/workers/execution-controller/index.js';
8
9
  const ExecutionControllerClient = ExController.Client;
9
10
  describe('ExecutionController Test Cases', () => {
@@ -333,6 +334,10 @@ describe('ExecutionController Test Cases', () => {
333
334
  const metadata = updateMetadata ? { slice_calls: count + 1 } : {};
334
335
  expect(executionRecord).toHaveProperty('metadata', metadata);
335
336
  });
337
+ it('should have the correct teraslice version', () => {
338
+ const terasliceVersion = `v${getPackageJSON().version}`;
339
+ expect(executionRecord.teraslice_version).toBe(terasliceVersion);
340
+ });
336
341
  });
337
342
  });
338
343
  //# sourceMappingURL=execution-test-cases-spec.js.map
@@ -4,7 +4,7 @@ import { withoutNil } from '@terascope/core-utils';
4
4
  // @ts-expect-error
5
5
  import Chance from 'chance';
6
6
  import { newId } from '../../../src/lib/utils/id_utils.js';
7
- const { SEARCH_TEST_HOST } = process.env;
7
+ import { SEARCH_TEST_HOST } from '../../test.config.js';
8
8
  const dirname = path.dirname(fileURLToPath(import.meta.url));
9
9
  const opsPath = path.join(dirname, '..', 'fixtures', 'ops');
10
10
  const chance = new Chance();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "teraslice",
3
3
  "displayName": "Teraslice",
4
- "version": "3.0.0-dev.8",
4
+ "version": "3.0.0-rc.0",
5
5
  "description": "Distributed computing platform for processing JSON data",
6
6
  "homepage": "https://github.com/terascope/teraslice#readme",
7
7
  "bugs": {
@@ -39,11 +39,11 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@kubernetes/client-node": "~1.3.0",
42
- "@terascope/core-utils": "~2.0.0-dev.7",
43
- "@terascope/elasticsearch-api": "~5.0.0-dev.7",
44
- "@terascope/job-components": "~2.0.0-dev.7",
45
- "@terascope/teraslice-messaging": "~2.0.0-dev.8",
46
- "@terascope/types": "~2.0.0-dev.6",
42
+ "@terascope/core-utils": "~2.0.0-rc.0",
43
+ "@terascope/elasticsearch-api": "~5.0.0-rc.0",
44
+ "@terascope/job-components": "~2.0.0-rc.0",
45
+ "@terascope/teraslice-messaging": "~2.0.0-rc.0",
46
+ "@terascope/types": "~2.0.0-rc.0",
47
47
  "async-mutex": "~0.5.0",
48
48
  "barbe": "~3.0.17",
49
49
  "body-parser": "~2.2.0",
@@ -61,20 +61,23 @@
61
61
  "semver": "~7.7.2",
62
62
  "socket.io": "~4.8.1",
63
63
  "socket.io-client": "~4.8.1",
64
- "terafoundation": "~2.0.0-dev.7",
64
+ "terafoundation": "~2.0.0-rc.0",
65
65
  "uuid": "~13.0.0"
66
66
  },
67
67
  "devDependencies": {
68
- "@terascope/opensearch-client": "~2.0.0-dev.7",
68
+ "@terascope/opensearch-client": "~2.0.0-rc.0",
69
69
  "@types/archiver": "~6.0.3",
70
+ "@types/body-parser": "^1.19.6",
71
+ "@types/decompress": "^4.2.7",
70
72
  "@types/express": "~5.0.3",
71
73
  "@types/gc-stats": "~1.4.3",
74
+ "@types/ip": "^1.1.3",
75
+ "@types/js-yaml": "^4.0.9",
76
+ "@types/ms": "~0.7.34",
77
+ "@types/semver": "^7.7.1",
72
78
  "archiver": "~7.0.1",
73
79
  "bufferstreams": "~3.0.0",
74
80
  "chance": "~1.1.13",
75
- "convict": "~6.2.4",
76
- "convict-format-with-moment": "~6.2.0",
77
- "convict-format-with-validator": "~6.2.0",
78
81
  "jest-fixtures": "~0.6.0",
79
82
  "js-yaml": "~4.1.0",
80
83
  "nock": "~13.5.6"