Skip to content

Commit

Permalink
Add placeholder last runs psql
Browse files Browse the repository at this point in the history
  • Loading branch information
hlinander committed May 14, 2024
1 parent 7cfe830 commit c46e709
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions rust/vis/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3399,6 +3399,30 @@ async fn get_state_metrics(
}
Ok(())
}
async fn get_last_runs_log(
pool: &sqlx::Pool<sqlx::Postgres>,
// runs: &mut HashMap<String, Run>,
// tx_runs: Option<&SyncSender<HashMap<String, Run>>>,
) -> Result<(), sqlx::Error> {
// let mut new_epoch_timestamp = last_timestamp.clone();
let q = format!(
r#"
SELECT train_id,
CURRENT_TIMESTAMP - MAX(created_at) AS time_since_last
FROM (
SELECT train_id, created_at
FROM metrics
ORDER BY created_at DESC limit 100
) AS sorted_table
GROUP BY train_id limit 10;
"#,
);
let runs_with_time_rows = sqlx::query(q.as_str())
// .bind(offset)
.fetch_all(pool)
.await?;
Ok(())
}

async fn get_state_epoch_metrics(
train_ids: &Vec<String>,
Expand Down

0 comments on commit c46e709

Please sign in to comment.