pub struct Task {
pub id: usize,
pub created_at: DateTime<Local>,
pub original_command: String,
pub command: String,
pub path: PathBuf,
pub envs: HashMap<String, String>,
pub group: String,
pub dependencies: Vec<usize>,
pub priority: i32,
pub label: Option<String>,
pub status: TaskStatus,
}
Expand description
Representation of a task.
start will be set the second the task starts processing.
result
, output
and end
won’t be initialized, until the task has finished.
Fields§
§id: usize
§created_at: DateTime<Local>
§original_command: String
§command: String
§path: PathBuf
§envs: HashMap<String, String>
§group: String
§dependencies: Vec<usize>
§priority: i32
§label: Option<String>
§status: TaskStatus
Implementations§
Source§impl Task
impl Task
pub fn new( original_command: String, path: PathBuf, envs: HashMap<String, String>, group: String, starting_status: TaskStatus, dependencies: Vec<usize>, priority: i32, label: Option<String>, ) -> Task
pub fn start_and_end( &self, ) -> (Option<DateTime<Local>>, Option<DateTime<Local>>)
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Whether the task is having a running process managed by the TaskHandler
Sourcepub fn is_paused(&self) -> bool
pub fn is_paused(&self) -> bool
Whether the task is a running, but paused process managed by the TaskHandler.
Sourcepub fn failed(&self) -> bool
pub fn failed(&self) -> bool
Check if the task errored.
It either:
- Finished successfully
- Didn’t finish yet.
Sourcepub fn is_stashed(&self) -> bool
pub fn is_stashed(&self) -> bool
Convenience helper on whether a task is stashed
Trait Implementations§
Source§impl Debug for Task
We use a custom Debug
implementation for Task, as the envs
field just has too much
info in it and makes the log output much too verbose.
impl Debug for Task
We use a custom Debug
implementation for Task, as the envs
field just has too much
info in it and makes the log output much too verbose.
Furthermore, there might be secrets in the environment, resulting in a possible leak if users copy-paste their log output for debugging.
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
Source§impl From<&Task> for EditableTask
impl From<&Task> for EditableTask
impl Eq for Task
impl StructuralPartialEq for Task
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.