|
1 | | -export interface Commit { |
2 | | - sha: string; |
3 | | - date: string; |
4 | | - type: "Try" | "Master"; |
5 | | -} |
| 1 | +export type BenchmarkRequestType = "Release" | "Master" | "Try"; |
| 2 | +export type BenchmarkRequestStatus = "Queued" | "InProgress" | "Completed"; |
6 | 3 |
|
7 | | -export interface BenchmarkError { |
8 | | - name: string; |
9 | | - error: string; |
10 | | -} |
11 | | - |
12 | | -interface Step { |
13 | | - step: string; |
14 | | - is_done: boolean; |
15 | | - expected_duration: number; |
16 | | - current_progress: number; |
17 | | -} |
| 4 | +export type BenchmarkRequest = { |
| 5 | + tag: string; |
| 6 | + pr: number | null; |
| 7 | + status: BenchmarkRequestStatus; |
| 8 | + requestType: BenchmarkRequestType; |
| 9 | + createdAt: string; |
| 10 | + completedAt: string | null; |
| 11 | + endEstimated: boolean; |
| 12 | + durationS: number | null; |
| 13 | + errors: Dict<string>; |
| 14 | +}; |
18 | 15 |
|
19 | | -export type Artifact = |
20 | | - | { |
21 | | - Commit: Commit; |
22 | | - } |
23 | | - | { |
24 | | - Tag: string; |
25 | | - }; |
| 16 | +export type BenchmarkJobStatus = "Queued" | "InProgress" | "Success" | "Failed"; |
| 17 | +export type BenchmarkJobKind = "compiletime" | "runtimeInProgress" | "rustc"; |
26 | 18 |
|
27 | | -export type MissingReason = |
28 | | - | { |
29 | | - Master: { |
30 | | - pr: number; |
31 | | - parent_sha: string; |
32 | | - is_try_parent: boolean; |
33 | | - }; |
34 | | - } |
35 | | - | { |
36 | | - Try: { |
37 | | - pr: number; |
38 | | - parent_sha: string; |
39 | | - include: string | null; |
40 | | - exclude: string | null; |
41 | | - runs: number | null; |
42 | | - backends: string | null; |
43 | | - }; |
44 | | - } |
45 | | - | { |
46 | | - InProgress: MissingReason; |
47 | | - }; |
| 19 | +export type BenchmarkJob = { |
| 20 | + requestTag: string; |
| 21 | + kind: BenchmarkJobKind; |
| 22 | + target: string; |
| 23 | + backend: string; |
| 24 | + profile: string; |
| 25 | + benchmarkSet: number; |
| 26 | + createdAt: string; |
| 27 | + startedAt: string | null; |
| 28 | + completedAt: string | null; |
| 29 | + status: BenchmarkJobStatus; |
| 30 | + dequeCounter: number; |
| 31 | +}; |
48 | 32 |
|
49 | | -interface CurrentState { |
50 | | - artifact: Artifact; |
51 | | - progress: Step[]; |
52 | | -} |
| 33 | +export type CollectorConfig = { |
| 34 | + name: string; |
| 35 | + target: string; |
| 36 | + benchmarkSet: number; |
| 37 | + isActive: boolean; |
| 38 | + lastHeartbeatAt: string; |
| 39 | + dateAdded: string; |
| 40 | + jobs: BenchmarkJob[]; |
| 41 | +}; |
53 | 42 |
|
54 | | -export interface FinishedRun { |
55 | | - artifact: Artifact; |
56 | | - pr: number | null; |
57 | | - errors: BenchmarkError[]; |
58 | | - duration: number; |
59 | | - finished_at: number; |
60 | | -} |
| 43 | +export type StatusResponse = { |
| 44 | + requests: BenchmarkRequest[]; |
| 45 | + collectors: CollectorConfig[]; |
| 46 | +}; |
61 | 47 |
|
62 | | -export interface StatusResponse { |
63 | | - finished_runs: FinishedRun[]; |
64 | | - current: CurrentState | null; |
65 | | - missing: Array<[Commit, MissingReason]>; |
| 48 | +export function isJobComplete(job: BenchmarkJob): boolean { |
| 49 | + return job.status === "Failed" || job.status === "Success"; |
66 | 50 | } |
0 commit comments