pub struct Task {
pub kind: String,
pub version: String,
pub metadata: Metadata,
pub spec: TaskSpec,
pub status: Option<TaskStatus>,
}
Expand description
Represents a complete task definition with metadata, specification and status
§Examples
Creating a basic task:
use crate::models::Task;
let task = serde_json::from_str::<Task>(r#"{
"kind": "Task",
"version": "v0",
"spec": {
"image": "ubuntu:latest",
"command": ["echo", "hello"],
"resources": {
"cpus": "1cpu",
"gpus": "0gpu",
"memory": "512mb",
"time": "1h"
}
}
}"#).unwrap();
Task with input/output contexts:
let task = serde_json::from_str::<Task>(r#"{
"kind": "Task",
"version": "v0",
"spec": {
"image": "processor:v1",
"inputContexts": [{
"source": "input-data",
"target": "/data"
}],
"outputContexts": [{
"source": "/results",
"retentionPeriod": 86400
}],
"resources": {
"cpus": "2cpu",
"gpus": "1gpu",
"memory": "4gb",
"time": "2h"
}
}
}"#).unwrap();
Fields§
§kind: String
§version: String
§metadata: Metadata
§spec: TaskSpec
§status: Option<TaskStatus>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Task
impl<'de> Deserialize<'de> for Task
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Task
impl RefUnwindSafe for Task
impl Send for Task
impl Sync for Task
impl Unpin for Task
impl UnwindSafe for Task
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request