Skip to content

fix(cml-tdengine/src/core/task.rs): Remove the batch with working status #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions cml-tdengine/src/core/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,23 @@ impl<D: IntoDsn + Clone + Sync> Task<Field> for TDengine<D> {
))
.unwrap();
});
let batch_info: Vec<BatchInfo> = taos
let mut batch_info: Vec<BatchInfo> = taos
.query("SELECT DISTINCT TBNAME, train_start_time FROM training_data.training_data")?
.deserialize()
.try_collect()?;

let batch_with_task: Vec<String> = taos
.query(format!(
"SELECT LAST(TBNAME) FROM task.task WHERE status IN ({})",
self.working_status()
.iter()
.map(|s| format!("'{}'", s))
.collect::<Vec<String>>()
.join(", ")
))?
.deserialize()
.try_collect()?;

// let task_info: Vec<TaskInfo> = taos
// .query(format!(
// "SELECT DISTINCT TBNAME, ts FROM task.task WHERE status IN ({})",
Expand Down Expand Up @@ -104,7 +116,7 @@ impl<D: IntoDsn + Clone + Sync> Task<Field> for TDengine<D> {
// if !timeout_clause.is_empty() {
// taos.exec("INSERT INTO ".to_owned() + &timeout_clause.join(" "))?;
// }
// batch_info.retain(|b| !batch_with_task.contains(&b.batch));
batch_info.retain(|b| !batch_with_task.contains(&b.batch));

let mut scratch_in_queue = Vec::<String>::new();
let mut fining_in_queue = Vec::<String>::new();
Expand Down