@lage-run/scheduler 0.7.1 → 0.7.2
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/CHANGELOG.json +16 -1
- package/CHANGELOG.md +10 -2
- package/lib/SimpleScheduler.d.ts +1 -0
- package/lib/SimpleScheduler.js +11 -0
- package/lib/WrappedTarget.js +1 -2
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,22 @@
|
|
|
2
2
|
"name": "@lage-run/scheduler",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Thu, 08 Dec 2022 00:49:16 GMT",
|
|
6
|
+
"tag": "@lage-run/scheduler_v0.7.2",
|
|
7
|
+
"version": "0.7.2",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "kchau@microsoft.com",
|
|
12
|
+
"package": "@lage-run/scheduler",
|
|
13
|
+
"commit": "ad281dfe8b222d949130821828a680d1c3625154",
|
|
14
|
+
"comment": "sets the default to progress"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Tue, 06 Dec 2022 00:48:02 GMT",
|
|
6
21
|
"tag": "@lage-run/scheduler_v0.7.1",
|
|
7
22
|
"version": "0.7.1",
|
|
8
23
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
# Change Log - @lage-run/scheduler
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 08 Dec 2022 00:49:16 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.7.2
|
|
8
|
+
|
|
9
|
+
Thu, 08 Dec 2022 00:49:16 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- sets the default to progress (kchau@microsoft.com)
|
|
14
|
+
|
|
7
15
|
## 0.7.1
|
|
8
16
|
|
|
9
|
-
Tue, 06 Dec 2022 00:
|
|
17
|
+
Tue, 06 Dec 2022 00:48:02 GMT
|
|
10
18
|
|
|
11
19
|
### Patches
|
|
12
20
|
|
package/lib/SimpleScheduler.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export declare class SimpleScheduler implements TargetScheduler {
|
|
|
40
40
|
abortController: AbortController;
|
|
41
41
|
abortSignal: AbortSignal;
|
|
42
42
|
pool: Pool;
|
|
43
|
+
workerIds: number[];
|
|
43
44
|
runPromise: Promise<any>;
|
|
44
45
|
constructor(options: SimpleSchedulerOptions);
|
|
45
46
|
getTargetsByPriority(): import("@lage-run/target-graph").Target[];
|
package/lib/SimpleScheduler.js
CHANGED
|
@@ -45,6 +45,11 @@ class SimpleScheduler {
|
|
|
45
45
|
*/ async run(root, targetGraph, shouldRerun = false) {
|
|
46
46
|
const startTime = process.hrtime();
|
|
47
47
|
const { continueOnError , logger , cacheProvider , shouldCache , shouldResetCache , hasher } = this.options;
|
|
48
|
+
logger.verbose("", {
|
|
49
|
+
schedulerRun: {
|
|
50
|
+
startTime
|
|
51
|
+
}
|
|
52
|
+
});
|
|
48
53
|
const { pool , abortController } = this;
|
|
49
54
|
const { targets } = targetGraph;
|
|
50
55
|
for (const target of targets.values()){
|
|
@@ -175,6 +180,7 @@ class SimpleScheduler {
|
|
|
175
180
|
...this.targetRuns.values()
|
|
176
181
|
].filter((t)=>!t.target.hidden).length;
|
|
177
182
|
this.options.logger.verbose("", {
|
|
183
|
+
poolStats: this.pool.stats(),
|
|
178
184
|
progress: {
|
|
179
185
|
waiting: targetRunByStatus.pending.length + targetRunByStatus.queued.length,
|
|
180
186
|
completed: targetRunByStatus.aborted.length + targetRunByStatus.failed.length + targetRunByStatus.skipped.length + targetRunByStatus.success.length,
|
|
@@ -214,10 +220,13 @@ class SimpleScheduler {
|
|
|
214
220
|
},
|
|
215
221
|
workerIdleMemoryLimit: options.workerIdleMemoryLimit
|
|
216
222
|
});
|
|
223
|
+
this.workerIds = Array(options.concurrency).fill(0).map((_, idx)=>idx + 1);
|
|
217
224
|
}
|
|
218
225
|
}
|
|
219
226
|
async function generateTargetRunPromise(target) {
|
|
220
227
|
let runError;
|
|
228
|
+
const threadId = this.workerIds.shift();
|
|
229
|
+
target.threadId = threadId;
|
|
221
230
|
if (target.result && target.successful && !this.rerunTargets.has(target.target.id)) {
|
|
222
231
|
await target.result;
|
|
223
232
|
} else {
|
|
@@ -239,6 +248,8 @@ async function generateTargetRunPromise(target) {
|
|
|
239
248
|
}
|
|
240
249
|
}
|
|
241
250
|
}
|
|
251
|
+
this.workerIds.unshift(threadId);
|
|
252
|
+
this.workerIds.sort();
|
|
242
253
|
this.logProgress();
|
|
243
254
|
// finally do another round of scheduling to run next round of targets
|
|
244
255
|
await this.scheduleReadyTargets();
|
package/lib/WrappedTarget.js
CHANGED
|
@@ -192,8 +192,7 @@ class WrappedTarget {
|
|
|
192
192
|
const bufferStderr = (0, _bufferTransformJs.bufferTransform)();
|
|
193
193
|
this.result = pool.exec({
|
|
194
194
|
target
|
|
195
|
-
}, target.weight ?? 1, (
|
|
196
|
-
this.threadId = worker.threadId;
|
|
195
|
+
}, target.weight ?? 1, (_worker, stdout, stderr)=>{
|
|
197
196
|
this.onStart();
|
|
198
197
|
stdout.pipe(bufferStdout.transform);
|
|
199
198
|
stderr.pipe(bufferStderr.transform);
|