Skip to content

Commit d367e51

Browse files
authored
Merge pull request #2224 from Jamesbarford/feat/status-page-endpoint
Feat; status page endpoint + ui skeleton
2 parents dfc63ee + 5d0a107 commit d367e51

File tree

12 files changed

+648
-10
lines changed

12 files changed

+648
-10
lines changed

database/src/lib.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ impl Ord for Commit {
199199

200200
/// The compilation profile (i.e., how the crate was built)
201201
#[derive(
202-
Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, serde::Serialize, serde::Deserialize,
202+
Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, serde::Deserialize, serde::Serialize,
203203
)]
204204
pub enum Profile {
205205
/// A checked build (i.e., no codegen)
@@ -356,9 +356,7 @@ impl PartialOrd for Scenario {
356356
/// https://doc.rust-lang.org/nightly/rustc/platform-support.html
357357
///
358358
/// Presently we only support x86_64
359-
#[derive(
360-
Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, serde::Serialize, serde::Deserialize,
361-
)]
359+
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
362360
pub enum Target {
363361
/// `x86_64-unknown-linux-gnu`
364362
X86_64UnknownLinuxGnu,
@@ -393,9 +391,7 @@ impl fmt::Display for Target {
393391
}
394392

395393
/// The codegen backend used for compilation.
396-
#[derive(
397-
Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, serde::Serialize, serde::Deserialize,
398-
)]
394+
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
399395
pub enum CodegenBackend {
400396
/// The default LLVM backend
401397
Llvm,
@@ -824,7 +820,7 @@ const BENCHMARK_REQUEST_STATUS_IN_PROGRESS_STR: &str = "in_progress";
824820
const BENCHMARK_REQUEST_STATUS_COMPLETED_STR: &str = "completed";
825821

826822
impl BenchmarkRequestStatus {
827-
pub(crate) fn as_str(&self) -> &str {
823+
pub fn as_str(&self) -> &str {
828824
match self {
829825
Self::WaitingForArtifacts => BENCHMARK_REQUEST_STATUS_WAITING_FOR_ARTIFACTS_STR,
830826
Self::ArtifactsReady => BENCHMARK_REQUEST_STATUS_ARTIFACTS_READY_STR,
@@ -986,6 +982,10 @@ impl BenchmarkRequest {
986982
self.created_at
987983
}
988984

985+
pub fn commit_date(&self) -> Option<DateTime<Utc>> {
986+
self.commit_date
987+
}
988+
989989
pub fn is_master(&self) -> bool {
990990
matches!(self.commit_type, BenchmarkRequestType::Master { .. })
991991
}
@@ -1100,8 +1100,8 @@ impl fmt::Display for BenchmarkJobStatus {
11001100
}
11011101
}
11021102

1103-
#[derive(Debug, Copy, Clone, PartialEq)]
1104-
pub struct BenchmarkSet(u32);
1103+
#[derive(Debug, Copy, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
1104+
pub struct BenchmarkSet(pub u32);
11051105

11061106
impl BenchmarkSet {
11071107
pub fn new(id: u32) -> Self {
@@ -1169,6 +1169,10 @@ impl BenchmarkJob {
11691169
pub fn status(&self) -> &BenchmarkJobStatus {
11701170
&self.status
11711171
}
1172+
1173+
pub fn created_at(&self) -> DateTime<Utc> {
1174+
self.created_at
1175+
}
11721176
}
11731177

11741178
/// Describes the final state of a job

site/frontend/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
"source": "src/pages/status.ts",
3939
"distDir": "dist/scripts"
4040
},
41+
"status_new": {
42+
"source": "src/pages/status_new.ts",
43+
"distDir": "dist/scripts"
44+
},
4145
"bootstrap": {
4246
"source": "src/pages/bootstrap.ts",
4347
"distDir": "dist/scripts"

site/frontend/src/pages/status_new.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import Status from "./status_new/page.vue";
2+
import {createApp} from "vue";
3+
import WithSuspense from "../components/with-suspense.vue";
4+
5+
const app = createApp(WithSuspense, {
6+
component: Status,
7+
});
8+
app.mount("#app");
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
type BenchmarkRequestStatusComplete = {
2+
state: "completed";
3+
completedAt: string;
4+
duration: number; // time in milliseconds
5+
};
6+
7+
type BenchmarkRequestStatusInProgress = {
8+
state: "in_progress";
9+
};
10+
11+
type BenchmarkRequestStatusArtifactsReady = {
12+
state: "artifacts_ready";
13+
};
14+
15+
export type BenchmarkRequestStatus =
16+
| BenchmarkRequestStatusComplete
17+
| BenchmarkRequestStatusInProgress
18+
| BenchmarkRequestStatusArtifactsReady;
19+
20+
type BenchmarkRequestTypeTry = {
21+
type: "Try";
22+
tag: string | null;
23+
parent_sha: string | null;
24+
pr: number;
25+
};
26+
27+
type BenchmarkRequestTypeMaster = {
28+
type: "Master";
29+
tag: string;
30+
parent_sha: string;
31+
pr: number;
32+
};
33+
34+
type BenchmarkRequestTypeRelease = {
35+
type: "Try";
36+
tag: string;
37+
};
38+
39+
type BenchmarkRequestType =
40+
| BenchmarkRequestTypeTry
41+
| BenchmarkRequestTypeMaster
42+
| BenchmarkRequestTypeRelease;
43+
44+
export type BenchmarkRequestComplete = {
45+
status: BenchmarkRequestStatusComplete;
46+
requestType: BenchmarkRequestType;
47+
commitDate: string | null;
48+
createdAt: string | null;
49+
backends: string[];
50+
profiles: string;
51+
errors: string[];
52+
};
53+
54+
export type BenchmarkRequestInProgress = {
55+
status: BenchmarkRequestStatusInProgress;
56+
requestType: BenchmarkRequestType;
57+
commitDate: string | null;
58+
createdAt: string | null;
59+
backends: string[];
60+
profiles: string;
61+
errors: string[];
62+
};
63+
64+
export type BenchmarkRequestArtifactsReady = {
65+
status: BenchmarkRequestStatusArtifactsReady;
66+
requestType: BenchmarkRequestType;
67+
commitDate: string | null;
68+
createdAt: string | null;
69+
backends: string[];
70+
profiles: string;
71+
errors: string[];
72+
};
73+
74+
export type BenchmarkRequest =
75+
| BenchmarkRequestComplete
76+
| BenchmarkRequestInProgress
77+
| BenchmarkRequestArtifactsReady;
78+
79+
export type BenchmarkJobStatusQueued = {
80+
state: "queued";
81+
};
82+
83+
export type BenchmarkJobStatusInProgress = {
84+
state: "in_progress";
85+
startedAt: string;
86+
collectorName: string;
87+
};
88+
89+
export type BenchmarkJobStatusFailed = {
90+
state: "failed";
91+
startedAt: string;
92+
completedAt: string;
93+
collectorName: string;
94+
};
95+
96+
export type BenchmarkJobStatusSuccess = {
97+
state: "success";
98+
startedAt: string;
99+
completedAt: string;
100+
collectorName: string;
101+
};
102+
103+
export type BenchmarkJobStatus =
104+
| BenchmarkJobStatusSuccess
105+
| BenchmarkJobStatusFailed
106+
| BenchmarkJobStatusInProgress
107+
| BenchmarkJobStatusQueued;
108+
109+
export type BenchmarkJob = {
110+
target: string;
111+
backend: string;
112+
profile: string;
113+
requestTag: string;
114+
benchmarkSet: number;
115+
createdAt: string;
116+
status: BenchmarkJobStatus;
117+
dequeCounter: number;
118+
};
119+
120+
export type CollectorConfig = {
121+
name: string;
122+
target: string;
123+
benchmarkSet: number;
124+
isActive: boolean;
125+
lastHeartbeatAt: string;
126+
dateAdded: string;
127+
};
128+
129+
export type StatusResponseInProgress = {
130+
request: BenchmarkRequestInProgress;
131+
jobs: BenchmarkJob[];
132+
};
133+
134+
export type StatusResponse = {
135+
completed: BenchmarkRequestComplete[];
136+
inProgress: StatusResponseInProgress[];
137+
collectorConfigs: CollectorConfig[];
138+
queue: BenchmarkRequest[];
139+
};

0 commit comments

Comments
 (0)