* Get the models to benchmark for the day running the script. (All models are * spilted to n buckets and n === period, associated with the date of the month, * and the function returns a certain bucket.) * * @param models The models to schedule. * @param period The period to run all models. *
(models, period, date = new Date().getDate())
| 442 | * benchmark. By default, the date would be the date at runtime. |
| 443 | */ |
| 444 | function scheduleModels(models, period, date = new Date().getDate()) { |
| 445 | if (period < 1 || period > 31) { |
| 446 | throw new Error('--period must be an integer of 1~31.'); |
| 447 | } |
| 448 | if (date <= 0 || date > 31) { |
| 449 | throw new Error('--date must be an integer of 1~31.'); |
| 450 | } |
| 451 | date = (date - 1) % period; |
| 452 | const bucketSize = Math.ceil(models.length / period); |
| 453 | return models.slice(date * bucketSize, (date + 1) * bucketSize); |
| 454 | } |
| 455 | |
| 456 | /** |
| 457 | * Runs a benchmark with a preconfigured file |
no test coverage detected
searching dependent graphs…