Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions snt_setup/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
workspace/
workspace.yaml
.vscode/
36 changes: 36 additions & 0 deletions snt_setup/pipeline.py
Original file line number Diff line number Diff line change
@@ -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()
2 changes: 2 additions & 0 deletions snt_setup/requirements.txt
Original file line number Diff line number Diff line change
@@ -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