Compare commits

...

Author SHA1 Message Date
  Philipp Oppermann 60e4d7dd41
Fix path checks for nodes on remote machines 1 year ago
2 changed files with 24 additions and 10 deletions
Split View
  1. +11
    -6
      libraries/core/src/descriptor/mod.rs
  2. +13
    -4
      libraries/core/src/descriptor/validate.rs

+ 11
- 6
libraries/core/src/descriptor/mod.rs View File

@@ -417,12 +417,7 @@ pub fn source_is_url(source: &str) -> bool {
}

pub fn resolve_path(source: &str, working_dir: &Path) -> Result<PathBuf> {
let path = Path::new(&source);
let path = if path.extension().is_none() {
path.with_extension(EXE_EXTENSION)
} else {
path.to_owned()
};
let path = source_to_path(source);

// Search path within current working directory
if let Ok(abs_path) = working_dir.join(&path).canonicalize() {
@@ -435,6 +430,16 @@ pub fn resolve_path(source: &str, working_dir: &Path) -> Result<PathBuf> {
}
}

fn source_to_path(source: &str) -> PathBuf {
let path = Path::new(&source);
let path = if path.extension().is_none() {
path.with_extension(EXE_EXTENSION)
} else {
path.to_owned()
};
path
}

#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(deny_unknown_fields)]
pub struct PythonOperatorConfig {


+ 13
- 4
libraries/core/src/descriptor/validate.rs View File

@@ -1,7 +1,7 @@
use crate::{
adjust_shared_library_path,
config::{DataId, Input, InputMapping, OperatorId, UserInputMapping},
descriptor::{self, source_is_url, CoreNodeKind, OperatorSource},
descriptor::{self, source_is_url, source_to_path, CoreNodeKind, OperatorSource},
get_python_path,
};

@@ -19,15 +19,24 @@ pub fn check_dataflow(dataflow: &Descriptor, working_dir: &Path) -> eyre::Result
// check that nodes and operators exist
for node in &nodes {
match &node.kind {
descriptor::CoreNodeKind::Custom(node) => match node.source.as_str() {
descriptor::CoreNodeKind::Custom(custom) => match custom.source.as_str() {
SHELL_SOURCE => (),
source => {
if source_is_url(source) {
info!("{source} is a URL."); // TODO: Implement url check.
} else {
} else if node.deploy.machine.is_empty() {
resolve_path(source, working_dir)
.wrap_err_with(|| format!("Could not find source path `{}`", source))?;
};
} else {
let path = source_to_path(source);
if path.is_relative() {
eyre::bail!(
"paths of remote nodes must be absolute (node `{}`)",
node.id
);
}
info!("skipping path check for remote node `{}`", node.id);
}
}
},
descriptor::CoreNodeKind::Runtime(node) => {


Loading…
Cancel
Save