Skip to content

Commit 13ff559

Browse files
committed
task id is now string
1 parent 68da651 commit 13ff559

File tree

5 files changed

+25
-26
lines changed

5 files changed

+25
-26
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ default-members = ["compute"]
77

88
[workspace.package]
99
edition = "2021"
10-
version = "0.5.6"
10+
version = "0.5.7"
1111
license = "Apache-2.0"
1212
readme = "README.md"
1313

compute/src/reqres/task.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ impl TaskResponder {
3232
Err(err) => {
3333
let err_string = format!("{:#}", err);
3434
log::error!(
35-
"Task {}/{} failed due to parsing error: {}",
36-
task.file_id,
37-
task.task_id,
35+
"Task {} failed due to parsing error: {}",
36+
task.row_id,
3837
err_string
3938
);
4039

@@ -103,10 +102,9 @@ impl TaskResponder {
103102
Ok(result) => {
104103
// prepare signed and encrypted payload
105104
log::info!(
106-
"Publishing {} result for {}/{}",
105+
"Publishing {} result for {}",
107106
"task".yellow(),
108-
task_metadata.file_id,
109-
task_metadata.task_id
107+
task_output.row_id
110108
);
111109

112110
// TODO: will get better token count from `TaskWorkerOutput`
@@ -131,12 +129,7 @@ impl TaskResponder {
131129
Err(err) => {
132130
// use pretty display string for error logging with causes
133131
let err_string = format!("{:#}", err);
134-
log::error!(
135-
"Task {}/{} failed: {}",
136-
task_metadata.file_id,
137-
task_metadata.task_id,
138-
err_string
139-
);
132+
log::error!("Task {} failed: {}", task_output.row_id, err_string);
140133

141134
// prepare error payload
142135
let error_payload = TaskResponsePayload {

compute/src/workers/task.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use uuid::Uuid;
1010
/// This is put into a map before execution, and then removed after the task is done.
1111
pub struct TaskWorkerMetadata {
1212
pub model_name: String,
13-
pub task_id: Uuid,
13+
pub task_id: String,
1414
pub file_id: Uuid,
1515
/// If for any reason this object is dropped before `channel` is responded to,
1616
/// the task will be lost and the channel will be abruptly closed, causing an error on

utils/src/payloads/tasks.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,18 @@ pub const TASK_RESULT_TOPIC: &str = "results";
1212
/// `result` and `error` are mutually-exclusive, only one of them can be `Some`:
1313
/// - if `result` is `Some`, then it contains the result.
1414
/// - if `error` is `Some`, then it contains the error message.
15+
///
16+
/// Each task belongs to a file (uniquely identified by `file_id`), and has a unique identifier (`row_id`).
17+
/// THe `task_id` is a custom identifier given by a user.
1518
#[derive(Debug, Clone, Serialize, Deserialize)]
1619
#[serde(rename_all = "camelCase")]
1720
pub struct TaskResponsePayload {
18-
/// The unique identifier of the task.
19-
pub row_id: Uuid,
20-
/// The custom identifier of the task.
21-
pub task_id: Uuid,
2221
/// The file that this task is associated with.
2322
pub file_id: Uuid,
23+
/// The unique identifier of the task.
24+
pub row_id: Uuid,
25+
/// The custom identifier of the task, not necessarily unique.
26+
pub task_id: String,
2427
/// Name of the model used for this task.
2528
pub model: String,
2629
/// Stats about the task execution.
@@ -38,15 +41,18 @@ pub struct TaskResponsePayload {
3841
}
3942

4043
/// A generic task request, given by Dria.
44+
///
45+
/// Each task belongs to a file (uniquely identified by `file_id`), and has a unique identifier (`row_id`).
46+
/// THe `task_id` is a custom identifier given by a user.
4147
#[derive(Debug, Clone, Serialize, Deserialize)]
4248
#[serde(rename_all = "camelCase")]
4349
pub struct TaskRequestPayload<T> {
44-
/// The unique identifier of the task.
45-
pub row_id: Uuid,
46-
/// The unique identifier of the task.
47-
pub task_id: Uuid,
4850
/// The file that this task is associated with.
4951
pub file_id: Uuid,
52+
/// The unique identifier of the task.
53+
pub row_id: Uuid,
54+
/// The custom identifier of the task, not necessarily unique.
55+
pub task_id: String,
5056
/// The input to the compute function.
5157
pub input: T,
5258
}

0 commit comments

Comments
 (0)