Skip to content

Commit

Permalink
feat: expose image_uri in tasks for executor
Browse files Browse the repository at this point in the history
  • Loading branch information
seriousben committed Dec 20, 2024
1 parent 4b61e6f commit 5d9a961
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
2 changes: 2 additions & 0 deletions python-sdk/indexify/executor/api_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class Task(BaseModel):
input_key: str
reducer_output_id: Optional[str] = None
graph_version: int
image_uri: Optional[str] = None
"image_uri defines the URI of the image of this task. Optional since some executors do not require it."


class ExecutorMetadata(BaseModel):
Expand Down
23 changes: 6 additions & 17 deletions server/data_model/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,24 +188,10 @@ impl Node {
}
}

pub fn image_version(&self) -> &u32 {
pub fn image_uri(&self) -> Option<String> {
match self {
Node::Router(router) => &router.image_information.version.0,
Node::Compute(compute) => &compute.image_information.version.0,
}
}

pub fn set_image_version(&mut self, image_version: ImageVersion) {
match self {
Node::Router(ref mut router) => router.image_information.version = image_version,
Node::Compute(ref mut compute) => compute.image_information.version = image_version,
}
}

pub fn image_version_next(self) -> ImageVersion {
match self {
Node::Router(router) => router.image_information.version.next(),
Node::Compute(compute) => compute.image_information.version.next(),
Node::Router(router) => router.image_information.image_uri.clone(),
Node::Compute(compute) => compute.image_information.image_uri.clone(),
}
}

Expand Down Expand Up @@ -269,6 +255,7 @@ impl Node {
.input_node_output_key(input_key.to_string())
.reducer_output_id(reducer_output_id)
.graph_version(graph_version)
.image_uri(self.image_uri())
.build()?;
Ok(task)
}
Expand Down Expand Up @@ -764,6 +751,7 @@ pub struct Task {
pub diagnostics: Option<TaskDiagnostics>,
pub reducer_output_id: Option<String>,
pub graph_version: GraphVersion,
pub image_uri: Option<String>,
}

impl Task {
Expand Down Expand Up @@ -883,6 +871,7 @@ impl TaskBuilder {
diagnostics: None,
reducer_output_id,
graph_version,
image_uri: self.image_uri.clone().flatten(),
};
Ok(task)
}
Expand Down

0 comments on commit 5d9a961

Please sign in to comment.