UNPKG

1.79 kBTypeScriptView Raw
1import { Config } from './config';
2export interface Task {
3 capabilities: any;
4 specs: Array<string>;
5 taskId: string;
6 done: any;
7}
8/**
9 * The taskScheduler keeps track of the spec files that needs to run next
10 * and which task is running what.
11 */
12export declare class TaskQueue {
13 capabilities: any;
14 specLists: any;
15 numRunningInstances: number;
16 maxInstance: number;
17 specsIndex: number;
18 constructor(capabilities: any, specLists: any);
19}
20export declare class TaskScheduler {
21 private config;
22 taskQueues: Array<TaskQueue>;
23 rotationIndex: number;
24 /**
25 * A scheduler to keep track of specs that need running and their associated
26 * capabilities. It will suggest a task (combination of capabilities and spec)
27 * to run while observing the following config rules:
28 * multiCapabilities, shardTestFiles, and maxInstance.
29 * Precondition: multiCapabilities is a non-empty array
30 * (capabilities and getCapabilities will both be ignored)
31 *
32 * @constructor
33 * @param {Object} config parsed from the config file
34 */
35 constructor(config: Config);
36 /**
37 * Get the next task that is allowed to run without going over maxInstance.
38 *
39 * @return {{capabilities: Object, specs: Array.<string>, taskId: string,
40 * done: function()}}
41 */
42 nextTask(): Task;
43 /**
44 * Get the number of tasks left to run or are currently running.
45 *
46 * @return {number}
47 */
48 numTasksOutstanding(): number;
49 /**
50 * Get maximum number of concurrent tasks required/permitted.
51 *
52 * @return {number}
53 */
54 maxConcurrentTasks(): number;
55 /**
56 * Returns number of tasks currently running.
57 *
58 * @return {number}
59 */
60 countActiveTasks(): number;
61}