@lage-run/scheduler 0.3.6 → 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 +45 -3
- package/CHANGELOG.md +20 -2
- package/lib/createCachedOutputTransform.d.ts +1 -1
- package/lib/createCachedOutputTransform.js +11 -11
- package/lib/createCachedOutputTransform.js.map +1 -1
- 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,49 @@
|
|
|
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",
|
|
27
|
+
"tag": "@lage-run/scheduler_v0.3.7",
|
|
28
|
+
"version": "0.3.7",
|
|
29
|
+
"comments": {
|
|
30
|
+
"patch": [
|
|
31
|
+
{
|
|
32
|
+
"author": "kchau@microsoft.com",
|
|
33
|
+
"package": "@lage-run/scheduler",
|
|
34
|
+
"commit": "a86ba91c06d5ede0916e84633896324ea30aaf07",
|
|
35
|
+
"comment": "get rid of \"node:\""
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"author": "beachball",
|
|
39
|
+
"package": "@lage-run/scheduler",
|
|
40
|
+
"comment": "Bump @lage-run/worker-threads-pool to v0.1.3",
|
|
41
|
+
"commit": "a86ba91c06d5ede0916e84633896324ea30aaf07"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"date": "Thu, 29 Sep 2022 21:54:45 GMT",
|
|
6
48
|
"tag": "@lage-run/scheduler_v0.3.6",
|
|
7
49
|
"version": "0.3.6",
|
|
8
50
|
"comments": {
|
|
@@ -17,13 +59,13 @@
|
|
|
17
59
|
"author": "beachball",
|
|
18
60
|
"package": "@lage-run/scheduler",
|
|
19
61
|
"comment": "Bump @lage-run/target-graph to v0.3.4",
|
|
20
|
-
"commit": "
|
|
62
|
+
"commit": "8fc978626144db852c6a908cb0e4bcfebc51f1c2"
|
|
21
63
|
},
|
|
22
64
|
{
|
|
23
65
|
"author": "beachball",
|
|
24
66
|
"package": "@lage-run/scheduler",
|
|
25
67
|
"comment": "Bump @lage-run/cache to v0.1.12",
|
|
26
|
-
"commit": "
|
|
68
|
+
"commit": "8fc978626144db852c6a908cb0e4bcfebc51f1c2"
|
|
27
69
|
}
|
|
28
70
|
]
|
|
29
71
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
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
|
+
|
|
16
|
+
## 0.3.7
|
|
17
|
+
|
|
18
|
+
Fri, 30 Sep 2022 23:00:17 GMT
|
|
19
|
+
|
|
20
|
+
### Patches
|
|
21
|
+
|
|
22
|
+
- get rid of "node:" (kchau@microsoft.com)
|
|
23
|
+
- Bump @lage-run/worker-threads-pool to v0.1.3
|
|
24
|
+
|
|
7
25
|
## 0.3.6
|
|
8
26
|
|
|
9
|
-
Thu, 29 Sep 2022 21:54:
|
|
27
|
+
Thu, 29 Sep 2022 21:54:45 GMT
|
|
10
28
|
|
|
11
29
|
### Patches
|
|
12
30
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { Target } from "@lage-run/target-graph";
|
|
3
|
-
import { Transform } from "
|
|
3
|
+
import { Transform } from "stream";
|
|
4
4
|
export declare function getLageOutputCacheLocation(target: Target, hash: string): string;
|
|
5
5
|
export declare function createCachedOutputTransform(target: Target, hash: string): Transform;
|
|
@@ -4,21 +4,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createCachedOutputTransform = exports.getLageOutputCacheLocation = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const stream_1 = require("stream");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
10
|
function getLageOutputCacheLocation(target, hash) {
|
|
11
|
-
const outputPath =
|
|
12
|
-
return
|
|
11
|
+
const outputPath = path_1.default.join(target.cwd, "node_modules/.cache/lage/output/");
|
|
12
|
+
return path_1.default.join(outputPath, hash + ".txt");
|
|
13
13
|
}
|
|
14
14
|
exports.getLageOutputCacheLocation = getLageOutputCacheLocation;
|
|
15
15
|
function createCachedOutputTransform(target, hash) {
|
|
16
16
|
const outputFile = getLageOutputCacheLocation(target, hash);
|
|
17
|
-
const outputPath =
|
|
18
|
-
if (!
|
|
19
|
-
|
|
20
|
-
const writeStream =
|
|
21
|
-
const transform = new
|
|
17
|
+
const outputPath = path_1.default.dirname(outputFile);
|
|
18
|
+
if (!fs_1.default.existsSync(outputFile)) {
|
|
19
|
+
fs_1.default.mkdirSync(outputPath, { recursive: true });
|
|
20
|
+
const writeStream = fs_1.default.createWriteStream(path_1.default.join(outputPath, hash + ".txt"));
|
|
21
|
+
const transform = new stream_1.Transform({
|
|
22
22
|
transform(chunk, encoding, callback) {
|
|
23
23
|
writeStream.write(chunk);
|
|
24
24
|
callback(null, chunk);
|
|
@@ -26,7 +26,7 @@ function createCachedOutputTransform(target, hash) {
|
|
|
26
26
|
});
|
|
27
27
|
return transform;
|
|
28
28
|
}
|
|
29
|
-
const transform = new
|
|
29
|
+
const transform = new stream_1.Transform({
|
|
30
30
|
transform(chunk, encoding, callback) {
|
|
31
31
|
callback(null, chunk);
|
|
32
32
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCachedOutputTransform.js","sourceRoot":"","sources":["../src/createCachedOutputTransform.ts"],"names":[],"mappings":";;;;;;AACA,
|
|
1
|
+
{"version":3,"file":"createCachedOutputTransform.js","sourceRoot":"","sources":["../src/createCachedOutputTransform.ts"],"names":[],"mappings":";;;;;;AACA,mCAAmC;AACnC,4CAAoB;AACpB,gDAAwB;AAExB,SAAgB,0BAA0B,CAAC,MAAc,EAAE,IAAY;IACrE,MAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,kCAAkC,CAAC,CAAC;IAC7E,OAAO,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,GAAG,MAAM,CAAC,CAAC;AAC9C,CAAC;AAHD,gEAGC;AAED,SAAgB,2BAA2B,CAAC,MAAc,EAAE,IAAY;IACtE,MAAM,UAAU,GAAG,0BAA0B,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC5D,MAAM,UAAU,GAAG,cAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAE5C,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;QAC9B,YAAE,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9C,MAAM,WAAW,GAAG,YAAE,CAAC,iBAAiB,CAAC,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC;QAE/E,MAAM,SAAS,GAAG,IAAI,kBAAS,CAAC;YAC9B,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ;gBACjC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACzB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACxB,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,SAAS,GAAG,IAAI,kBAAS,CAAC;QAC9B,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ;YACjC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACxB,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC;AAzBD,kEAyBC"}
|
|
@@ -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,uEAA2D;AAC3D,4CAAoB;AAqBpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAa,YAAY;IAKvB,YAAoB,OAA4B;QAA5B,YAAO,GAAP,OAAO,CAAqB;QAJxC,UAAK,GAA+B,EAAE,CAAC;IAII,CAAC;IAEpD,cAAc,CAAC,MAAc;;QAC3B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QACxB,MAAM,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7C,IAAI,EAAE,GAAG,EAAE,CAAC;QACZ,IAAI,OAAO,GAAwB,EAAE,CAAC;QACtC,IAAI,MAAM,GAAG,EAAE,CAAC;QAEhB,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;YAClC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;YACf,MAAM,GAAG,MAAA,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,0CAAE,MAAM,CAAC;YACxD,OAAO,GAAG,MAAA,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,mCAAI,EAAE,CAAC;SACxD;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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",
|