@lage-run/reporters 1.0.6 → 1.1.0

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,37 @@
2
2
  "name": "@lage-run/reporters",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 14 Mar 2023 00:28:17 GMT",
5
+ "date": "Sat, 01 Apr 2023 00:28:19 GMT",
6
+ "tag": "@lage-run/reporters_v1.1.0",
7
+ "version": "1.1.0",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "author": "kchau@microsoft.com",
12
+ "package": "@lage-run/reporters",
13
+ "commit": "884c8b5aba15cd1cc5f943c06a6a9da4af20f806",
14
+ "comment": "replace ink with @ms-cloudpack/task-reporter"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Wed, 29 Mar 2023 22:41:49 GMT",
21
+ "tag": "@lage-run/reporters_v1.0.7",
22
+ "version": "1.0.7",
23
+ "comments": {
24
+ "patch": [
25
+ {
26
+ "author": "beachball",
27
+ "package": "@lage-run/reporters",
28
+ "comment": "Bump @lage-run/scheduler-types to v0.3.5",
29
+ "commit": "ec458f83e5adb784019efaa06f902ec75f85990c"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ {
35
+ "date": "Tue, 14 Mar 2023 00:28:38 GMT",
6
36
  "tag": "@lage-run/reporters_v1.0.6",
7
37
  "version": "1.0.6",
8
38
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,28 @@
1
1
  # Change Log - @lage-run/reporters
2
2
 
3
- This log was last generated on Tue, 14 Mar 2023 00:28:17 GMT and should not be manually modified.
3
+ This log was last generated on Sat, 01 Apr 2023 00:28:19 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.1.0
8
+
9
+ Sat, 01 Apr 2023 00:28:19 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - replace ink with @ms-cloudpack/task-reporter (kchau@microsoft.com)
14
+
15
+ ## 1.0.7
16
+
17
+ Wed, 29 Mar 2023 22:41:49 GMT
18
+
19
+ ### Patches
20
+
21
+ - Bump @lage-run/scheduler-types to v0.3.5
22
+
7
23
  ## 1.0.6
8
24
 
9
- Tue, 14 Mar 2023 00:28:17 GMT
25
+ Tue, 14 Mar 2023 00:28:38 GMT
10
26
 
11
27
  ### Patches
12
28
 
@@ -79,10 +79,6 @@ function normalize(prefixOrMessage, message) {
79
79
  };
80
80
  }
81
81
  }
82
- function getQueueDuration(queueTime, startTime) {
83
- const queueDuration = (0, _formatHrtime.hrtimeDiff)(queueTime, startTime);
84
- return (0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(queueDuration));
85
- }
86
82
  class LogReporter {
87
83
  log(entry) {
88
84
  // if "hidden", do not even attempt to record or report the entry
@@ -1,14 +1,25 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import EventEmitter from "events";
3
- import type { LogEntry, Reporter } from "@lage-run/logger";
4
+ import { type LogEntry, type Reporter } from "@lage-run/logger";
4
5
  import type { SchedulerRunSummary } from "@lage-run/scheduler-types";
6
+ import { TaskReporter, type TaskReporterTask } from "@ms-cloudpack/task-reporter";
7
+ import type { Writable } from "stream";
5
8
  export declare class ProgressReporter implements Reporter {
9
+ private options;
10
+ logStream: Writable;
6
11
  startTime: [number, number];
7
12
  logEvent: EventEmitter;
8
13
  logEntries: Map<string, LogEntry<import("@lage-run/logger").LogStructuredData>[]>;
14
+ taskReporter: TaskReporter;
15
+ tasks: Map<string, TaskReporterTask>;
9
16
  constructor(options?: {
10
17
  concurrency: number;
18
+ version: string;
11
19
  });
20
+ createTaskReporter(): TaskReporter;
12
21
  log(entry: LogEntry<any>): void;
22
+ private print;
23
+ hr(): void;
13
24
  summarize(schedulerRunSummary: SchedulerRunSummary): void;
14
25
  }
@@ -6,55 +6,58 @@ Object.defineProperty(exports, "ProgressReporter", {
6
6
  enumerable: true,
7
7
  get: ()=>ProgressReporter
8
8
  });
9
- const _progressReporterApp = require("./components/ProgressReporterApp");
10
- const _ink = require("ink");
11
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
12
9
  const _events = /*#__PURE__*/ _interopRequireDefault(require("events"));
10
+ const _logger = require("@lage-run/logger");
11
+ const _taskReporter = require("@ms-cloudpack/task-reporter");
12
+ const _gradientString = /*#__PURE__*/ _interopRequireDefault(require("gradient-string"));
13
+ const _chalk = /*#__PURE__*/ _interopRequireDefault(require("chalk"));
14
+ const _formatHrtime = require("@lage-run/format-hrtime");
15
+ const _formatBytesJs = require("./formatBytes.js");
16
+ const _slowestTargetRunsJs = require("./slowestTargetRuns.js");
13
17
  function _interopRequireDefault(obj) {
14
18
  return obj && obj.__esModule ? obj : {
15
19
  default: obj
16
20
  };
17
21
  }
18
- function _getRequireWildcardCache(nodeInterop) {
19
- if (typeof WeakMap !== "function") return null;
20
- var cacheBabelInterop = new WeakMap();
21
- var cacheNodeInterop = new WeakMap();
22
- return (_getRequireWildcardCache = function(nodeInterop) {
23
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
24
- })(nodeInterop);
25
- }
26
- function _interopRequireWildcard(obj, nodeInterop) {
27
- if (!nodeInterop && obj && obj.__esModule) {
28
- return obj;
29
- }
30
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
31
- return {
32
- default: obj
33
- };
34
- }
35
- var cache = _getRequireWildcardCache(nodeInterop);
36
- if (cache && cache.has(obj)) {
37
- return cache.get(obj);
38
- }
39
- var newObj = {};
40
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
41
- for(var key in obj){
42
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
43
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
44
- if (desc && (desc.get || desc.set)) {
45
- Object.defineProperty(newObj, key, desc);
46
- } else {
47
- newObj[key] = obj[key];
48
- }
49
- }
50
- }
51
- newObj.default = obj;
52
- if (cache) {
53
- cache.set(obj, newObj);
54
- }
55
- return newObj;
22
+ const colors = {
23
+ [_logger.LogLevel.info]: _chalk.default.white,
24
+ [_logger.LogLevel.verbose]: _chalk.default.gray,
25
+ [_logger.LogLevel.warn]: _chalk.default.white,
26
+ [_logger.LogLevel.error]: _chalk.default.hex("#FF1010"),
27
+ [_logger.LogLevel.silly]: _chalk.default.green,
28
+ task: _chalk.default.hex("#00DDDD"),
29
+ pkg: _chalk.default.hex("#FFD66B"),
30
+ ok: _chalk.default.green,
31
+ error: _chalk.default.red,
32
+ warn: _chalk.default.yellow
33
+ };
34
+ function fancy(str) {
35
+ return (0, _gradientString.default)({
36
+ r: 237,
37
+ g: 178,
38
+ b: 77
39
+ }, "cyan")(str);
56
40
  }
57
41
  class ProgressReporter {
42
+ createTaskReporter() {
43
+ return new _taskReporter.TaskReporter({
44
+ productName: "lage",
45
+ version: this.options.version,
46
+ showCompleted: true,
47
+ showConsoleDebug: true,
48
+ showConsoleError: true,
49
+ showConsoleInfo: true,
50
+ showConsoleLog: true,
51
+ showConsoleWarn: true,
52
+ showErrors: true,
53
+ showPending: true,
54
+ showProgress: true,
55
+ showStarted: true,
56
+ showSummary: true,
57
+ showTaskDetails: true,
58
+ showTaskExtended: true
59
+ });
60
+ }
58
61
  log(entry) {
59
62
  // save the logs for errors
60
63
  if (entry.data?.target?.id) {
@@ -70,31 +73,120 @@ class ProgressReporter {
70
73
  if (entry.data && entry.data.schedulerRun) {
71
74
  this.startTime = entry.data.schedulerRun.startTime;
72
75
  }
73
- if (entry.data && entry.data.status) {
74
- this.logEvent.emit("status", entry);
75
- }
76
- if (entry.data && entry.data.progress) {
77
- this.logEvent.emit("progress", entry.data.progress);
76
+ if (entry.data && entry.data.status && entry.data.target) {
77
+ const target = entry.data.target;
78
+ const status = entry.data.status;
79
+ const reporterTask = this.tasks.has(target.id) ? this.tasks.get(target.id) : this.taskReporter.addTask(target.label, true);
80
+ if (reporterTask) {
81
+ this.tasks.set(target.id, reporterTask);
82
+ switch(status){
83
+ case "running":
84
+ reporterTask.start();
85
+ break;
86
+ case "success":
87
+ reporterTask.complete({
88
+ status: "complete"
89
+ });
90
+ break;
91
+ case "aborted":
92
+ reporterTask.complete({
93
+ status: "abort"
94
+ });
95
+ break;
96
+ case "skipped":
97
+ reporterTask.complete({
98
+ status: "skip"
99
+ });
100
+ break;
101
+ case "failed":
102
+ reporterTask.complete({
103
+ status: "fail"
104
+ });
105
+ break;
106
+ }
107
+ }
78
108
  }
79
109
  }
110
+ print(message) {
111
+ this.logStream.write(message + "\n");
112
+ }
113
+ hr() {
114
+ this.print("┈".repeat(80));
115
+ }
80
116
  summarize(schedulerRunSummary) {
81
- this.logEvent.emit("summary", {
82
- schedulerRunSummary,
83
- logEntries: this.logEntries
84
- });
117
+ const { targetRuns , targetRunByStatus , duration } = schedulerRunSummary;
118
+ const { failed , aborted , skipped , success , pending } = targetRunByStatus;
119
+ const statusColorFn = {
120
+ success: _chalk.default.greenBright,
121
+ failed: _chalk.default.redBright,
122
+ skipped: _chalk.default.gray,
123
+ running: _chalk.default.yellow,
124
+ pending: _chalk.default.gray,
125
+ aborted: _chalk.default.red,
126
+ queued: _chalk.default.magenta
127
+ };
128
+ if (targetRuns.size > 0) {
129
+ this.print(_chalk.default.cyanBright(`\nSummary`));
130
+ this.hr();
131
+ const slowestTargets = (0, _slowestTargetRunsJs.slowestTargetRuns)([
132
+ ...targetRuns.values()
133
+ ]);
134
+ for (const wrappedTarget of slowestTargets){
135
+ if (wrappedTarget.target.hidden) {
136
+ continue;
137
+ }
138
+ const colorFn = statusColorFn[wrappedTarget.status] ?? _chalk.default.white;
139
+ const target = wrappedTarget.target;
140
+ const hasDurations = !!wrappedTarget.duration && !!wrappedTarget.queueTime;
141
+ const queueDuration = hasDurations ? (0, _formatHrtime.hrtimeDiff)(wrappedTarget.queueTime, wrappedTarget.startTime) : [
142
+ 0,
143
+ 0
144
+ ];
145
+ this.print(`${target.label} ${colorFn(`${wrappedTarget.status === "running" ? "running - incomplete" : wrappedTarget.status}${hasDurations ? `, took ${(0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(wrappedTarget.duration))}, queued for ${(0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(queueDuration))}` : ""}`)}`);
146
+ }
147
+ this.print(`success: ${success.length}, skipped: ${skipped.length}, pending: ${pending.length}, aborted: ${aborted.length}, failed: ${failed.length}`);
148
+ this.print(`worker restarts: ${schedulerRunSummary.workerRestarts}, max worker memory usage: ${(0, _formatBytesJs.formatBytes)(schedulerRunSummary.maxWorkerMemoryUsage)}`);
149
+ } else {
150
+ this.print("Nothing has been run.");
151
+ }
152
+ this.hr();
153
+ if (failed && failed.length > 0) {
154
+ for (const targetId of failed){
155
+ const target = targetRuns.get(targetId)?.target;
156
+ if (target) {
157
+ const { packageName , task } = target;
158
+ const failureLogs = this.logEntries.get(targetId);
159
+ this.print(`[${colors.pkg(packageName ?? "<root>")} ${colors.task(task)}] ${colors[_logger.LogLevel.error]("ERROR DETECTED")}`);
160
+ if (failureLogs) {
161
+ for (const entry of failureLogs){
162
+ // Log each entry separately to prevent truncation
163
+ this.print(entry.msg);
164
+ }
165
+ }
166
+ this.hr();
167
+ }
168
+ }
169
+ }
170
+ const allCacheHits = [
171
+ ...targetRuns.values()
172
+ ].filter((run)=>!run.target.hidden).length === skipped.length;
173
+ const allCacheHitText = allCacheHits ? fancy(`All targets skipped!`) : "";
174
+ this.print(`Took a total of ${(0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(duration))} to complete. ${allCacheHitText}`);
85
175
  }
86
176
  constructor(options = {
87
- concurrency: 0
177
+ concurrency: 0,
178
+ version: "0.0.0"
88
179
  }){
180
+ this.options = options;
181
+ this.logStream = process.stdout;
89
182
  this.startTime = [
90
183
  0,
91
184
  0
92
185
  ];
93
186
  this.logEvent = new _events.default();
94
187
  this.logEntries = new Map();
95
- (0, _ink.render)(/*#__PURE__*/ _react.createElement(_progressReporterApp.ProgressReporterApp, {
96
- logEvent: this.logEvent,
97
- concurrency: options.concurrency
98
- }));
188
+ this.tasks = new Map();
189
+ this.taskReporter = this.createTaskReporter();
190
+ this.print(`${fancy("lage")} - Version ${options.version} - ${options.concurrency} Workers`);
99
191
  }
100
192
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lage-run/reporters",
3
- "version": "1.0.6",
3
+ "version": "1.1.0",
4
4
  "description": "Log reporters for Lage",
5
5
  "repository": {
6
6
  "url": "https://github.com/microsoft/lage"
@@ -16,17 +16,15 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@lage-run/logger": "^1.2.2",
19
- "@lage-run/scheduler-types": "^0.3.4",
19
+ "@lage-run/scheduler-types": "^0.3.5",
20
20
  "@lage-run/target-graph": "^0.8.1",
21
21
  "@lage-run/format-hrtime": "^0.1.4",
22
+ "@ms-cloudpack/task-reporter": "^0.3.2",
22
23
  "chalk": "^4.0.0",
23
24
  "ansi-regex": "^5.0.1",
24
- "gradient-string": "^2.0.1",
25
- "ink": "^3.2.0",
26
- "react": "^18.2.0"
25
+ "gradient-string": "^2.0.1"
27
26
  },
28
27
  "devDependencies": {
29
- "@types/react": "18.0.28",
30
28
  "memory-streams": "0.1.3"
31
29
  },
32
30
  "publishConfig": {
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import type { LogEntry } from "@lage-run/logger";
3
- export declare function ErrorMessages(props: {
4
- errors: Map<string, LogEntry<any>[]>;
5
- }): JSX.Element;
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "ErrorMessages", {
6
- enumerable: true,
7
- get: ()=>ErrorMessages
8
- });
9
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
10
- const _ink = require("ink");
11
- function _getRequireWildcardCache(nodeInterop) {
12
- if (typeof WeakMap !== "function") return null;
13
- var cacheBabelInterop = new WeakMap();
14
- var cacheNodeInterop = new WeakMap();
15
- return (_getRequireWildcardCache = function(nodeInterop) {
16
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
17
- })(nodeInterop);
18
- }
19
- function _interopRequireWildcard(obj, nodeInterop) {
20
- if (!nodeInterop && obj && obj.__esModule) {
21
- return obj;
22
- }
23
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
24
- return {
25
- default: obj
26
- };
27
- }
28
- var cache = _getRequireWildcardCache(nodeInterop);
29
- if (cache && cache.has(obj)) {
30
- return cache.get(obj);
31
- }
32
- var newObj = {};
33
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
34
- for(var key in obj){
35
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
36
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
37
- if (desc && (desc.get || desc.set)) {
38
- Object.defineProperty(newObj, key, desc);
39
- } else {
40
- newObj[key] = obj[key];
41
- }
42
- }
43
- }
44
- newObj.default = obj;
45
- if (cache) {
46
- cache.set(obj, newObj);
47
- }
48
- return newObj;
49
- }
50
- function ErrorMessages(props) {
51
- const { errors } = props;
52
- return /*#__PURE__*/ _react.createElement(_ink.Box, {
53
- flexDirection: "column"
54
- }, /*#__PURE__*/ _react.createElement(_ink.Text, {
55
- color: "redBright"
56
- }, "Errors"), /*#__PURE__*/ _react.createElement(_ink.Box, {
57
- flexDirection: "column",
58
- marginLeft: 2,
59
- marginY: 1
60
- }, [
61
- ...errors.entries()
62
- ].map(([targetId, logs])=>/*#__PURE__*/ _react.createElement(_ink.Box, {
63
- flexDirection: "column",
64
- key: `errorlogs-${targetId}`,
65
- marginBottom: 1
66
- }, /*#__PURE__*/ _react.createElement(_ink.Text, {
67
- color: "cyanBright",
68
- underline: true,
69
- bold: true
70
- }, targetId), /*#__PURE__*/ _react.createElement(_ink.Text, null, logs.map((entry)=>entry.msg).join("\n"))))));
71
- }
@@ -1,8 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="react" />
3
- import type EventEmitter from "events";
4
- export interface ProgressReporterAppProps {
5
- logEvent: EventEmitter;
6
- concurrency: number;
7
- }
8
- export declare function ProgressReporterApp(props: ProgressReporterAppProps): JSX.Element;
@@ -1,105 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "ProgressReporterApp", {
6
- enumerable: true,
7
- get: ()=>ProgressReporterApp
8
- });
9
- const _ink = require("ink");
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
- const _progressStatus = require("./ProgressStatus");
12
- const _summaryInfo = require("./SummaryInfo");
13
- const _threadItem = require("./ThreadItem");
14
- function _getRequireWildcardCache(nodeInterop) {
15
- if (typeof WeakMap !== "function") return null;
16
- var cacheBabelInterop = new WeakMap();
17
- var cacheNodeInterop = new WeakMap();
18
- return (_getRequireWildcardCache = function(nodeInterop) {
19
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
20
- })(nodeInterop);
21
- }
22
- function _interopRequireWildcard(obj, nodeInterop) {
23
- if (!nodeInterop && obj && obj.__esModule) {
24
- return obj;
25
- }
26
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
27
- return {
28
- default: obj
29
- };
30
- }
31
- var cache = _getRequireWildcardCache(nodeInterop);
32
- if (cache && cache.has(obj)) {
33
- return cache.get(obj);
34
- }
35
- var newObj = {};
36
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
37
- for(var key in obj){
38
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
39
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
40
- if (desc && (desc.get || desc.set)) {
41
- Object.defineProperty(newObj, key, desc);
42
- } else {
43
- newObj[key] = obj[key];
44
- }
45
- }
46
- }
47
- newObj.default = obj;
48
- if (cache) {
49
- cache.set(obj, newObj);
50
- }
51
- return newObj;
52
- }
53
- function ProgressReporterApp(props) {
54
- const initialThreadInfo = new Set();
55
- const [threadInfo, setThreadInfo] = _react.useState(initialThreadInfo);
56
- const [progress, setProgress] = _react.useState({
57
- waiting: 0,
58
- completed: 0,
59
- total: 0
60
- });
61
- const [summary, setSummary] = _react.useState();
62
- const { logEvent } = props;
63
- _react.useEffect(()=>{
64
- logEvent.on("status", (entry)=>{
65
- const { target , threadId , status } = entry.data;
66
- if (status === "running") {
67
- setThreadInfo((threadInfo)=>new Set(threadInfo).add(target.id));
68
- } else if (status === "success" || status === "aborted" || status === "failed" || status === "skipped") {
69
- setThreadInfo((threadInfo)=>{
70
- const newSet = new Set(threadInfo);
71
- newSet.delete(target.id);
72
- return newSet;
73
- });
74
- }
75
- });
76
- logEvent.on("progress", (progress)=>{
77
- setProgress(progress);
78
- });
79
- logEvent.on("summary", (summary)=>{
80
- setSummary(summary);
81
- });
82
- }, [
83
- logEvent
84
- ]);
85
- const limit = 16;
86
- const hasMore = threadInfo.size > limit;
87
- return /*#__PURE__*/ _react.createElement(_ink.Box, {
88
- flexDirection: "column"
89
- }, /*#__PURE__*/ _react.createElement(_ink.Text, null, "Lage running tasks with ", props.concurrency, " workers"), summary ? /*#__PURE__*/ _react.createElement(_summaryInfo.SummaryInfo, {
90
- summary: summary
91
- }) : /*#__PURE__*/ _react.createElement(_ink.Box, {
92
- flexDirection: "column"
93
- }, /*#__PURE__*/ _react.createElement(_progressStatus.ProgressStatus, {
94
- progress: progress
95
- }), /*#__PURE__*/ _react.createElement(_ink.Box, {
96
- flexDirection: "column",
97
- marginLeft: 2,
98
- marginY: 1
99
- }, [
100
- ...threadInfo
101
- ].slice(Math.max(0, threadInfo.size - limit)).map((targetId)=>/*#__PURE__*/ _react.createElement(_threadItem.ThreadItem, {
102
- key: targetId,
103
- targetId: targetId
104
- })), hasMore && /*#__PURE__*/ _react.createElement(_ink.Text, null, "... (displaying most recent ", limit, ")"))));
105
- }
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- import { Progress } from "../types/progressBarTypes";
3
- export interface ProgressStatusProps {
4
- progress: Progress;
5
- }
6
- export declare function ProgressStatus(props: ProgressStatusProps): JSX.Element;
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "ProgressStatus", {
6
- enumerable: true,
7
- get: ()=>ProgressStatus
8
- });
9
- const _ink = require("ink");
10
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
- function _getRequireWildcardCache(nodeInterop) {
12
- if (typeof WeakMap !== "function") return null;
13
- var cacheBabelInterop = new WeakMap();
14
- var cacheNodeInterop = new WeakMap();
15
- return (_getRequireWildcardCache = function(nodeInterop) {
16
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
17
- })(nodeInterop);
18
- }
19
- function _interopRequireWildcard(obj, nodeInterop) {
20
- if (!nodeInterop && obj && obj.__esModule) {
21
- return obj;
22
- }
23
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
24
- return {
25
- default: obj
26
- };
27
- }
28
- var cache = _getRequireWildcardCache(nodeInterop);
29
- if (cache && cache.has(obj)) {
30
- return cache.get(obj);
31
- }
32
- var newObj = {};
33
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
34
- for(var key in obj){
35
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
36
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
37
- if (desc && (desc.get || desc.set)) {
38
- Object.defineProperty(newObj, key, desc);
39
- } else {
40
- newObj[key] = obj[key];
41
- }
42
- }
43
- }
44
- newObj.default = obj;
45
- if (cache) {
46
- cache.set(obj, newObj);
47
- }
48
- return newObj;
49
- }
50
- function ProgressStatus(props) {
51
- const { waiting , completed , total } = props.progress;
52
- const percentage = total > 0 ? `${(completed / total * 100).toFixed(2)}%` : "0%";
53
- const status = `Waiting: ${waiting} | Completed: ${completed} | Total: ${total} | ${percentage}`;
54
- return /*#__PURE__*/ _react.createElement(_ink.Box, null, /*#__PURE__*/ _react.createElement(_ink.Text, null, status));
55
- }
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- import type { SummaryWithLogs } from '../types/progressBarTypes';
3
- export interface SummaryInfoProps {
4
- summary: SummaryWithLogs;
5
- }
6
- export declare function SummaryInfo(props: SummaryInfoProps): JSX.Element;
@@ -1,80 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "SummaryInfo", {
6
- enumerable: true,
7
- get: ()=>SummaryInfo
8
- });
9
- const _formatHrtime = require("@lage-run/format-hrtime");
10
- const _ink = require("ink");
11
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
12
- const _slowestTargetRuns = require("../slowestTargetRuns");
13
- const _errorMessages = require("./ErrorMessages");
14
- function _getRequireWildcardCache(nodeInterop) {
15
- if (typeof WeakMap !== "function") return null;
16
- var cacheBabelInterop = new WeakMap();
17
- var cacheNodeInterop = new WeakMap();
18
- return (_getRequireWildcardCache = function(nodeInterop) {
19
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
20
- })(nodeInterop);
21
- }
22
- function _interopRequireWildcard(obj, nodeInterop) {
23
- if (!nodeInterop && obj && obj.__esModule) {
24
- return obj;
25
- }
26
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
27
- return {
28
- default: obj
29
- };
30
- }
31
- var cache = _getRequireWildcardCache(nodeInterop);
32
- if (cache && cache.has(obj)) {
33
- return cache.get(obj);
34
- }
35
- var newObj = {};
36
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
37
- for(var key in obj){
38
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
39
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
40
- if (desc && (desc.get || desc.set)) {
41
- Object.defineProperty(newObj, key, desc);
42
- } else {
43
- newObj[key] = obj[key];
44
- }
45
- }
46
- }
47
- newObj.default = obj;
48
- if (cache) {
49
- cache.set(obj, newObj);
50
- }
51
- return newObj;
52
- }
53
- function SummaryInfo(props) {
54
- const { summary } = props;
55
- const { schedulerRunSummary , logEntries } = summary;
56
- const { targetRunByStatus , targetRuns , duration } = schedulerRunSummary;
57
- const slowestTargets = (0, _slowestTargetRuns.slowestTargetRuns)([
58
- ...targetRuns.values()
59
- ]);
60
- const { failed , aborted , skipped , success , pending } = targetRunByStatus;
61
- const errors = failed && failed.length > 0 ? new Map(failed.map((targetId)=>[
62
- targetId,
63
- logEntries.get(targetId) || []
64
- ])) : new Map();
65
- return /*#__PURE__*/ _react.createElement(_ink.Box, {
66
- flexDirection: "column"
67
- }, /*#__PURE__*/ _react.createElement(_ink.Text, {
68
- color: "greenBright"
69
- }, "Summary"), /*#__PURE__*/ _react.createElement(_ink.Newline, null), /*#__PURE__*/ _react.createElement(_ink.Text, {
70
- color: "yellow"
71
- }, "Slowest targets"), /*#__PURE__*/ _react.createElement(_ink.Box, {
72
- flexDirection: "column",
73
- marginLeft: 2,
74
- marginY: 1
75
- }, slowestTargets.slice(0, 10).filter((run)=>!run.target.hidden).map((targetRun)=>/*#__PURE__*/ _react.createElement(_ink.Text, {
76
- key: targetRun.target.id
77
- }, targetRun.target.id, " - ", (0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(targetRun.duration))))), errors.size > 0 ? /*#__PURE__*/ _react.createElement(_errorMessages.ErrorMessages, {
78
- errors: errors
79
- }) : null, /*#__PURE__*/ _react.createElement(_ink.Text, null, `success: ${success.length}, skipped: ${skipped.length}, pending: ${pending.length}, aborted: ${aborted.length}, failed: ${failed.length}`), /*#__PURE__*/ _react.createElement(_ink.Text, null, "Took a total of ", (0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(duration)), " to complete."));
80
- }
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- export declare function ThreadItem(props: {
3
- targetId: string;
4
- }): JSX.Element;
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "ThreadItem", {
6
- enumerable: true,
7
- get: ()=>ThreadItem
8
- });
9
- const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
10
- const _ink = require("ink");
11
- function _getRequireWildcardCache(nodeInterop) {
12
- if (typeof WeakMap !== "function") return null;
13
- var cacheBabelInterop = new WeakMap();
14
- var cacheNodeInterop = new WeakMap();
15
- return (_getRequireWildcardCache = function(nodeInterop) {
16
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
17
- })(nodeInterop);
18
- }
19
- function _interopRequireWildcard(obj, nodeInterop) {
20
- if (!nodeInterop && obj && obj.__esModule) {
21
- return obj;
22
- }
23
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
24
- return {
25
- default: obj
26
- };
27
- }
28
- var cache = _getRequireWildcardCache(nodeInterop);
29
- if (cache && cache.has(obj)) {
30
- return cache.get(obj);
31
- }
32
- var newObj = {};
33
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
34
- for(var key in obj){
35
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
36
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
37
- if (desc && (desc.get || desc.set)) {
38
- Object.defineProperty(newObj, key, desc);
39
- } else {
40
- newObj[key] = obj[key];
41
- }
42
- }
43
- }
44
- newObj.default = obj;
45
- if (cache) {
46
- cache.set(obj, newObj);
47
- }
48
- return newObj;
49
- }
50
- function ThreadItem(props) {
51
- const { targetId } = props;
52
- return targetId ? /*#__PURE__*/ _react.createElement(_ink.Text, {
53
- color: "whiteBright"
54
- }, targetId, " ") : /*#__PURE__*/ _react.createElement(_ink.Text, {
55
- color: "gray"
56
- }, "IDLE");
57
- }