Skip to content

Commit

Permalink
feat: display worker running job assign time
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Jun 4, 2024
1 parent 719400c commit decd9a8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@
"vite-plugin-vuetify": "^2.0.0",
"vue-router": "^4.2.0",
"vue-tsc": "^1.8.0"
}
},
"packageManager": "[email protected]+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72"
}
5 changes: 5 additions & 0 deletions frontend/src/pages/workers/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
<router-link :to="{ path: `/jobs/${(item as Worker).running_job_id}` }">
# {{ (item as Worker).running_job_id }}
</router-link>
{{
(item as Worker).running_job_assign_time !== null && (item as Worker).running_job_assign_time !== undefined ?
" since " + new TimeAgo('en-US').format(new Date((item as Worker).running_job_assign_time)) : ""
}}
</div>
</template>
</v-data-table-server>
Expand Down Expand Up @@ -78,6 +82,7 @@
memory_bytes: number;
disk_free_space_bytes: number;
running_job_id: number;
running_job_assign_time: string;
}
export default {
Expand Down
4 changes: 3 additions & 1 deletion server/src/routes/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub struct WorkerListResponseItem {
last_heartbeat_time: DateTime<Utc>,
// status
running_job_id: Option<i32>,
running_job_assign_time: Option<chrono::DateTime<chrono::Utc>>,
}

#[derive(Serialize)]
Expand Down Expand Up @@ -114,7 +115,8 @@ pub async fn worker_list(
disk_free_space_bytes: worker.disk_free_space_bytes,
is_live: worker.last_heartbeat_time > deadline,
last_heartbeat_time: worker.last_heartbeat_time,
running_job_id: job.map(|job| job.id),
running_job_id: job.as_ref().map(|job| job.id),
running_job_assign_time: job.and_then(|job| job.assign_time),
});
}

Expand Down

0 comments on commit decd9a8

Please sign in to comment.