@lage-run/scheduler 0.7.2 → 0.7.3

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 CHANGED
@@ -2,7 +2,22 @@
2
2
  "name": "@lage-run/scheduler",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 08 Dec 2022 00:49:16 GMT",
5
+ "date": "Thu, 05 Jan 2023 00:40:39 GMT",
6
+ "tag": "@lage-run/scheduler_v0.7.3",
7
+ "version": "0.7.3",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "kchau@microsoft.com",
12
+ "package": "@lage-run/scheduler",
13
+ "commit": "961843bef658c51312e02498554ad338e467e1a7",
14
+ "comment": "fixing progress bar to not be a bottleneck"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Thu, 08 Dec 2022 00:49:28 GMT",
6
21
  "tag": "@lage-run/scheduler_v0.7.2",
7
22
  "version": "0.7.2",
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 Thu, 08 Dec 2022 00:49:16 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 05 Jan 2023 00:40:39 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.7.3
8
+
9
+ Thu, 05 Jan 2023 00:40:39 GMT
10
+
11
+ ### Patches
12
+
13
+ - fixing progress bar to not be a bottleneck (kchau@microsoft.com)
14
+
7
15
  ## 0.7.2
8
16
 
9
- Thu, 08 Dec 2022 00:49:16 GMT
17
+ Thu, 08 Dec 2022 00:49:28 GMT
10
18
 
11
19
  ### Patches
12
20
 
@@ -40,7 +40,6 @@ export declare class SimpleScheduler implements TargetScheduler {
40
40
  abortController: AbortController;
41
41
  abortSignal: AbortSignal;
42
42
  pool: Pool;
43
- workerIds: number[];
44
43
  runPromise: Promise<any>;
45
44
  constructor(options: SimpleSchedulerOptions);
46
45
  getTargetsByPriority(): import("@lage-run/target-graph").Target[];
@@ -220,13 +220,10 @@ class SimpleScheduler {
220
220
  },
221
221
  workerIdleMemoryLimit: options.workerIdleMemoryLimit
222
222
  });
223
- this.workerIds = Array(options.concurrency).fill(0).map((_, idx)=>idx + 1);
224
223
  }
225
224
  }
226
225
  async function generateTargetRunPromise(target) {
227
226
  let runError;
228
- const threadId = this.workerIds.shift();
229
- target.threadId = threadId;
230
227
  if (target.result && target.successful && !this.rerunTargets.has(target.target.id)) {
231
228
  await target.result;
232
229
  } else {
@@ -248,8 +245,6 @@ async function generateTargetRunPromise(target) {
248
245
  }
249
246
  }
250
247
  }
251
- this.workerIds.unshift(threadId);
252
- this.workerIds.sort();
253
248
  this.logProgress();
254
249
  // finally do another round of scheduling to run next round of targets
255
250
  await this.scheduleReadyTargets();
@@ -43,7 +43,7 @@ export declare class WrappedTarget implements TargetRun {
43
43
  constructor(options: WrappedTargetOptions);
44
44
  onQueued(): void;
45
45
  onAbort(): void;
46
- onStart(): void;
46
+ onStart(threadId: number): void;
47
47
  onComplete(): void;
48
48
  onFail(): void;
49
49
  onSkipped(hash: string | null): void;
@@ -37,27 +37,27 @@ class WrappedTarget {
37
37
  onAbort() {
38
38
  this.status = "aborted";
39
39
  this.duration = process.hrtime(this.startTime);
40
- this.options.logger.info("aborted", {
40
+ this.options.logger.info("", {
41
41
  target: this.target,
42
42
  status: "aborted",
43
43
  threadId: this.threadId
44
44
  });
45
45
  }
46
- onStart() {
46
+ onStart(threadId) {
47
47
  if (this.status !== "running") {
48
48
  this.status = "running";
49
49
  this.startTime = process.hrtime();
50
- this.options.logger.info("running", {
50
+ this.options.logger.info("", {
51
51
  target: this.target,
52
52
  status: "running",
53
- threadId: this.threadId
53
+ threadId
54
54
  });
55
55
  }
56
56
  }
57
57
  onComplete() {
58
58
  this.status = "success";
59
59
  this.duration = process.hrtime(this.startTime);
60
- this.options.logger.info("success", {
60
+ this.options.logger.info("", {
61
61
  target: this.target,
62
62
  status: "success",
63
63
  duration: this.duration,
@@ -67,7 +67,7 @@ class WrappedTarget {
67
67
  onFail() {
68
68
  this.status = "failed";
69
69
  this.duration = process.hrtime(this.startTime);
70
- this.options.logger.info("failed", {
70
+ this.options.logger.info("", {
71
71
  target: this.target,
72
72
  status: "failed",
73
73
  duration: this.duration,
@@ -80,7 +80,7 @@ class WrappedTarget {
80
80
  onSkipped(hash) {
81
81
  this.status = "skipped";
82
82
  this.duration = process.hrtime(this.startTime);
83
- this.options.logger.info(`skipped`, {
83
+ this.options.logger.info("", {
84
84
  target: this.target,
85
85
  status: "skipped",
86
86
  duration: this.duration,
@@ -123,7 +123,7 @@ class WrappedTarget {
123
123
  this.onQueued();
124
124
  const abortSignal = abortController.signal;
125
125
  if (abortSignal.aborted) {
126
- this.onStart();
126
+ this.onStart(0);
127
127
  this.onAbort();
128
128
  return;
129
129
  }
@@ -135,7 +135,7 @@ class WrappedTarget {
135
135
  logger.verbose(`hash: ${hash}, cache hit? ${cacheHit}`, {
136
136
  target
137
137
  });
138
- this.onStart();
138
+ this.onStart(0);
139
139
  const cachedOutputFile = (0, _getLageOutputCacheLocationJs.getLageOutputCacheLocation)(this.target, hash ?? "");
140
140
  if (_fs.default.existsSync(cachedOutputFile)) {
141
141
  const cachedOutput = _fs.default.createReadStream(cachedOutputFile, "utf8");
@@ -192,13 +192,14 @@ class WrappedTarget {
192
192
  const bufferStderr = (0, _bufferTransformJs.bufferTransform)();
193
193
  this.result = pool.exec({
194
194
  target
195
- }, target.weight ?? 1, (_worker, stdout, stderr)=>{
196
- this.onStart();
195
+ }, target.weight ?? 1, (worker, stdout, stderr)=>{
196
+ const threadId = worker.threadId;
197
+ this.onStart(threadId);
197
198
  stdout.pipe(bufferStdout.transform);
198
199
  stderr.pipe(bufferStderr.transform);
199
200
  const releaseStdoutStream = logger.stream(_logger.LogLevel.verbose, stdout, {
200
201
  target,
201
- threadId: this.threadId
202
+ threadId
202
203
  });
203
204
  releaseStdout = ()=>{
204
205
  releaseStdoutStream();
@@ -206,7 +207,7 @@ class WrappedTarget {
206
207
  };
207
208
  const releaseStderrStream = logger.stream(_logger.LogLevel.verbose, stderr, {
208
209
  target,
209
- threadId: this.threadId
210
+ threadId
210
211
  });
211
212
  releaseStderr = ()=>{
212
213
  releaseStderrStream();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lage-run/scheduler",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Scheduler for Lage",
5
5
  "repository": {
6
6
  "url": "https://github.com/microsoft/lage"