From af4a79e1e079f6480d58d7f93f51f7130cd3d4e6 Mon Sep 17 00:00:00 2001 From: haixuanTao Date: Wed, 29 Mar 2023 14:22:23 +0800 Subject: [PATCH] Remove `base_path` from dataflow description --- libraries/core/src/descriptor/mod.rs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/libraries/core/src/descriptor/mod.rs b/libraries/core/src/descriptor/mod.rs index ad1b1ab0..24ab0184 100644 --- a/libraries/core/src/descriptor/mod.rs +++ b/libraries/core/src/descriptor/mod.rs @@ -25,8 +25,6 @@ pub struct Descriptor { pub nodes: Vec, #[serde(default)] pub daemon_config: DaemonCommunicationConfig, - #[serde(default)] - pub base_path: PathBuf, } pub const SINGLE_OPERATOR_DEFAULT_ID: &str = "op"; @@ -101,25 +99,21 @@ impl Descriptor { let buf = tokio::fs::read(path) .await .context("failed to open given file")?; - Descriptor::parse(buf, path) + Descriptor::parse(buf) } pub fn blocking_read(path: &Path) -> eyre::Result { let buf = std::fs::read(path).context("failed to open given file")?; - Descriptor::parse(buf, path) + Descriptor::parse(buf) } - pub fn parse(buf: Vec, path: &Path) -> eyre::Result { - let mut descriptor: Descriptor = - serde_yaml::from_slice(&buf).context("failed to parse given descriptor")?; - let base = path.canonicalize().unwrap().parent().unwrap().to_owned(); - descriptor.base_path = base; - - Ok(descriptor) + pub fn parse(buf: Vec) -> eyre::Result { + serde_yaml::from_slice(&buf).context("failed to parse given descriptor") } - pub fn is_valid(&self) -> eyre::Result<()> { - validate::check_dataflow(self).wrap_err("Dataflow could not be validated.") + pub fn check(&self, path: &Path, runtime_path: Option) -> eyre::Result<()> { + validate::check_dataflow(self, path, runtime_path) + .wrap_err("Dataflow could not be validated.") } }