@miso.ai/server-sdk 0.6.5-beta.9 → 0.6.6-beta.1
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/cli/upload.js +6 -0
- package/cli/utils.js +5 -3
- package/package.json +2 -2
- package/src/axios.js +8 -4
- package/src/stream/api-sink.js +8 -1
- package/src/stream/upload.js +2 -0
- package/src/version.js +1 -1
package/cli/upload.js
CHANGED
|
@@ -12,6 +12,10 @@ function build(yargs) {
|
|
|
12
12
|
describe: 'Accept some lenient record schema',
|
|
13
13
|
type: 'boolean',
|
|
14
14
|
})
|
|
15
|
+
.option('requests-per-second', {
|
|
16
|
+
alias: ['rps'],
|
|
17
|
+
describe: 'How many requests to send per second',
|
|
18
|
+
})
|
|
15
19
|
.option('records-per-request', {
|
|
16
20
|
alias: ['rpr'],
|
|
17
21
|
describe: 'How many records to send in a request',
|
|
@@ -47,6 +51,7 @@ const run = type => async ({
|
|
|
47
51
|
param: params,
|
|
48
52
|
['dry-run']: dryRun,
|
|
49
53
|
lenient,
|
|
54
|
+
['requests-per-second']: requestsPerSecond,
|
|
50
55
|
['records-per-request']: recordsPerRequest,
|
|
51
56
|
['bytes-per-request']: bytesPerRequest,
|
|
52
57
|
['bytes-per-second']: bytesPerSecond,
|
|
@@ -71,6 +76,7 @@ const run = type => async ({
|
|
|
71
76
|
dryRun,
|
|
72
77
|
params,
|
|
73
78
|
heartbeatInterval: logFormat === logger.FORMAT.PROGRESS ? 250 : false,
|
|
79
|
+
requestsPerSecond,
|
|
74
80
|
recordsPerRequest,
|
|
75
81
|
bytesPerRequest,
|
|
76
82
|
bytesPerSecond,
|
package/cli/utils.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { yargs as _yargs } from '@miso.ai/server-commons';
|
|
2
|
+
|
|
1
3
|
export function buildForApi(yargs) {
|
|
2
4
|
return yargs
|
|
3
5
|
.option('key', {
|
|
@@ -12,7 +14,7 @@ export function buildForApi(yargs) {
|
|
|
12
14
|
alias: ['v', 'var'],
|
|
13
15
|
describe: 'Extra URL parameters',
|
|
14
16
|
type: 'array',
|
|
15
|
-
coerce:
|
|
17
|
+
coerce: _yargs.coerceToArray,
|
|
16
18
|
})
|
|
17
19
|
.option('debug', {
|
|
18
20
|
describe: 'Set log level to debug',
|
|
@@ -28,8 +30,8 @@ export function buildForSearch(yargs) {
|
|
|
28
30
|
describe: 'Filter query',
|
|
29
31
|
})
|
|
30
32
|
.option('fl', {
|
|
31
|
-
type: '
|
|
32
|
-
coerce:
|
|
33
|
+
type: 'string',
|
|
34
|
+
coerce: _yargs.coerceToArray,
|
|
33
35
|
describe: 'Fields to return',
|
|
34
36
|
})
|
|
35
37
|
.option('rows', {
|
package/package.json
CHANGED
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"simonpai <simon.pai@askmiso.com>"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@miso.ai/server-commons": "0.6.
|
|
19
|
+
"@miso.ai/server-commons": "0.6.6-beta.1",
|
|
20
20
|
"axios": "^1.6.2",
|
|
21
21
|
"axios-retry": "^4.5.0",
|
|
22
22
|
"dotenv": "^16.0.1",
|
|
23
23
|
"split2": "^4.1.0",
|
|
24
24
|
"yargs": "^17.5.1"
|
|
25
25
|
},
|
|
26
|
-
"version": "0.6.
|
|
26
|
+
"version": "0.6.6-beta.1"
|
|
27
27
|
}
|
package/src/axios.js
CHANGED
|
@@ -3,11 +3,15 @@ import axiosRetry from 'axios-retry';
|
|
|
3
3
|
import version from './version.js';
|
|
4
4
|
|
|
5
5
|
const DEFAULT_RETRY_OPTIONS = {
|
|
6
|
-
retries:
|
|
7
|
-
retryDelay: count => count *
|
|
6
|
+
retries: 5,
|
|
7
|
+
retryDelay: count => count * 500,
|
|
8
8
|
retryCondition: (error) => {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
if (!error.response) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const { status } = error.response;
|
|
13
|
+
// Only retry on 5xx or 429 server errors
|
|
14
|
+
return (status >= 500 && status < 600) || status === 429;
|
|
11
15
|
},
|
|
12
16
|
};
|
|
13
17
|
|
package/src/stream/api-sink.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { sink, trimObj } from '@miso.ai/server-commons';
|
|
2
2
|
import ServiceStats from './service-stats.js';
|
|
3
3
|
|
|
4
|
+
function shimOptions({ requestsPerSecond, ...options }) {
|
|
5
|
+
return {
|
|
6
|
+
...options,
|
|
7
|
+
writesPerSecond: requestsPerSecond,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
4
11
|
export default class ApiSink extends sink.BpsSink {
|
|
5
12
|
|
|
6
13
|
constructor(client, options) {
|
|
7
|
-
super(options);
|
|
14
|
+
super(shimOptions(options));
|
|
8
15
|
this._client = client;
|
|
9
16
|
this._serviceStats = new ServiceStats();
|
|
10
17
|
}
|
package/src/stream/upload.js
CHANGED
|
@@ -15,6 +15,7 @@ export default class UploadStream extends stream.BufferedWriteStream {
|
|
|
15
15
|
dryRun,
|
|
16
16
|
params,
|
|
17
17
|
experimentId,
|
|
18
|
+
requestsPerSecond,
|
|
18
19
|
recordsPerSecond,
|
|
19
20
|
bytesPerSecond,
|
|
20
21
|
// buffer
|
|
@@ -38,6 +39,7 @@ export default class UploadStream extends stream.BufferedWriteStream {
|
|
|
38
39
|
dryRun,
|
|
39
40
|
params,
|
|
40
41
|
experimentId,
|
|
42
|
+
requestsPerSecond,
|
|
41
43
|
recordsPerSecond,
|
|
42
44
|
bytesPerSecond,
|
|
43
45
|
});
|
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '0.6.
|
|
1
|
+
export default '0.6.6-beta.1';
|