Refactoring some code

This commit is contained in:
Kinesin Data Technologies Incorporated
2022-09-29 10:22:44 -03:00
parent 838f2754cb
commit 00bf07db2b
3 changed files with 25 additions and 27 deletions
+1 -1
View File
@@ -246,7 +246,7 @@ pub async fn start_local_executor(
..TaskAttempt::new() ..TaskAttempt::new()
}, },
}; };
response.send(attempt).unwrap(); response.send(attempt.succeeded).unwrap();
})); }));
} }
Stop {} => { Stop {} => {
+24 -24
View File
@@ -1,6 +1,30 @@
use super::*; use super::*;
pub mod local_executor; pub mod local_executor;
/// Messages for interacting with an Executor
#[derive(Debug)]
pub enum ExecutorMessage {
/// Validate a set of tasks.
/// Errors
/// Returns the vector of task issues
ValidateTask {
details: serde_json::Value,
response: oneshot::Sender<Result<()>>,
},
/// Execute the given task, along with enough information
/// Errors
/// Will return `Err` if the tasks are invalid, according to the executor
ExecuteTask {
details: serde_json::Value,
varmap: VarMap,
output_options: TaskOutputOptions,
response: oneshot::Sender<bool>,
kill: oneshot::Receiver<()>,
},
Stop {},
}
fn default_bytes() -> usize { fn default_bytes() -> usize {
20480 20480
} }
@@ -41,30 +65,6 @@ impl Default for TaskOutputOptions {
} }
} }
/// Messages for interacting with an Executor
#[derive(Debug)]
pub enum ExecutorMessage {
/// Validate a set of tasks.
/// Errors
/// Returns the vector of task issues
ValidateTask {
details: serde_json::Value,
response: oneshot::Sender<Result<()>>,
},
/// Execute the given task, along with enough information
/// Errors
/// Will return `Err` if the tasks are invalid, according to the executor
ExecuteTask {
details: serde_json::Value,
varmap: VarMap,
output_options: TaskOutputOptions,
response: oneshot::Sender<TaskAttempt>,
kill: oneshot::Receiver<()>,
},
Stop {},
}
#[derive(Serialize, Deserialize, Debug, Clone)] #[derive(Serialize, Deserialize, Debug, Clone)]
pub struct TaskAttempt { pub struct TaskAttempt {
#[serde(default)] #[serde(default)]
-2
View File
@@ -1,7 +1,5 @@
use super::*; use super::*;
extern crate redis;
use futures::prelude::*; use futures::prelude::*;
use redis::AsyncCommands; use redis::AsyncCommands;