@lage-run/scheduler 0.3.7 → 0.3.8
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 +22 -1
- package/CHANGELOG.md +11 -2
- package/lib/runners/WorkerRunner.d.ts +2 -1
- package/lib/runners/WorkerRunner.js +17 -11
- package/lib/runners/WorkerRunner.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,28 @@
|
|
|
2
2
|
"name": "@lage-run/scheduler",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Sat, 01 Oct 2022 05:25:19 GMT",
|
|
6
|
+
"tag": "@lage-run/scheduler_v0.3.8",
|
|
7
|
+
"version": "0.3.8",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "ken@gizzar.com",
|
|
12
|
+
"package": "@lage-run/scheduler",
|
|
13
|
+
"commit": "e850f24b770908df902212442baa5fb8ba04cf7c",
|
|
14
|
+
"comment": "adds a stdio capture inside workerpool"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@lage-run/scheduler",
|
|
19
|
+
"comment": "Bump @lage-run/worker-threads-pool to v0.1.4",
|
|
20
|
+
"commit": "e850f24b770908df902212442baa5fb8ba04cf7c"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"date": "Fri, 30 Sep 2022 23:00:17 GMT",
|
|
6
27
|
"tag": "@lage-run/scheduler_v0.3.7",
|
|
7
28
|
"version": "0.3.7",
|
|
8
29
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
# Change Log - @lage-run/scheduler
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Sat, 01 Oct 2022 05:25:19 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.3.8
|
|
8
|
+
|
|
9
|
+
Sat, 01 Oct 2022 05:25:19 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- adds a stdio capture inside workerpool (ken@gizzar.com)
|
|
14
|
+
- Bump @lage-run/worker-threads-pool to v0.1.4
|
|
15
|
+
|
|
7
16
|
## 0.3.7
|
|
8
17
|
|
|
9
|
-
Fri, 30 Sep 2022 23:00:
|
|
18
|
+
Fri, 30 Sep 2022 23:00:17 GMT
|
|
10
19
|
|
|
11
20
|
### Patches
|
|
12
21
|
|
|
@@ -5,6 +5,7 @@ import type { Logger } from "@lage-run/logger";
|
|
|
5
5
|
import type { Target, TargetConfig } from "@lage-run/target-graph";
|
|
6
6
|
import type { TargetRunner } from "../types/TargetRunner";
|
|
7
7
|
import type { Worker } from "worker_threads";
|
|
8
|
+
import type { Readable } from "stream";
|
|
8
9
|
export interface WorkerRunnerOptions {
|
|
9
10
|
logger: Logger;
|
|
10
11
|
workerTargetConfigs: Record<string, TargetConfig>;
|
|
@@ -55,7 +56,7 @@ export declare class WorkerRunner implements TargetRunner {
|
|
|
55
56
|
constructor(options: WorkerRunnerOptions);
|
|
56
57
|
getPoolOptions(target: Target): PoolOptions;
|
|
57
58
|
ensurePool(poolOptions: PoolOptions): WorkerPool;
|
|
58
|
-
captureStream(target: Target,
|
|
59
|
+
captureStream(target: Target, _worker?: Worker, stdout?: Readable, stderr?: Readable): () => void;
|
|
59
60
|
run(target: Target, abortSignal?: AbortSignal): Promise<void>;
|
|
60
61
|
cleanup(): Promise<void>;
|
|
61
62
|
}
|
|
@@ -84,18 +84,24 @@ class WorkerRunner {
|
|
|
84
84
|
}
|
|
85
85
|
return this.pools[id];
|
|
86
86
|
}
|
|
87
|
-
captureStream(target,
|
|
87
|
+
captureStream(target, _worker, stdout, stderr) {
|
|
88
88
|
const { logger } = this.options;
|
|
89
|
-
const stdout = worker.stdout;
|
|
90
|
-
const stderr = worker.stderr;
|
|
91
89
|
const onData = (data) => logger.log(logger_1.LogLevel.info, data, { target });
|
|
92
|
-
stdout
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
if (stdout) {
|
|
91
|
+
stdout.setEncoding("utf-8");
|
|
92
|
+
stdout.on("data", onData);
|
|
93
|
+
}
|
|
94
|
+
if (stderr) {
|
|
95
|
+
stderr.setEncoding("utf-8");
|
|
96
|
+
stderr.on("data", onData);
|
|
97
|
+
}
|
|
96
98
|
return () => {
|
|
97
|
-
stdout
|
|
98
|
-
|
|
99
|
+
if (stdout) {
|
|
100
|
+
stdout.off("data", onData);
|
|
101
|
+
}
|
|
102
|
+
if (stderr) {
|
|
103
|
+
stderr.off("data", onData);
|
|
104
|
+
}
|
|
99
105
|
};
|
|
100
106
|
}
|
|
101
107
|
async run(target, abortSignal) {
|
|
@@ -112,8 +118,8 @@ class WorkerRunner {
|
|
|
112
118
|
const poolOptions = this.getPoolOptions(target);
|
|
113
119
|
const pool = this.ensurePool(poolOptions);
|
|
114
120
|
let cleanupStreams;
|
|
115
|
-
await pool.exec({ target }, (worker) => {
|
|
116
|
-
cleanupStreams = this.captureStream(target, worker);
|
|
121
|
+
await pool.exec({ target }, (worker, stdout, stderr) => {
|
|
122
|
+
cleanupStreams = this.captureStream(target, worker, stdout, stderr);
|
|
117
123
|
}, () => {
|
|
118
124
|
cleanupStreams();
|
|
119
125
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkerRunner.js","sourceRoot":"","sources":["../../src/runners/WorkerRunner.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA4C;AAC5C,uEAA2D;AAC3D,4CAAoB;
|
|
1
|
+
{"version":3,"file":"WorkerRunner.js","sourceRoot":"","sources":["../../src/runners/WorkerRunner.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA4C;AAC5C,u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WAAyB;QACjD,IAAI,WAAW,EAAE;YACf,IAAI,WAAW,CAAC,OAAO,EAAE;gBACvB,OAAO;aACR;YAED,MAAM,kBAAkB,GAAG,GAAG,EAAE;gBAC9B,WAAW,CAAC,mBAAmB,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;gBAC7D,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,CAAC,CAAC;YAEF,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;SAC3D;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAChD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC1C,IAAI,cAA0B,CAAC;QAE/B,MAAM,IAAI,CAAC,IAAI,CACb,EAAE,MAAM,EAAE,EACV,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACzB,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACtE,CAAC,EACD,GAAG,EAAE;YACH,cAAc,EAAE,CAAC;QACnB,CAAC,CACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,OAAO;QACX,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YAC5C,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;SACpB;IACH,CAAC;;AA/GH,oCAgHC;AA7GQ,gCAAmB,GAAG,IAAI,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lage-run/scheduler",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8",
|
|
4
4
|
"description": "Scheduler for Lage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/microsoft/lage"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@lage-run/target-graph": "^0.3.4",
|
|
19
19
|
"@lage-run/logger": "^1.2.0",
|
|
20
20
|
"@lage-run/cache": "^0.1.12",
|
|
21
|
-
"@lage-run/worker-threads-pool": "^0.1.
|
|
21
|
+
"@lage-run/worker-threads-pool": "^0.1.4",
|
|
22
22
|
"p-graph": "^1.1.1",
|
|
23
23
|
"p-profiler": "^0.2.1",
|
|
24
24
|
"abort-controller": "^3.0.0",
|