Skip to content
Open
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
29 changes: 15 additions & 14 deletions orchestration/flows/scicat/ingest.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from typing import Optional, Dict, Any
from pathlib import Path
from typing import Dict, Any

from prefect import flow, get_run_logger


from scicat_beamline import ingest


@flow(name="scicat-ingest-flow")
def scicat_ingest_flow(
dataset_path: Path,
dataset_path: Path | list[Path],
ingester_spec: str | None = None,
owner_username: str | None = None,
scicat_url: str | None = None,
Expand All @@ -19,18 +18,20 @@ def scicat_ingest_flow(
"""
Runs the SciCat ingestion process implemented for the given spec identifier,
on the given folder or file.
Args:
dataset_path: Path of the asset to ingest. May be file or directory depending on the spec.

:param dataset_path: Path or list of Paths of the asset(s) to ingest. May be file or directory depending on the spec.
If SICAT_INGEST_INTERNAL_BASE_FOLDER or SCICAT_INGEST_BASE_FOLDER is set, this path is
considered relative to that base folder.
These remaining args are optional; if not provided, environment variables will be used.
ingester_spec: Spec to ingest with. (or set SCICAT_INGEST_INGESTER_SPEC)
owner_username: User doing the ingesting. May be different from the user_name, especially if using a token (or set SCICAT_INGEST_OWNER_USERNAME)
scicat_url: Scicat server base url. If not provided, will try localhost default (or set SCICAT_INGEST_URL)
scicat_username: Scicat server username (or set SCICAT_INGEST_USERNAME)
scicat_password: Scicat server password (or set SCICAT_INGEST_PASSWORD)
Returns:
Dict containing task results or skip message

These remaining args are optional; if not provided, environment variables will be used:

:param ingester_spec: Spec to ingest with. (or set SCICAT_INGEST_INGESTER_SPEC)
:param owner_username: User doing the ingesting. May be different from the user_name, especially if using a token
(or set SCICAT_INGEST_OWNER_USERNAME)
:param scicat_url: Scicat server base url. If not provided, will try localhost default (or set SCICAT_INGEST_URL)
:param scicat_username: Scicat server username (or set SCICAT_INGEST_USERNAME)
:param scicat_password: Scicat server password (or set SCICAT_INGEST_PASSWORD)
:returns: Dict containing task results or skip message
"""
# Get the Prefect logger for the current flow run
prefect_adapter = get_run_logger()
Expand All @@ -47,4 +48,4 @@ def scicat_ingest_flow(


if __name__ == "__main__":
pass
pass