pub struct Task {Show 15 fields
pub id: usize,
pub created_at: DateTime<Local>,
pub enqueued_at: Option<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,
pub prev_status: TaskStatus,
pub start: Option<DateTime<Local>>,
pub end: Option<DateTime<Local>>,
}
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>
§enqueued_at: Option<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
§prev_status: TaskStatus
This field is only used when editing the path/command of a task.
It’s necessary, since we enter the Locked
state during editing.
However, we have to go back to the previous state after we finished editing.
TODO: Refactor this into a TaskStatus::Locked{previous_status: TaskStatus}
.
start: Option<DateTime<Local>>
§end: Option<DateTime<Local>>
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
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 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
sourcepub fn set_default_group(&mut self)
pub fn set_default_group(&mut self)
Small convenience function to set the task’s group to the default group.
pub fn is_in_default_group(&self) -> bool
Trait Implementations§
source§impl Debug for Task
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>,
source§impl PartialEq for Task
impl PartialEq for Task
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
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
key
and return true
if they are equal.