limit status batch size
This commit is contained in:
parent
2c988b8a16
commit
2faac57b93
|
@ -656,6 +656,8 @@ def job_cancel(server: ServerContext, pool: DevicePoolExecutor):
|
||||||
|
|
||||||
if len(job_list) == 0:
|
if len(job_list) == 0:
|
||||||
return error_reply("at least one job name is required")
|
return error_reply("at least one job name is required")
|
||||||
|
elif len(job_list) > 10:
|
||||||
|
return error_reply("too many jobs")
|
||||||
|
|
||||||
results: List[Dict[str, str]] = []
|
results: List[Dict[str, str]] = []
|
||||||
for job_name in job_list:
|
for job_name in job_list:
|
||||||
|
@ -680,6 +682,8 @@ def job_status(server: ServerContext, pool: DevicePoolExecutor):
|
||||||
|
|
||||||
if len(job_list) == 0:
|
if len(job_list) == 0:
|
||||||
return error_reply("at least one job name is required")
|
return error_reply("at least one job name is required")
|
||||||
|
elif len(job_list) > 10:
|
||||||
|
return error_reply("too many jobs")
|
||||||
|
|
||||||
records = []
|
records = []
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* eslint-disable max-lines */
|
/* eslint-disable max-lines */
|
||||||
import { doesExist, InvalidArgumentError, Maybe } from '@apextoaster/js-utils';
|
import { doesExist, InvalidArgumentError, Maybe } from '@apextoaster/js-utils';
|
||||||
import { create as batcher, keyResolver, windowScheduler } from '@yornaath/batshit';
|
import { create as batcher, keyResolver, windowScheduler, windowedFiniteBatchScheduler } from '@yornaath/batshit';
|
||||||
|
|
||||||
import { ServerParams } from '../config.js';
|
import { ServerParams } from '../config.js';
|
||||||
import { FIXED_FLOAT, FIXED_INTEGER, STATUS_SUCCESS } from '../constants.js';
|
import { FIXED_FLOAT, FIXED_INTEGER, STATUS_SUCCESS } from '../constants.js';
|
||||||
|
@ -505,7 +505,10 @@ export function makeClient(root: string, batchInterval: number, token: Maybe<str
|
||||||
const batchStatus = batcher({
|
const batchStatus = batcher({
|
||||||
fetcher: async (jobs: Array<string>) => client.status(jobs),
|
fetcher: async (jobs: Array<string>) => client.status(jobs),
|
||||||
resolver: keyResolver('name'),
|
resolver: keyResolver('name'),
|
||||||
scheduler: windowScheduler(batchInterval),
|
scheduler: windowedFiniteBatchScheduler({
|
||||||
|
windowMs: batchInterval,
|
||||||
|
maxBatchSize: 10,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue