-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add core type and kube driver api
- Loading branch information
hunjixin
committed
Jun 13, 2024
1 parent
dfcdf8b
commit 25a9727
Showing
17 changed files
with
457 additions
and
334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# 详细设计 | ||
|
||
|
||
## spec配置定义 | ||
```json | ||
{ | ||
"name": "example", | ||
"version": "v1", | ||
"dag": [ | ||
{ | ||
"id": "5c42b900-a87f-45e3-ba06-c40d94ad5ba2", | ||
"name": "ComputeUnit1", | ||
"dependency": [ | ||
|
||
], | ||
"spec": { | ||
"cmd": [ | ||
"ls" | ||
], | ||
"image": "" | ||
}, | ||
"channel": { | ||
"spec": { | ||
"cmd": [ | ||
"bufsize", | ||
"1024" | ||
], | ||
"image": "jiaozifs:" | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "353fc5bf-697e-4221-8487-6ab91915e2a1", | ||
"name": "ComputeUnit2", | ||
"node_type": "ComputeUnit", | ||
"dependency": [ | ||
"5c42b900-a87f-45e3-ba06-c40d94ad5ba2" | ||
], | ||
"spec": { | ||
"cmd": [ | ||
"ls" | ||
], | ||
"image": "" | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## Graph | ||
|
||
1. 节点= 节点+数据管道(可选) | ||
|
||
## job 控制器 | ||
|
||
追踪整个job的运行状态,处理重试,日志,状态收集的问题的问题 | ||
|
||
## Pipe流控制器 | ||
|
||
负责pipeline的部署,及状态监控 | ||
|
||
## 节点控制 | ||
|
||
控制节点和数据管道的部署,操纵及状态监控 | ||
* deploy | ||
* status | ||
* monitor | ||
|
||
# 节点接口设计 | ||
|
||
## 节点程序接口设计 | ||
|
||
* init | ||
* start | ||
* restart | ||
* pause | ||
* stop | ||
* subscribe | ||
|
||
## 数据通道程序接口设计 | ||
|
||
* init | ||
* start | ||
* restart | ||
* pause | ||
* stop | ||
* subscribe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
use super::{MachineSpec, GID}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
// Channel use to definite data transfer channel | ||
#[derive(Serialize, Deserialize, Debug, Clone)] | ||
pub struct Channel { | ||
pub spec: MachineSpec, | ||
} | ||
|
||
// ComputeUnit used to define logic for data generation, transformer, ouput. | ||
#[derive(Serialize, Deserialize, Debug, Clone)] | ||
pub struct ComputeUnit<ID> | ||
where | ||
ID: GID, | ||
{ | ||
#[serde(bound(deserialize = ""))] | ||
pub id: ID, | ||
|
||
pub name: String, | ||
|
||
pub spec: MachineSpec, | ||
|
||
pub channel: Option<Channel>, | ||
|
||
#[serde(bound(deserialize = ""))] | ||
pub(crate) dependency: Vec<ID>, | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
use uuid::Uuid; | ||
|
||
#[test] | ||
fn test_from_str() { | ||
xxx(); | ||
} | ||
|
||
fn xxx() -> ComputeUnit<Uuid> { | ||
let json_str = r#" | ||
{ | ||
"id": "5c42b900-a87f-45e3-ba06-c40d94ad5ba2", | ||
"name": "ComputeUnit1", | ||
"dependency": [ | ||
], | ||
"spec": { | ||
"cmd": [ | ||
"ls" | ||
], | ||
"image": "" | ||
}, | ||
"channel": { | ||
"spec": { | ||
"cmd": [ | ||
"ls" | ||
], | ||
"image": "" | ||
} | ||
} | ||
} | ||
"# | ||
.to_owned(); | ||
serde_json::from_str::<ComputeUnit<Uuid>>(&json_str).unwrap() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use std::hash::Hash; | ||
use std::marker::Send; | ||
|
||
pub trait GID = Eq + Clone + Copy + Hash + Send + Sync + Serialize + for<'de> Deserialize<'de>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
mod cnode; | ||
mod id; | ||
mod spec; | ||
|
||
pub use cnode::*; | ||
pub use id::*; | ||
pub use spec::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
// MachineSpec container information for deploy and running in cloud | ||
#[derive(Serialize, Deserialize, Debug, Clone)] | ||
pub struct MachineSpec { | ||
pub image: String, | ||
pub cmd: Vec<String>, | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.