@lage-run/reporters 0.2.42 → 0.2.44
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 +46 -1
- package/CHANGELOG.md +18 -2
- package/lib/ChromeTraceEventsReporter.d.ts +0 -2
- package/lib/ChromeTraceEventsReporter.js +1 -6
- package/lib/ProgressReporter.d.ts +1 -0
- package/lib/ProgressReporter.js +8 -1
- package/lib/components/ProgressReporterApp.js +19 -31
- package/lib/components/ProgressStatus.d.ts +1 -3
- package/lib/components/ThreadItem.js +3 -3
- package/lib/createReporter.js +5 -0
- package/lib/types/progressBarTypes.d.ts +1 -3
- package/package.json +2 -2
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,52 @@
|
|
|
2
2
|
"name": "@lage-run/reporters",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Thu, 05 Jan 2023 00:40:39 GMT",
|
|
6
|
+
"tag": "@lage-run/reporters_v0.2.44",
|
|
7
|
+
"version": "0.2.44",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "kchau@microsoft.com",
|
|
12
|
+
"package": "@lage-run/reporters",
|
|
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",
|
|
21
|
+
"tag": "@lage-run/reporters_v0.2.43",
|
|
22
|
+
"version": "0.2.43",
|
|
23
|
+
"comments": {
|
|
24
|
+
"patch": [
|
|
25
|
+
{
|
|
26
|
+
"author": "kchau@microsoft.com",
|
|
27
|
+
"package": "@lage-run/reporters",
|
|
28
|
+
"commit": "ad281dfe8b222d949130821828a680d1c3625154",
|
|
29
|
+
"comment": "adding some more niceties to progress reporter"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"date": "Tue, 06 Dec 2022 23:33:47 GMT",
|
|
36
|
+
"tag": "@lage-run/reporters_v0.2.42",
|
|
37
|
+
"version": "0.2.42",
|
|
38
|
+
"comments": {
|
|
39
|
+
"none": [
|
|
40
|
+
{
|
|
41
|
+
"author": "renovate@whitesourcesoftware.com",
|
|
42
|
+
"package": "@lage-run/reporters",
|
|
43
|
+
"commit": "07c1993552c81082c2717146ce0ff57a7a2eba1b",
|
|
44
|
+
"comment": "Update devDependency @types/react to v18.0.26"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"date": "Tue, 06 Dec 2022 23:28:12 GMT",
|
|
6
51
|
"tag": "@lage-run/reporters_v0.2.42",
|
|
7
52
|
"version": "0.2.42",
|
|
8
53
|
"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
|
|
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.2.44
|
|
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
|
+
|
|
15
|
+
## 0.2.43
|
|
16
|
+
|
|
17
|
+
Thu, 08 Dec 2022 00:49:28 GMT
|
|
18
|
+
|
|
19
|
+
### Patches
|
|
20
|
+
|
|
21
|
+
- adding some more niceties to progress reporter (kchau@microsoft.com)
|
|
22
|
+
|
|
7
23
|
## 0.2.42
|
|
8
24
|
|
|
9
|
-
Tue, 06 Dec 2022 23:28:
|
|
25
|
+
Tue, 06 Dec 2022 23:28:12 GMT
|
|
10
26
|
|
|
11
27
|
### Patches
|
|
12
28
|
|
|
@@ -11,8 +11,6 @@ export declare class ChromeTraceEventsReporter implements Reporter {
|
|
|
11
11
|
private options;
|
|
12
12
|
logStream: Writable;
|
|
13
13
|
consoleLogStream: Writable;
|
|
14
|
-
private threads;
|
|
15
|
-
private targetIdThreadMap;
|
|
16
14
|
private events;
|
|
17
15
|
private outputFile;
|
|
18
16
|
constructor(options: ChromeTraceEventsReporterOptions);
|
|
@@ -14,9 +14,6 @@ function _interopRequireDefault(obj) {
|
|
|
14
14
|
default: obj
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
function range(len) {
|
|
18
|
-
return Array(len).fill(0).map((_, idx)=>idx + 1);
|
|
19
|
-
}
|
|
20
17
|
function hrTimeToMicroseconds(hr) {
|
|
21
18
|
return hr[0] * 1e6 + hr[1] * 1e-3;
|
|
22
19
|
}
|
|
@@ -48,7 +45,7 @@ class ChromeTraceEventsReporter {
|
|
|
48
45
|
1000
|
|
49
46
|
]),
|
|
50
47
|
pid: 1,
|
|
51
|
-
tid: targetRun.threadId
|
|
48
|
+
tid: targetRun.threadId
|
|
52
49
|
};
|
|
53
50
|
if (categorize) {
|
|
54
51
|
event.cat += `,${categorize(targetRun)}`;
|
|
@@ -62,13 +59,11 @@ class ChromeTraceEventsReporter {
|
|
|
62
59
|
constructor(options){
|
|
63
60
|
this.options = options;
|
|
64
61
|
this.consoleLogStream = process.stdout;
|
|
65
|
-
this.targetIdThreadMap = new Map();
|
|
66
62
|
this.events = {
|
|
67
63
|
traceEvents: [],
|
|
68
64
|
displayTimeUnit: "ms"
|
|
69
65
|
};
|
|
70
66
|
this.outputFile = options.outputFile ?? getTimeBasedFilename("profile");
|
|
71
|
-
this.threads = range(options.concurrency);
|
|
72
67
|
if (!_fs.default.existsSync(_path.default.dirname(this.outputFile))) {
|
|
73
68
|
_fs.default.mkdirSync(_path.default.dirname(this.outputFile), {
|
|
74
69
|
recursive: true
|
|
@@ -3,6 +3,7 @@ import EventEmitter from "events";
|
|
|
3
3
|
import type { LogEntry, Reporter } from "@lage-run/logger";
|
|
4
4
|
import type { SchedulerRunSummary } from "@lage-run/scheduler-types";
|
|
5
5
|
export declare class ProgressReporter implements Reporter {
|
|
6
|
+
startTime: [number, number];
|
|
6
7
|
logEvent: EventEmitter;
|
|
7
8
|
logEntries: Map<string, LogEntry<import("@lage-run/logger").LogStructuredData>[]>;
|
|
8
9
|
constructor(options?: {
|
package/lib/ProgressReporter.js
CHANGED
|
@@ -67,7 +67,10 @@ class ProgressReporter {
|
|
|
67
67
|
if (entry?.data?.target?.hidden) {
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
if (entry.data && entry.data.
|
|
70
|
+
if (entry.data && entry.data.schedulerRun) {
|
|
71
|
+
this.startTime = entry.data.schedulerRun.startTime;
|
|
72
|
+
}
|
|
73
|
+
if (entry.data && entry.data.status) {
|
|
71
74
|
this.logEvent.emit("status", entry);
|
|
72
75
|
}
|
|
73
76
|
if (entry.data && entry.data.progress) {
|
|
@@ -83,6 +86,10 @@ class ProgressReporter {
|
|
|
83
86
|
constructor(options = {
|
|
84
87
|
concurrency: 0
|
|
85
88
|
}){
|
|
89
|
+
this.startTime = [
|
|
90
|
+
0,
|
|
91
|
+
0
|
|
92
|
+
];
|
|
86
93
|
this.logEvent = new _events.default();
|
|
87
94
|
this.logEntries = new Map();
|
|
88
95
|
(0, _ink.render)(/*#__PURE__*/ _react.createElement(_progressReporterApp.ProgressReporterApp, {
|
|
@@ -51,7 +51,8 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
51
51
|
return newObj;
|
|
52
52
|
}
|
|
53
53
|
function ProgressReporterApp(props) {
|
|
54
|
-
const
|
|
54
|
+
const initialThreadInfo = new Set();
|
|
55
|
+
const [threadInfo, setThreadInfo] = _react.useState(initialThreadInfo);
|
|
55
56
|
const [progress, setProgress] = _react.useState({
|
|
56
57
|
waiting: 0,
|
|
57
58
|
completed: 0,
|
|
@@ -62,18 +63,13 @@ function ProgressReporterApp(props) {
|
|
|
62
63
|
_react.useEffect(()=>{
|
|
63
64
|
logEvent.on("status", (entry)=>{
|
|
64
65
|
const { target , threadId , status } = entry.data;
|
|
65
|
-
if (status
|
|
66
|
-
setThreadInfo((threadInfo)=>(
|
|
67
|
-
|
|
68
|
-
[threadId]: target.id
|
|
69
|
-
}));
|
|
70
|
-
} else if (status === "success" || status === "aborted" || status === "failed") {
|
|
66
|
+
if (status === "running") {
|
|
67
|
+
setThreadInfo((threadInfo)=>new Set(threadInfo).add(target.id));
|
|
68
|
+
} else if (status === "success" || status === "aborted" || status === "failed" || status === "skipped") {
|
|
71
69
|
setThreadInfo((threadInfo)=>{
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
newThreadInfo[threadId] = "";
|
|
76
|
-
return newThreadInfo;
|
|
70
|
+
const newSet = new Set(threadInfo);
|
|
71
|
+
newSet.delete(target.id);
|
|
72
|
+
return newSet;
|
|
77
73
|
});
|
|
78
74
|
}
|
|
79
75
|
});
|
|
@@ -86,32 +82,24 @@ function ProgressReporterApp(props) {
|
|
|
86
82
|
}, [
|
|
87
83
|
logEvent
|
|
88
84
|
]);
|
|
89
|
-
const
|
|
90
|
-
const
|
|
85
|
+
const limit = 16;
|
|
86
|
+
const hasMore = threadInfo.size > limit;
|
|
91
87
|
return /*#__PURE__*/ _react.createElement(_ink.Box, {
|
|
92
88
|
flexDirection: "column"
|
|
93
|
-
}, /*#__PURE__*/ _react.createElement(_ink.Text, null, "Lage running tasks"), /*#__PURE__*/ _react.createElement(
|
|
94
|
-
color: "yellow"
|
|
95
|
-
}, "[warning: this progress reporter is currently in beta and unstable]"), summary ? /*#__PURE__*/ _react.createElement(_summaryInfo.SummaryInfo, {
|
|
89
|
+
}, /*#__PURE__*/ _react.createElement(_ink.Text, null, "Lage running tasks with ", props.concurrency, " workers"), summary ? /*#__PURE__*/ _react.createElement(_summaryInfo.SummaryInfo, {
|
|
96
90
|
summary: summary
|
|
97
91
|
}) : /*#__PURE__*/ _react.createElement(_ink.Box, {
|
|
98
92
|
flexDirection: "column"
|
|
99
|
-
}, /*#__PURE__*/ _react.createElement(
|
|
93
|
+
}, /*#__PURE__*/ _react.createElement(_progressStatus.ProgressStatus, {
|
|
94
|
+
progress: progress
|
|
95
|
+
}), /*#__PURE__*/ _react.createElement(_ink.Box, {
|
|
100
96
|
flexDirection: "column",
|
|
101
97
|
marginLeft: 2,
|
|
102
98
|
marginY: 1
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
}, [
|
|
100
|
+
...threadInfo
|
|
101
|
+
].slice(Math.max(0, threadInfo.size - limit)).map((targetId)=>/*#__PURE__*/ _react.createElement(_threadItem.ThreadItem, {
|
|
102
|
+
key: targetId,
|
|
106
103
|
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
|
-
})));
|
|
104
|
+
})), hasMore && /*#__PURE__*/ _react.createElement(_ink.Text, null, "... (displaying most recent ", limit, ")"))));
|
|
117
105
|
}
|
|
@@ -3,6 +3,4 @@ import { Progress } from "../types/progressBarTypes";
|
|
|
3
3
|
export interface ProgressStatusProps {
|
|
4
4
|
progress: Progress;
|
|
5
5
|
}
|
|
6
|
-
export declare function ProgressStatus(props:
|
|
7
|
-
progress: Progress;
|
|
8
|
-
}): JSX.Element;
|
|
6
|
+
export declare function ProgressStatus(props: ProgressStatusProps): JSX.Element;
|
|
@@ -49,9 +49,9 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
49
49
|
}
|
|
50
50
|
function ThreadItem(props) {
|
|
51
51
|
const { targetId } = props;
|
|
52
|
-
return
|
|
52
|
+
return targetId ? /*#__PURE__*/ _react.createElement(_ink.Text, {
|
|
53
53
|
color: "whiteBright"
|
|
54
|
-
},
|
|
54
|
+
}, targetId, " ") : /*#__PURE__*/ _react.createElement(_ink.Text, {
|
|
55
55
|
color: "gray"
|
|
56
|
-
}, "
|
|
56
|
+
}, "IDLE");
|
|
57
57
|
}
|
package/lib/createReporter.js
CHANGED
|
@@ -23,6 +23,11 @@ function createReporter({ reporter ="npmLog" , progress =false , grouped =false
|
|
|
23
23
|
grouped,
|
|
24
24
|
logLevel: verbose ? _logger.LogLevel.verbose : logLevel
|
|
25
25
|
});
|
|
26
|
+
case "old":
|
|
27
|
+
return new _logReporterJs.LogReporter({
|
|
28
|
+
grouped,
|
|
29
|
+
logLevel: verbose ? _logger.LogLevel.verbose : logLevel
|
|
30
|
+
});
|
|
26
31
|
default:
|
|
27
32
|
return progress ? new _progressReporterJs.ProgressReporter({
|
|
28
33
|
concurrency
|
|
@@ -5,9 +5,7 @@ export interface Progress {
|
|
|
5
5
|
completed: number;
|
|
6
6
|
total: number;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
9
|
-
[threadId: string]: string;
|
|
10
|
-
}
|
|
8
|
+
export type ThreadInfo = Set<string>;
|
|
11
9
|
export interface SummaryWithLogs {
|
|
12
10
|
schedulerRunSummary: SchedulerRunSummary;
|
|
13
11
|
logEntries: Map<string, LogEntry[]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lage-run/reporters",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.44",
|
|
4
4
|
"description": "Log reporters for Lage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/microsoft/lage"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"react": "^18.2.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@types/react": "18.0.
|
|
29
|
+
"@types/react": "18.0.26",
|
|
30
30
|
"memory-streams": "0.1.3"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|