From 24dcb9e0f7bf3bc2275cae3d4146df9683cdd5c4 Mon Sep 17 00:00:00 2001 From: sPuntinG Date: Tue, 7 Apr 2026 19:26:24 +0200 Subject: [PATCH] first working version of pipeline 0 --- snt_setup/.gitignore | 3 +++ snt_setup/pipeline.py | 36 ++++++++++++++++++++++++++++++++++++ snt_setup/requirements.txt | 2 ++ 3 files changed, 41 insertions(+) create mode 100644 snt_setup/.gitignore create mode 100644 snt_setup/pipeline.py create mode 100644 snt_setup/requirements.txt diff --git a/snt_setup/.gitignore b/snt_setup/.gitignore new file mode 100644 index 0000000..b6437ea --- /dev/null +++ b/snt_setup/.gitignore @@ -0,0 +1,3 @@ +workspace/ +workspace.yaml +.vscode/ \ No newline at end of file diff --git a/snt_setup/pipeline.py b/snt_setup/pipeline.py new file mode 100644 index 0000000..3b22bc5 --- /dev/null +++ b/snt_setup/pipeline.py @@ -0,0 +1,36 @@ +from pathlib import Path +from openhexa.sdk import current_run, pipeline, workspace + +@pipeline("snt_setup", name="0. SNT Setup", timeout=600) +def snt_folders_setup() -> None: + """ + A simple and robust pipeline to initialize the core folder + structure in an OpenHEXA workspace. + """ + current_run.log_info("Starting workspace folder setup...") + + # workspace.files_path points to the root of the workspace filesystem + root_path = Path(workspace.files_path) + + # The strictly requested folders + folders_to_create = [ + "configuration", + "code", + "data", + "pipelines", + "results", + ] + + for folder in folders_to_create: + folder_path = root_path / folder + try: + folder_path.mkdir(parents=True, exist_ok=True) + current_run.log_info(f"Successfully created or verified existence of directory: '{folder_path}'.") + except Exception as e: + current_run.log_error(f"Failed to create directory {folder}: {e}") + raise Exception(f"Pipeline failed while creating {folder}") from e + + current_run.log_info("Workspace folder setup completed successfully!") + +if __name__ == "__main__": + snt_folders_setup() \ No newline at end of file diff --git a/snt_setup/requirements.txt b/snt_setup/requirements.txt new file mode 100644 index 0000000..e4cb4a6 --- /dev/null +++ b/snt_setup/requirements.txt @@ -0,0 +1,2 @@ +openhexa.toolbox @ git+https://github.com/BLSQ/openhexa-toolbox@main +snt_lib @ git+https://git@github.com/BLSQ/snt_utils.git \ No newline at end of file