38
src/models/job.rs
Normal file
38
src/models/job.rs
Normal file
@@ -0,0 +1,38 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models::ScriptType, time::Timestamp};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct Job {
|
||||
/// Job Id, this is given by the actor who created the job
|
||||
id: u32,
|
||||
/// Actor ID which created this job
|
||||
caller_id: u32,
|
||||
/// Context in which the job is executed
|
||||
context_id: u32,
|
||||
script: String,
|
||||
script_type: ScriptType,
|
||||
/// Timeout in seconds for this job
|
||||
timeout: u32,
|
||||
/// Max amount of times to retry this job
|
||||
retries: u8,
|
||||
env_vars: HashMap<String, String>,
|
||||
result: HashMap<String, String>,
|
||||
prerequisites: Vec<String>,
|
||||
/// Ids of jobs this job depends on, i.e. this job can't start until those have finished
|
||||
depends: Vec<u32>,
|
||||
created_at: Timestamp,
|
||||
updated_at: Timestamp,
|
||||
status: JobStatus,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub enum JobStatus {
|
||||
Dispatched,
|
||||
WaitingForPrerequisites,
|
||||
Started,
|
||||
Error,
|
||||
Finished,
|
||||
}
|
Reference in New Issue
Block a user