@lage-run/reporters 0.2.41 → 0.2.42
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/ProgressReporter.d.ts +1 -1
- package/lib/ProgressReporter.js +3 -131
- package/lib/components/ErrorMessages.d.ts +5 -0
- package/lib/components/ErrorMessages.js +71 -0
- package/lib/components/ProgressReporterApp.d.ts +8 -0
- package/lib/components/ProgressReporterApp.js +117 -0
- package/lib/components/ProgressStatus.d.ts +8 -0
- package/lib/components/ProgressStatus.js +55 -0
- package/lib/components/SummaryInfo.d.ts +6 -0
- package/lib/components/SummaryInfo.js +79 -0
- package/lib/components/ThreadItem.d.ts +4 -0
- package/lib/components/ThreadItem.js +57 -0
- package/lib/types/progressBarTypes.d.ts +14 -0
- package/lib/types/progressBarTypes.js +4 -0
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,22 @@
|
|
|
2
2
|
"name": "@lage-run/reporters",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Tue, 06 Dec 2022
|
|
5
|
+
"date": "Tue, 06 Dec 2022 23:28:03 GMT",
|
|
6
|
+
"tag": "@lage-run/reporters_v0.2.42",
|
|
7
|
+
"version": "0.2.42",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "kchau@microsoft.com",
|
|
12
|
+
"package": "@lage-run/reporters",
|
|
13
|
+
"commit": "be767568d67ce73497f83900b339737df3d0e5bd",
|
|
14
|
+
"comment": "fixes an array length issue"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Tue, 06 Dec 2022 00:48:02 GMT",
|
|
6
21
|
"tag": "@lage-run/reporters_v0.2.41",
|
|
7
22
|
"version": "0.2.41",
|
|
8
23
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
# Change Log - @lage-run/reporters
|
|
2
2
|
|
|
3
|
-
This log was last generated on Tue, 06 Dec 2022
|
|
3
|
+
This log was last generated on Tue, 06 Dec 2022 23:28:03 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.2.42
|
|
8
|
+
|
|
9
|
+
Tue, 06 Dec 2022 23:28:03 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- fixes an array length issue (kchau@microsoft.com)
|
|
14
|
+
|
|
7
15
|
## 0.2.41
|
|
8
16
|
|
|
9
|
-
Tue, 06 Dec 2022 00:
|
|
17
|
+
Tue, 06 Dec 2022 00:48:02 GMT
|
|
10
18
|
|
|
11
19
|
### Patches
|
|
12
20
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import EventEmitter from "events";
|
|
2
3
|
import type { LogEntry, Reporter } from "@lage-run/logger";
|
|
3
4
|
import type { SchedulerRunSummary } from "@lage-run/scheduler-types";
|
|
4
|
-
import EventEmitter from "events";
|
|
5
5
|
export declare class ProgressReporter implements Reporter {
|
|
6
6
|
logEvent: EventEmitter;
|
|
7
7
|
logEntries: Map<string, LogEntry<import("@lage-run/logger").LogStructuredData>[]>;
|
package/lib/ProgressReporter.js
CHANGED
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "ProgressReporter", {
|
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: ()=>ProgressReporter
|
|
8
8
|
});
|
|
9
|
-
const
|
|
9
|
+
const _progressReporterApp = require("./components/ProgressReporterApp");
|
|
10
10
|
const _ink = require("ink");
|
|
11
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
11
12
|
const _events = /*#__PURE__*/ _interopRequireDefault(require("events"));
|
|
12
|
-
const _formatHrtime = require("@lage-run/format-hrtime");
|
|
13
13
|
function _interopRequireDefault(obj) {
|
|
14
14
|
return obj && obj.__esModule ? obj : {
|
|
15
15
|
default: obj
|
|
@@ -54,134 +54,6 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
54
54
|
}
|
|
55
55
|
return newObj;
|
|
56
56
|
}
|
|
57
|
-
function ProgressStatus(props) {
|
|
58
|
-
const { waiting , completed , total } = props.progress;
|
|
59
|
-
const percentage = total > 0 ? `${(completed / total * 100).toFixed(2)}%` : "0%";
|
|
60
|
-
const status = `Waiting: ${waiting} | Completed: ${completed} | Total: ${total} | ${percentage}`;
|
|
61
|
-
return /*#__PURE__*/ _react.createElement(_ink.Box, null, /*#__PURE__*/ _react.createElement(_ink.Text, null, status));
|
|
62
|
-
}
|
|
63
|
-
function ThreadItem(props) {
|
|
64
|
-
const { targetId } = props;
|
|
65
|
-
return /*#__PURE__*/ _react.createElement(_ink.Box, null, targetId ? /*#__PURE__*/ _react.createElement(_ink.Text, {
|
|
66
|
-
color: "whiteBright"
|
|
67
|
-
}, "[ ", targetId, " ]") : /*#__PURE__*/ _react.createElement(_ink.Text, {
|
|
68
|
-
color: "gray"
|
|
69
|
-
}, "[ IDLE ]"));
|
|
70
|
-
}
|
|
71
|
-
function SummaryInfo(props) {
|
|
72
|
-
const { summary } = props;
|
|
73
|
-
const { schedulerRunSummary , logEntries } = summary;
|
|
74
|
-
const { targetRunByStatus , targetRuns , duration } = schedulerRunSummary;
|
|
75
|
-
const slowestTargetRuns = [
|
|
76
|
-
...targetRuns.values()
|
|
77
|
-
].sort((a, b)=>parseFloat((0, _formatHrtime.hrToSeconds)((0, _formatHrtime.hrtimeDiff)(a.duration, b.duration))));
|
|
78
|
-
const { failed , aborted , skipped , success , pending } = targetRunByStatus;
|
|
79
|
-
const errors = failed && failed.length > 0 ? new Map(failed.map((targetId)=>[
|
|
80
|
-
targetId,
|
|
81
|
-
logEntries.get(targetId) || []
|
|
82
|
-
])) : new Map();
|
|
83
|
-
return /*#__PURE__*/ _react.createElement(_ink.Box, {
|
|
84
|
-
flexDirection: "column"
|
|
85
|
-
}, /*#__PURE__*/ _react.createElement(_ink.Text, {
|
|
86
|
-
color: "greenBright"
|
|
87
|
-
}, "Summary"), /*#__PURE__*/ _react.createElement(_ink.Newline, null), /*#__PURE__*/ _react.createElement(_ink.Text, {
|
|
88
|
-
color: "yellow"
|
|
89
|
-
}, "Slowest targets"), /*#__PURE__*/ _react.createElement(_ink.Box, {
|
|
90
|
-
flexDirection: "column",
|
|
91
|
-
marginLeft: 2,
|
|
92
|
-
marginY: 1
|
|
93
|
-
}, slowestTargetRuns.slice(0, 10).filter((run)=>!run.target.hidden).map((targetRun)=>/*#__PURE__*/ _react.createElement(_ink.Text, {
|
|
94
|
-
key: targetRun.target.id
|
|
95
|
-
}, targetRun.target.id, " - ", (0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(targetRun.duration))))), errors.size > 0 ? /*#__PURE__*/ _react.createElement(ErrorMessages, {
|
|
96
|
-
errors: errors
|
|
97
|
-
}) : 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."));
|
|
98
|
-
}
|
|
99
|
-
function ErrorMessages(props) {
|
|
100
|
-
const { errors } = props;
|
|
101
|
-
return /*#__PURE__*/ _react.createElement(_ink.Box, {
|
|
102
|
-
flexDirection: "column"
|
|
103
|
-
}, /*#__PURE__*/ _react.createElement(_ink.Text, {
|
|
104
|
-
color: "redBright"
|
|
105
|
-
}, "Errors"), /*#__PURE__*/ _react.createElement(_ink.Box, {
|
|
106
|
-
flexDirection: "column",
|
|
107
|
-
marginLeft: 2,
|
|
108
|
-
marginY: 1
|
|
109
|
-
}, [
|
|
110
|
-
...errors.entries()
|
|
111
|
-
].map(([targetId, logs])=>/*#__PURE__*/ _react.createElement(_ink.Box, {
|
|
112
|
-
flexDirection: "column",
|
|
113
|
-
key: `errorlogs-${targetId}`,
|
|
114
|
-
marginBottom: 1
|
|
115
|
-
}, /*#__PURE__*/ _react.createElement(_ink.Text, {
|
|
116
|
-
color: "cyanBright",
|
|
117
|
-
underline: true,
|
|
118
|
-
bold: true
|
|
119
|
-
}, targetId), /*#__PURE__*/ _react.createElement(_ink.Text, null, logs.map((entry)=>entry.msg).join("\n"))))));
|
|
120
|
-
}
|
|
121
|
-
function ReporterApp(props) {
|
|
122
|
-
const [threadInfo, setThreadInfo] = _react.useState({});
|
|
123
|
-
const [progress, setProgress] = _react.useState({
|
|
124
|
-
waiting: 0,
|
|
125
|
-
completed: 0,
|
|
126
|
-
total: 0
|
|
127
|
-
});
|
|
128
|
-
const [summary, setSummary] = _react.useState();
|
|
129
|
-
const { logEvent } = props;
|
|
130
|
-
_react.useEffect(()=>{
|
|
131
|
-
logEvent.on("status", (entry)=>{
|
|
132
|
-
const { target , threadId , status } = entry.data;
|
|
133
|
-
if (status && status === "running") {
|
|
134
|
-
setThreadInfo((threadInfo)=>({
|
|
135
|
-
...threadInfo,
|
|
136
|
-
[threadId]: target.id
|
|
137
|
-
}));
|
|
138
|
-
} else if (status === "success" || status === "aborted" || status === "failed") {
|
|
139
|
-
setThreadInfo((threadInfo)=>{
|
|
140
|
-
const newThreadInfo = {
|
|
141
|
-
...threadInfo
|
|
142
|
-
};
|
|
143
|
-
newThreadInfo[threadId] = "";
|
|
144
|
-
return newThreadInfo;
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
logEvent.on("progress", (progress)=>{
|
|
149
|
-
setProgress(progress);
|
|
150
|
-
});
|
|
151
|
-
logEvent.on("summary", (summary)=>{
|
|
152
|
-
setSummary(summary);
|
|
153
|
-
});
|
|
154
|
-
}, [
|
|
155
|
-
logEvent
|
|
156
|
-
]);
|
|
157
|
-
const idleWorkerDummyThreadInfo = new Array(props.concurrency - Object.keys(threadInfo).length).fill(0);
|
|
158
|
-
return /*#__PURE__*/ _react.createElement(_ink.Box, {
|
|
159
|
-
flexDirection: "column"
|
|
160
|
-
}, /*#__PURE__*/ _react.createElement(_ink.Text, null, "Lage running tasks"), /*#__PURE__*/ _react.createElement(_ink.Text, {
|
|
161
|
-
color: "yellow"
|
|
162
|
-
}, "[warning: this progress reporter is currently in beta and unstable]"), summary ? /*#__PURE__*/ _react.createElement(SummaryInfo, {
|
|
163
|
-
summary: summary
|
|
164
|
-
}) : /*#__PURE__*/ _react.createElement(_ink.Box, {
|
|
165
|
-
flexDirection: "column"
|
|
166
|
-
}, /*#__PURE__*/ _react.createElement(_ink.Box, {
|
|
167
|
-
flexDirection: "column",
|
|
168
|
-
marginLeft: 2,
|
|
169
|
-
marginY: 1
|
|
170
|
-
}, Object.entries(threadInfo).map(([threadId, targetId])=>{
|
|
171
|
-
return /*#__PURE__*/ _react.createElement(ThreadItem, {
|
|
172
|
-
key: threadId,
|
|
173
|
-
targetId: targetId
|
|
174
|
-
});
|
|
175
|
-
}), idleWorkerDummyThreadInfo.map((_, index)=>{
|
|
176
|
-
return /*#__PURE__*/ _react.createElement(_react.Fragment, {
|
|
177
|
-
key: `idle-${index}`
|
|
178
|
-
}, /*#__PURE__*/ _react.createElement(ThreadItem, {
|
|
179
|
-
targetId: ""
|
|
180
|
-
}));
|
|
181
|
-
})), /*#__PURE__*/ _react.createElement(ProgressStatus, {
|
|
182
|
-
progress: progress
|
|
183
|
-
})));
|
|
184
|
-
}
|
|
185
57
|
class ProgressReporter {
|
|
186
58
|
log(entry) {
|
|
187
59
|
// save the logs for errors
|
|
@@ -213,7 +85,7 @@ class ProgressReporter {
|
|
|
213
85
|
}){
|
|
214
86
|
this.logEvent = new _events.default();
|
|
215
87
|
this.logEntries = new Map();
|
|
216
|
-
(0, _ink.render)(/*#__PURE__*/ _react.createElement(
|
|
88
|
+
(0, _ink.render)(/*#__PURE__*/ _react.createElement(_progressReporterApp.ProgressReporterApp, {
|
|
217
89
|
logEvent: this.logEvent,
|
|
218
90
|
concurrency: options.concurrency
|
|
219
91
|
}));
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
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;
|
|
@@ -0,0 +1,117 @@
|
|
|
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 [threadInfo, setThreadInfo] = _react.useState({});
|
|
55
|
+
const [progress, setProgress] = _react.useState({
|
|
56
|
+
waiting: 0,
|
|
57
|
+
completed: 0,
|
|
58
|
+
total: 0
|
|
59
|
+
});
|
|
60
|
+
const [summary, setSummary] = _react.useState();
|
|
61
|
+
const { logEvent } = props;
|
|
62
|
+
_react.useEffect(()=>{
|
|
63
|
+
logEvent.on("status", (entry)=>{
|
|
64
|
+
const { target , threadId , status } = entry.data;
|
|
65
|
+
if (status && status === "running") {
|
|
66
|
+
setThreadInfo((threadInfo)=>({
|
|
67
|
+
...threadInfo,
|
|
68
|
+
[threadId]: target.id
|
|
69
|
+
}));
|
|
70
|
+
} else if (status === "success" || status === "aborted" || status === "failed") {
|
|
71
|
+
setThreadInfo((threadInfo)=>{
|
|
72
|
+
const newThreadInfo = {
|
|
73
|
+
...threadInfo
|
|
74
|
+
};
|
|
75
|
+
newThreadInfo[threadId] = "";
|
|
76
|
+
return newThreadInfo;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
logEvent.on("progress", (progress)=>{
|
|
81
|
+
setProgress(progress);
|
|
82
|
+
});
|
|
83
|
+
logEvent.on("summary", (summary)=>{
|
|
84
|
+
setSummary(summary);
|
|
85
|
+
});
|
|
86
|
+
}, [
|
|
87
|
+
logEvent
|
|
88
|
+
]);
|
|
89
|
+
const arrayGapLength = props.concurrency - Object.keys(threadInfo).length;
|
|
90
|
+
const idleWorkerDummyThreadInfo = arrayGapLength > 0 ? new Array(arrayGapLength).fill(0) : [];
|
|
91
|
+
return /*#__PURE__*/ _react.createElement(_ink.Box, {
|
|
92
|
+
flexDirection: "column"
|
|
93
|
+
}, /*#__PURE__*/ _react.createElement(_ink.Text, null, "Lage running tasks"), /*#__PURE__*/ _react.createElement(_ink.Text, {
|
|
94
|
+
color: "yellow"
|
|
95
|
+
}, "[warning: this progress reporter is currently in beta and unstable]"), summary ? /*#__PURE__*/ _react.createElement(_summaryInfo.SummaryInfo, {
|
|
96
|
+
summary: summary
|
|
97
|
+
}) : /*#__PURE__*/ _react.createElement(_ink.Box, {
|
|
98
|
+
flexDirection: "column"
|
|
99
|
+
}, /*#__PURE__*/ _react.createElement(_ink.Box, {
|
|
100
|
+
flexDirection: "column",
|
|
101
|
+
marginLeft: 2,
|
|
102
|
+
marginY: 1
|
|
103
|
+
}, Object.entries(threadInfo).map(([threadId, targetId])=>{
|
|
104
|
+
return /*#__PURE__*/ _react.createElement(_threadItem.ThreadItem, {
|
|
105
|
+
key: threadId,
|
|
106
|
+
targetId: targetId
|
|
107
|
+
});
|
|
108
|
+
}), idleWorkerDummyThreadInfo.map((_, index)=>{
|
|
109
|
+
return /*#__PURE__*/ _react.createElement(_react.Fragment, {
|
|
110
|
+
key: `idle-${index}`
|
|
111
|
+
}, /*#__PURE__*/ _react.createElement(_threadItem.ThreadItem, {
|
|
112
|
+
targetId: ""
|
|
113
|
+
}));
|
|
114
|
+
})), /*#__PURE__*/ _react.createElement(_progressStatus.ProgressStatus, {
|
|
115
|
+
progress: progress
|
|
116
|
+
})));
|
|
117
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
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 _errorMessages = require("./ErrorMessages");
|
|
13
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
14
|
+
if (typeof WeakMap !== "function") return null;
|
|
15
|
+
var cacheBabelInterop = new WeakMap();
|
|
16
|
+
var cacheNodeInterop = new WeakMap();
|
|
17
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
18
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
19
|
+
})(nodeInterop);
|
|
20
|
+
}
|
|
21
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
22
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
25
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
26
|
+
return {
|
|
27
|
+
default: obj
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
31
|
+
if (cache && cache.has(obj)) {
|
|
32
|
+
return cache.get(obj);
|
|
33
|
+
}
|
|
34
|
+
var newObj = {};
|
|
35
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
36
|
+
for(var key in obj){
|
|
37
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
38
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
39
|
+
if (desc && (desc.get || desc.set)) {
|
|
40
|
+
Object.defineProperty(newObj, key, desc);
|
|
41
|
+
} else {
|
|
42
|
+
newObj[key] = obj[key];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
newObj.default = obj;
|
|
47
|
+
if (cache) {
|
|
48
|
+
cache.set(obj, newObj);
|
|
49
|
+
}
|
|
50
|
+
return newObj;
|
|
51
|
+
}
|
|
52
|
+
function SummaryInfo(props) {
|
|
53
|
+
const { summary } = props;
|
|
54
|
+
const { schedulerRunSummary , logEntries } = summary;
|
|
55
|
+
const { targetRunByStatus , targetRuns , duration } = schedulerRunSummary;
|
|
56
|
+
const slowestTargetRuns = [
|
|
57
|
+
...targetRuns.values()
|
|
58
|
+
].sort((a, b)=>parseFloat((0, _formatHrtime.hrToSeconds)((0, _formatHrtime.hrtimeDiff)(a.duration, b.duration))));
|
|
59
|
+
const { failed , aborted , skipped , success , pending } = targetRunByStatus;
|
|
60
|
+
const errors = failed && failed.length > 0 ? new Map(failed.map((targetId)=>[
|
|
61
|
+
targetId,
|
|
62
|
+
logEntries.get(targetId) || []
|
|
63
|
+
])) : new Map();
|
|
64
|
+
return /*#__PURE__*/ _react.createElement(_ink.Box, {
|
|
65
|
+
flexDirection: "column"
|
|
66
|
+
}, /*#__PURE__*/ _react.createElement(_ink.Text, {
|
|
67
|
+
color: "greenBright"
|
|
68
|
+
}, "Summary"), /*#__PURE__*/ _react.createElement(_ink.Newline, null), /*#__PURE__*/ _react.createElement(_ink.Text, {
|
|
69
|
+
color: "yellow"
|
|
70
|
+
}, "Slowest targets"), /*#__PURE__*/ _react.createElement(_ink.Box, {
|
|
71
|
+
flexDirection: "column",
|
|
72
|
+
marginLeft: 2,
|
|
73
|
+
marginY: 1
|
|
74
|
+
}, slowestTargetRuns.slice(0, 10).filter((run)=>!run.target.hidden).map((targetRun)=>/*#__PURE__*/ _react.createElement(_ink.Text, {
|
|
75
|
+
key: targetRun.target.id
|
|
76
|
+
}, targetRun.target.id, " - ", (0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(targetRun.duration))))), errors.size > 0 ? /*#__PURE__*/ _react.createElement(_errorMessages.ErrorMessages, {
|
|
77
|
+
errors: errors
|
|
78
|
+
}) : 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."));
|
|
79
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
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 /*#__PURE__*/ _react.createElement(_ink.Box, null, targetId ? /*#__PURE__*/ _react.createElement(_ink.Text, {
|
|
53
|
+
color: "whiteBright"
|
|
54
|
+
}, "[ ", targetId, " ]") : /*#__PURE__*/ _react.createElement(_ink.Text, {
|
|
55
|
+
color: "gray"
|
|
56
|
+
}, "[ IDLE ]"));
|
|
57
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LogEntry } from "@lage-run/logger";
|
|
2
|
+
import type { SchedulerRunSummary } from "@lage-run/scheduler-types";
|
|
3
|
+
export interface Progress {
|
|
4
|
+
waiting: number;
|
|
5
|
+
completed: number;
|
|
6
|
+
total: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ThreadInfo {
|
|
9
|
+
[threadId: string]: string;
|
|
10
|
+
}
|
|
11
|
+
export interface SummaryWithLogs {
|
|
12
|
+
schedulerRunSummary: SchedulerRunSummary;
|
|
13
|
+
logEntries: Map<string, LogEntry[]>;
|
|
14
|
+
}
|