We are asked to design a scientific computing workflow manager with provenance tracking. We need to include task abstractions, dataset versioning, reproducibility guarantees, and collaboration spaces.
We need to design a system architecture, data model, key components, and maybe some API or workflow definition language. Also consider features like versioning, provenance (causal history), reproducibility (ensuring same results with same inputs/versions), and collaboration (shared spaces, access control, etc.). The answer should be detailed but organized. Possibly also discuss implementation choices, technology stack, and trade-offs.
We can outline a design similar to existing tools like Apache Airflow, Nextflow, Snakemake, but with stronger provenance and reproducibility focused on scientific computing. We'll need to handle tasks (computational steps), datasets (inputs/outputs), versioning (git-like but for data), collaboration (users, groups, projects, sharing). We'll discuss both DAG-based workflows and maybe dynamic or iterative workflows.
Also need to consider tracking software environment (containers, conda envs) for reproducibility. We'll talk about a central registry for tasks, datasets, and runs. Provide UI and CLI.
We need to produce a coherent answer. Let's structure:
- Introduction: goals and challenges.
- High-level architecture diagram (describe in words): components: client (CLI/GUI), workflow engine, metadata store (provenance), data store (object store or file system), registry for tasks and datasets, collaboration service.
- Data model: entities: Project, Workflow, Task, Dataset (versioned), Execution/Run, Artifact (output), Provenance record (edges). Use a graph database? Or relational? Might use a graph DB to capture DAG.
- Task abstraction: How tasks are defined (e.g., as functions with inputs/outputs, containers, scripts). Task registry: reusable task definitions with versioning. Task interfaces: input types, output types, parameters, resource requirements.
- Dataset versioning: Datasets as first-class objects. Each dataset version is immutable. Dataset objects stored in a content-addressable store (like git) with checksums. Datasets can be raw data, processed data, models. Versioning: branching, merging, tags.
- Provenance tracking: Automatically capture which task version ran on which dataset versions (inputs), produced which output dataset versions. Also capture environment (container image, parameters). Build a directed acyclic graph (or general graph) linking these. Query provenance: e.g., "what inputs produced this result?" or "what downstream uses this dataset?"
- Reproducibility guarantees: By pinning exact task versions (code + container), dataset versions, and environment, we can guarantee reproducibility. Support "replay" of a run to regenerate outputs. Also support "determinism checking" if needed. Provide tools for packaging tasks with dependencies (e.g., using containers or conda lock files).
- Collaboration spaces: Projects or workspaces where teams can share workflows, datasets, and runs. Access control (RBAC or ACL) at project, workflow, dataset level. Support comment threads on runs, review process for dataset versions (like data publishing). Maybe integration with external identity providers.
- Workflow definition: DSL for defining workflow steps, dependencies, inputs, outputs. Could be similar to Snakefile, Nextflow, CWL. But our manager will parse, validate, and submit to engine. The engine schedules tasks, handles data movement, tracks provenance.
- Execution engine: Distributed execution (on HPC, cloud, Kubernetes). Task launcher that pulls containers, mounts dataset volumes (or fetches from object store), records logs and outputs. Monitor resource usage, retries.
- Metadata store: Transactional database to store all entities and relationships. Should support queries. Could be PostgreSQL with adjacency lists, or graph DB like Neo4j. We'll design schema.
- Data storage: Use object storage (S3, GCS, Azure Blob) or shared filesystem. Datasets are stored as objects with unique content-addressed IDs. For large datasets, use chunking.
- API: RESTful GraphQL API for programmatic access, and CLI.
- User interface: Web UI for browsing projects, workflows, runs, datasets, and visualizing provenance graphs.
- Security: Authentication, authorization, audit logs.
- Scalability: Handling many tasks, large datasets. Use message queues for task scheduling. Divide into microservices.
- Extensibility: Plugins for different compute backends, data stores, VCS integration.
- Benefits and comparison: highlight how it differs from existing tools.
We need to be technical but not go too deep into code. Provide an overview that shows understanding of the problem.
The answer should be comprehensive, maybe around 1000-1500 words.
We also need to think about specific design decisions: e.g., dataset versioning may be implemented by storing data in a content-addressable store: compute hash of data content, store under that hash. That ensures immutability and deduplication. Then dataset version is a pointer to a specific hash and possibly metadata (who created, when). Datasets may also have multiple files; then the dataset version could be a manifest (list of file hashes). Or we could have a hierarchical structure: collections, datasets, versions.
Task abstractions: tasks as containers: define a container image (Docker, Singularity) and command; or as a script with conda environment. We'll need to define input and output dataset references. The engine will resolve input dataset versions and pass them to the task (e.g., mount them). Outputs are captured and stored as new dataset versions.
Reproducibility: We must also capture the exact task definition (including code version). So tasks should be versioned in a code repository (Git). We could integrate with Git: a task is identified by a repository URL and commit hash. Or we store task definition in our own registry with version history.
Provenance: Could store as triples: (run, used, dataset_version), (run, generated, dataset_version), (run, executed, task_version), (task_version, derived_from, ...). Also capture parameters. Build a graph that can be traversed to show lineage.
Collaboration spaces: Need to support multiple users working on same project, sharing datasets. Use a project model: project contains workflows and datasets. Users have roles: admin, contributor, viewer. Datasets can be published internally or externally.
Workflow definition language: We could design something like:
workflow my_analysis:
version: 1.0
tasks:
- task: preprocess
inputs:
raw_data: dataset:project/raw_data:latest
outputs:
preprocessed: dataset:project/preprocessed
task_ref: mytasks/preprocess@v1.2.3
- task: train
depends_on: preprocess
inputs:
data: preprocess.outputs.preprocessed
outputs:
model: dataset:project/model
task_ref: mytasks/train@v2.0
The engine resolves dependencies, ensures data availability, schedules tasks. It may also support dynamic generation of tasks based on parameters.
We should also discuss how we handle large datasets: we want to avoid copying data if not needed; use symlinks or mount read-only. Datasets stored in shared storage; tasks read from specific paths. The engine may track data locality.
Now, we can write the answer. We'll start with a brief intro: Scientific computing workflows often involve complex dependencies, large data, and require reproducibility and provenance. We propose a design for a workflow manager that addresses these needs.
Then we'll break down the components.
Let's structure the answer:
- Overview
- Core Concepts
- Projects and Collaboration Spaces
- Tasks and Task Registry
- Datasets and Versioning
- Workflows and Runs
- System Architecture
- Components
- CLI & UI
- Workflow Engine
- Metadata Store
- Data Store
- Task & Dataset Registry
- Collaboration Service
- Data Flow
- Detailed Design
- Task Abstraction (container-based, parameters)
- Dataset Versioning (content-addressing, manifest)
- Provenance Model (graph)
- Reproducibility Mechanisms (pinning, replay)
- Collaboration Features (sharing, access control)
- Execution Engine (scheduling, resource allocation)
- API and Extensibility
- Implementation Considerations
- Scalability (microservices, queues)
- Storage backends (object store, file system)
- Metadata backend (graph DB vs relational)
- Security
- Conclusion
We need to be careful not to go too far into implementation details that might be premature; but we can propose design choices.
Also note the requirement: "Design a scientific computing workflow manager with provenance tracking: task abstractions, dataset versioning, reproducibility guarantees, and collaboration spaces." So we must ensure each of these is covered.
Let's flesh out each part.
Overview: The system aims to provide a platform for computational scientists to define, execute, and share scientific workflows, with strong guarantees about reproducibility and automatic capture of provenance. It addresses challenges like data versioning, environment consistency, and team collaboration.
Core Concepts:
- Project: A top-level container for workflows, datasets, and runs. Belongs to an organization or user. Has members with roles.
- Task: A unit of computation. Defined by code (script, notebook, etc.), runtime environment (container image or Conda env), and declared inputs/outputs as dataset specifications. Tasks are versioned and stored in a registry.
- Dataset: A collection of data files (or references). Each dataset version is immutable. Versioning is automatic: when a task produces output, we store the data and create a new dataset version. Versions are addressed by content hash or by a logical name+version tag.
- Workflow: A directed graph of tasks, defined in a DSL or via API. Workflow version is also tracked.
- Run: An execution of a workflow with specific dataset versions (or resolutions like "latest"). Run records the exact task versions and dataset versions used, plus parameters and timestamps. It produces new dataset versions as outputs.
- Provenance: The complete graph linking runs, tasks, dataset versions, and even code commits. Allows tracing any result back to its origin.
System Architecture:
We'll have a set of microservices communicating via REST and message queues (e.g., RabbitMQ, Kafka). But we can also have a monolithic design for simplicity, but microservices better for scalability and modularity.
- Client: CLI and web UI.
- API Gateway: Entry point for clients; routes requests to appropriate services.
- Workflow Service: Handles workflow definitions, validation, submission. Interacts with registry.
- Task Registry Service: Stores task definitions, versioning, and artifact retrieval. May integrate with external VCS (Git) to pull code.
- Dataset Registry Service: Tracks dataset metadata, versions, and pointers to actual data storage. Not the storage itself.
- Metadata Store: A database (probably a graph DB) that stores all entities and relationships. Could be PostgreSQL with JSONB and adjacency tables; but for provenance graph, a graph DB like Neo4j or Amazon Neptune might be better. However, we can also use a relational schema with explicit edge tables. We'll say "graph-optimized database".
- Data Store: Object storage (S3, GCS) or distributed file system (HDFS). Stores actual dataset files and task outputs. Data is addressed by content hash (like Git LFS) for deduplication.
- Execution Engine: Scheduler and executor. Receives tasks from the workflow service (or a job queue), launches them on compute backends (Kubernetes, Slurm, AWS Batch). It also handles dataset staging: ensuring inputs are available locally (by copying/linking from object store). It captures logs and outputs, and after successful completion, registers new dataset versions with the Dataset Registry.
- Collaboration Service: Manages projects, teams, access control lists. Integrates with identity providers (OAuth, LDAP). Provides APIs for sharing.
- Provenance Service: Query API for lineage; may be just a front to the Metadata Store.
Data flow: User submits a workflow definition via CLI/UI. Workflow Service validates, resolves dataset references (e.g., "latest" or specific version), and creates a Run object in the Metadata Store. It then decomposes the workflow into tasks with dependencies and enqueues them to the Execution Engine (or the engine pulls from a queue). Execution Engine schedules tasks, materializes inputs (download dataset files to local disk or mount remote), runs task in container, collects outputs, and for each declared output dataset, stores data in the Data Store and registers new dataset version with Dataset Registry. It also records provenance: the run consumed input dataset versions and produced output dataset versions, and the task version used. All this is stored in the Metadata Store.
Detailed Design:
- Task Abstraction: We define a task via a manifest (YAML/JSON) or via a programming API (Python decorator). Example:
name: preprocess
version: 1.3.0
description: "Preprocess raw data"
image: docker://myorg/preprocess:1.3.0
inputs:
- name: raw_data
type: dataset
description: "Raw input dataset"
outputs:
- name: processed_data
type: dataset
description: "Processed dataset"
parameters:
- name: threshold
type: float
default: 0.5
command: python /app/preprocess.py --input {{inputs.raw_data}} --output {{outputs.processed_data}} --threshold {{parameters.threshold}}
The task registry assigns a unique identifier: task/<namespace>/<name>:<version>. The actual code can be stored in a Git repo and the image built from it. The registry stores the manifest and links to the image location.
Tasks can also be defined in a higher-level language like Nextflow, but we want to keep the task as a reusable component. The workflow DSL references tasks by their registry ID.
Alternatively, tasks could be defined as Python functions that are automatically containerized; but that's more complex.
- Dataset Versioning: A dataset is a logical collection of files. Each version is a snapshot of the dataset. When storing, we compute a content hash for each file (e.g., SHA256). If the same file content already exists in the Data Store, we don't store another copy (dedup). The dataset version records the mapping of logical file names to content hashes, plus overall metadata (creation time, run that produced it). The dataset version ID can be a deterministic hash of the entire manifest (including file hashes) to ensure identical datasets get same ID. This enables dedup across versions. The registry stores the manifest and the status (published, deprecated). Users can tag dataset versions with human-friendly tags (e.g., "release-1.0") and branch (like git branches). The "latest" tag always points to the most recent version in a branch.
Dataset versions are immutable. To update a dataset, you create a new version.
- Provenance Model: The core is a directed graph. Nodes:
Run, TaskVersion, DatasetVersion, Parameter (maybe). Edges: RUN_USED (Run -> DatasetVersion), RUN_GENERATED (Run -> DatasetVersion), RUN_EXECUTED (Run -> TaskVersion), TASK_DEPENDS_ON (TaskVersion -> TaskVersion?) Actually the workflow defines dependencies between tasks, but the provenance of a dataset includes the entire subgraph of runs that contributed to it. We can store each run as a node. Also track PARAMETER_VALUE edges for parameter settings.
We can model using a property graph. The Metadata Store will have tables: runs, tasks, datasets, versions, files, edges (run_used, run_generated, etc.). We can use a relational schema with foreign keys; but queries like "find all upstream datasets" would require recursive CTE. A graph DB simplifies.
We'll propose using a graph database with nodes having labels: Run, Task, Dataset, File (optional). Relationships like USED, GENERATED, DEPENDS_ON. Each node has properties (id, timestamp, etc.). This allows easy lineage queries.
-
Reproducibility Guarantees: To reproduce a result, one needs to re-run the same workflow with the same dataset versions and task versions. The system can "replay" a run: create a new run that uses the same input dataset versions and runs the same tasks (or the entire workflow). Because dataset versions are immutable and stored, and task versions are pinned, the outputs should be identical (bit-for-bit) if the computation is deterministic. For non-deterministic tasks (e.g., using random seeds), the seed should be a parameter to ensure reproducibility. The system can capture the complete execution environment: container image digest, host config, etc. All that is stored in the run's metadata. So we can guarantee that if the environment is reproduced exactly, the run will produce same outputs. Also, the system can optionally perform checksum verification of outputs to confirm.
-
Collaboration Spaces: Implemented as Projects. Each project is a namespace for datasets and workflows. Users can be added to a project with roles (Owner, Contributor, Viewer). All artifacts belong to a project. Sharing across projects is possible by explicit permission. Within a project, users can comment on runs, suggest changes, and approve dataset versions (like a data publishing workflow). There may be a "review" state for dataset versions before they become "released".
-
Workflow Definition: We'll design a DSL inspired by Snakemake and Nextflow but simpler and not tied to filesystem conventions. Example:
name: "my_analysis"
version: "0.1"
project: "my_org/cancer_study"
inputs:
- id: raw_samples
type: dataset
from: project/dataset/raw_data:latest
outputs:
- id: final_report
type: dataset
to: project/dataset/report
tasks:
- id: align
task: aligner/bwa@v2.0
inputs:
reads: raw_samples
outputs:
bam: aligned_bam
resources:
cpu: 8
memory: 16G
- id: variant_call
task: gatk/haplotype_caller@v3.0
depends_on: [align]
inputs:
bam: align.outputs.bam
reference: project/dataset/hg38
outputs:
vcf: variants
parameters:
minDepth: 10
- id: report
task: reporting/generate@v1.0
depends_on: [variant_call]
inputs:
vcf: variant_call.outputs.vcf
outputs:
html: final_report
The DSL includes project namespace to handle dataset references. The engine will resolve dataset references to specific versions (e.g., if "latest" is used, we get the most recent version at submission time). The engine creates a run and schedules tasks respecting dependencies.
- Execution Engine: Could be based on Argo Workflows or Airflow, but we need to handle data movement. It will launch tasks in containers on a cluster (Kubernetes pods, Slurm jobs). It will mount the input datasets as read-only volumes (e.g., using PersistentVolumeClaims or by downloading from object store to local). For large datasets, it might use a shared file system (NFS) to avoid copying. The engine ensures that tasks run in an environment that matches the task's specification: container image, environment variables, secrets.
The engine monitors task status; on success, it collects the outputs: any files written to the designated output locations are considered new dataset outputs. Instead of manually registering outputs, we can define in the task manifest which paths are outputs. After task completion, the engine will compute hashes of output files, create a dataset version manifest, and store files in the Data Store. It then notifies the Metadata Store to create provenance edges linking the run to input and output dataset versions.
If a task fails, the run is marked failed; provenance still records the attempt and may capture error logs.
-
Dataset Registry and Storage: The Dataset Registry maintains a database of dataset versions: ID, manifest (list of files with hashes and relative paths), metadata (project, name, tags, creation run, etc.). The Data Store is where actual file contents are stored, using content-addressed storage: each file's content hash is used as the storage key. This deduplicates identical files across datasets and versions. For large datasets, the Data Store may be a distributed object store (S3) with caching. The Dataset Registry service provides API to create a new version (which writes the manifest and verifies that all file hashes exist in the Data Store, uploading missing ones). When a task produces output, the engine will ask the Dataset Registry to create a new version, providing the list of output files (local paths). The registry will compute hashes, upload missing files, and register the version.
-
Metadata Store: This stores the core graph: projects, users, workflows, runs, tasks, datasets, versions, and their relationships. We'll design a graph schema:
(:Project {id, name, ...})
(:User {id, ...})
(:Workflow {id, definition, version})
(:Run {id, status, start_time, end_time, workflow_version})
(:Task {id, name, version})
(:Dataset {id, name})
(:DatasetVersion {id, dataset_id, manifest_hash, created_at})
Relationships:
(:User)-[:MEMBER_OF]->(:Project)
(:Project)-[:HAS_WORKFLOW]->(:Workflow)
(:Project)-[:HAS_DATASET]->(:Dataset)
(:Workflow)-[:DEFINED_IN]->(:Project)
(:Run)-[:EXECUTES]->(:Task)
(:Run)-[:USES]->(:DatasetVersion)
(:Run)-[:PRODUCES]->(:DatasetVersion)
(:Run)-[:PART_OF]->(:Workflow)
(:Task)-[:DEFINED_IN]->(:Workflow) maybe not needed if tasks are global
But tasks can be global. We can link tasks to runs via Run->[EXECUTES]->Task. Datasets are versioned; a dataset has multiple versions, but the relationship is to a specific version.
We'll also need to store workflow structure, but that can be in the workflow definition document (maybe as JSON). The run will have the resolved task graph with specific task versions.
We can also capture parameter values for a run: e.g., (:Run)-[:HAS_PARAMETER {name, value}]->(:Parameter) or store as properties on run.
Given the need for complex queries like "find all runs that used dataset X", "visualize full lineage of a dataset version", we need efficient graph traversal. A graph DB is ideal. But we can also use relational with recursive CTE. I'll suggest using a graph database (e.g., Neo4j or Amazon Neptune) for flexibility, but note that it's a design choice; we could also use PostgreSQL with a schema like:
- tables: projects, users, memberships, datasets, dataset_versions, tasks, task_versions, workflows, workflow_versions, runs, run_edges (run_id, from_entity_id, to_entity_id, edge_type, properties).
The run_edges table is a generic edge list.
We'll not commit to one but mention options.
-
API: Provide REST API for all operations, plus GraphQL for flexible queries. CLI uses the API.
-
Collaboration: The Collaboration Service handles project management, user invites, role assignments. It integrates with the Metadata Store to enforce access control on objects. For example, when fetching a dataset version, API checks if the user has permission in the project. Also, datasets may be shared across projects via permissions. The project also serves as a namespace for dataset names, allowing multiple projects to have datasets with same name.
-
Security: All communications via TLS. Authentication via OAuth2/OIDC (e.g., using Keycloak). API tokens for CLI. Fine-grained RBAC.
Implementation Considerations:
- Scalability: The workflow engine can be distributed; tasks are independent and can be executed in parallel. Use a message broker (e.g., RabbitMQ) to decouple task submission from execution. The metadata store should handle many reads; can use read replicas. The data store should be scalable; object stores scale well.
- Fault tolerance: Execution engine should retry tasks on failure, and track state persistently.
- Data Locality: For HPC, tasks may need to run where data resides. We may implement a hint system where datasets have a location attribute (e.g., a specific cluster's storage). The scheduler could co-locate tasks with data.
- Extensibility: Plugin architecture for different compute backends (Kubernetes, Slurm, AWS Batch). Plugin for data stores (S3, HDFS, local). Plugin for authentication.
- Testing: Provide a local mode for development using Docker Compose.
We can also discuss how we ensure deterministic task execution: by pinning container image digests, using read-only filesystems for inputs, capturing all environment variables, and avoiding writing temporary files to shared locations.
Conclusion: Summarize that this design integrates task abstraction, dataset versioning, provenance, and collaboration into a unified system that supports reproducible science.
Now we should write the answer in a clear, structured way. It's a design doc, so use headings, lists, diagrams (though we can't draw, we can describe). We'll be descriptive.
Potential pitfalls: Need to handle large binary data efficiently, avoid excessive copying. Use content-addressed storage to deduplicate. Dataset versioning should be cheap. Provenance queries should be fast.
We'll also consider that scientific workflows may involve iterative development and debugging. So we may want to support interactive tasks (e.g., Jupyter notebooks) that can be run manually but still produce provenance. We could treat notebooks as tasks; after manual execution, the user can register outputs as a dataset version. Or we could have a "run" that records the manual steps.
But we can keep it simple.
Now, let's write the answer. We'll aim for about 1500 words. We'll include bullet points and diagrams in text.
We must ensure we cover "task abstractions, dataset versioning, reproducibility guarantees, and collaboration spaces." We'll make sure each is a separate section.
We'll start.
Scientific Computing Workflow Manager with Provenance Tracking
1. Overview
Scientific computing pipelines are often complex, involving many computational steps, large datasets, and diverse software environments. Reproducibility, traceability, and collaboration are essential but hard to achieve with ad‑hoc scripts and manual data management. This design proposes a workflow manager that treats tasks and datasets as first‑class, versioned objects, automatically captures provenance, guarantees reproducibility through environment pinning, and provides collaborative spaces for teams.
Key design goals:
- Task abstraction: Reusable, containerized computational units with well‑defined inputs and outputs.
- Dataset versioning: Immutable, content‑addressed snapshots of data collections.
- Provenance tracking: Automatic recording of the full causal graph linking tasks, data versions, and runs.
- Reproducibility guarantees: Exact recreation of computational environments and data state.
- Collaboration spaces: Shared projects with fine‑grained access control and social features (comments, reviews).
The system is built as a set of microservices communicating via REST/GraphQL and message queues, with a graph‑oriented metadata store and pluggable compute and storage backends.
2. Core Concepts
2.1. Projects and Collaboration Spaces
A Project is a top‑level container for all artifacts belonging to a research group or collaboration. It defines a namespace (e.g., myorg/lung_cancer_study) and holds:
- Workflows
- Datasets
- Runs (executions)
- Users and their roles
Collaboration is managed through project membership. Roles (Owner, Contributor, Viewer) control who can create, modify, or read objects. Projects can be linked to external identity providers (GitHub, Google, LDAP) for authentication. Social features include:
- Comment threads on runs and dataset versions
- Review workflows (e.g., a dataset must be approved before becoming “released”)
- Activity audit logs
2.2. Tasks and Task Registry
A Task represents a single unit of computation (e.g., “align reads”, “call variants”). It is defined by:
- Code: A script, notebook, or binary, stored in a Git repository (or provided directly)
- Runtime environment: A container image (Docker, Singularity) or Conda environment specification
- Interface: Declared input and output datasets, plus typed parameters
- Resource requirements: CPU, memory, GPU, etc.
Tasks are versioned and stored in a central Task Registry. The registry assigns a unique identifier:
task/<namespace>/<name>:<semver>
For example, task/bio/bwa:v2.0.0. The manifest for a task (YAML/JSON) looks like:
name: bwa
version: 2.0.0
namespace: bio
description: Burrows-Wheeler Aligner
image: docker://biocontainers/bwa:2.0.0
inputs:
- name: reads
type: dataset
description: FASTQ dataset (possibly paired)
outputs:
- name: aligned_bam
type: dataset
description: Aligned BAM file
parameters:
- name: preset
type: string
default: mem
enum: [mem, ont]
command: |
bwa {{parameters.preset}} \
-t {{resources.cpu}} \
{{inputs.reads}} \
> {{outputs.aligned_bam}}
The Task Registry also stores a link to the Git commit (if applicable) to ensure code reproducibility.
2.3. Datasets and Versioning
A Dataset is a logical collection of files (e.g., “raw RNA‑seq reads”, “trained model”). Datasets are versioned: each time new data is produced, a new immutable DatasetVersion is created. Versioning is based on content addressing:
- Each file’s content is hashed (SHA‑256). If the same content already exists in storage, it is not duplicated (deduplication).
- A dataset version’s manifest is a list of
(logical_path, content_hash, size) entries, plus metadata (who created, when, the producing run).
- The manifest itself is hashed to produce a DatasetVersion ID (
dv_<hash>). Identical manifests yield the same ID, enabling automatic deduplication across versions.
The Dataset Registry tracks dataset metadata, versions, and tags (e.g., stable, latest). The actual file bytes are stored in a Data Store, which can be an object store (S3, GCS) or a distributed file system (HDFS). Clients interact with the Dataset Registry to create or resolve dataset versions.
2.4. Workflows and Runs
A Workflow is a directed acyclic graph (DAG) of tasks, defined in a DSL or via a programming API. It specifies:
- The tasks to run (referenced from the Task Registry)
- Data dependencies between tasks (outputs of one become inputs of another)
- Input datasets (with optional version selectors like
latest or a specific tag)
- Expected output datasets (logical names)
- Resource constraints, parameter defaults
A Run is an execution of a workflow with a particular set of dataset versions and parameters. The Run object captures:
- Exact workflow definition (or reference to a stored workflow version)
- Bound input dataset versions (resolved at submission time)
- Parameter values (overrides)
- Status (queued, running, succeeded, failed)
- Start/end timestamps
- Links to the TaskVersion objects actually executed
- Links to the DatasetVersion objects consumed and produced
Every Run generates new DatasetVersion objects for each declared output, thereby extending the version history.
2.5. Provenance Graph
Provenance is the sum of all relationships:
Run --(USES)--> DatasetVersion
Run --(PRODUCES)--> DatasetVersion
Run --(EXECUTES)--> TaskVersion
TaskVersion --(DEFINED_IN)--> (optional) Workflow
DatasetVersion --(PART_OF)--> Dataset
Additionally, parameter values and environment details (container image digest, Git commit) are stored as properties on the relevant nodes or edges.
This graph enables queries such as:
- “Which inputs led to dataset version X?” – traverse backward from
DatasetVersion through PRODUCES/USES to ancestor runs and datasets.
- “What downstream analyses used dataset version Y?” – forward traversal.
- “Can I reproduce run R?” – collect all TaskVersion images, input DatasetVersion IDs, and parameters.
The graph is stored in a graph‑optimized database (e.g., Neo4j, Amazon Neptune) or a relational database with edge tables and recursive queries.
3. System Architecture
3.1. High‑Level Components
+-------------------+ +------------------+ +-------------------+
| CLI / Web UI | <--> | API Gateway | <--> | Collaboration Svc |
+-------------------+ +------------------+ +-------------------+
|
+------------------+------------------+
| | |
+--------v-------+ +--------v-------+ +--------v-------+
| Workflow Svc | | Task Registry | | Dataset Registry|
+-----------------+ +----------------+ +-----------------+
| | |
+--------+---------+---------+--------+
| |
+--------v-------+ +--------v-------+
| Metadata Store | | Data Store |
| (Graph DB) | | (Object Store) |
+-----------------+ +-----------------+
|
+--------v-------+
| Execution Engine|
| (Scheduler + |
| Executors) |
+-----------------+
- API Gateway: Single entry point, routes requests to appropriate services, handles auth.
- Collaboration Service: Project and membership management, access control enforcement.
- Workflow Service: Validates and stores workflow definitions, handles submission, creates Run objects.
- Task Registry: Stores task manifests, resolves task references to specific versions.
- Dataset Registry: Tracks dataset metadata, resolves dataset references (e.g.,
project/dataset:tag), creates new versions.
- Metadata Store: The graph database holding all entities and relationships (runs, tasks, datasets, users, projects, edges). It is the source of truth for provenance.
- Data Store: Content‑addressable object storage for dataset files. Files are stored under keys derived from their content hash.
- Execution Engine: Pulls tasks from a queue, provisions compute resources (Kubernetes, Slurm, AWS Batch), stages inputs, runs containers, captures outputs and logs, and updates provenance.
- Client: CLI (
wflow command) and optional web UI for visualization and interaction.
3.2. Data Flow
-
Workflow submission (CLI/UI):
- User creates a workflow definition (DSL) referencing tasks and datasets.
- The Workflow Service validates the definition, resolves dataset references to concrete
DatasetVersion IDs (using the Dataset Registry), and creates a new Run node in the Metadata Store with status queued.
- The workflow DAG is decomposed into tasks with their input dependencies and placed on a task queue (e.g., RabbitMQ).
-
Task scheduling and execution:
- The Execution Engine consumes tasks from the queue.
- For each task, it retrieves the TaskVersion manifest (container image, command) from the Task Registry.
- It stages input datasets: the Data Store is queried for file locations (or files are streamed/cached locally). For large datasets, a shared filesystem may be used.
- The task is launched in a container on the chosen compute backend. Environment variables, secrets, and resource limits are set.
- The task writes outputs to a designated output directory.
-
Post‑run processing:
-
Failure handling:
- If the task exits with non‑zero, the Run status becomes
failed. Error logs are stored in the Data Store and linked to the Run. Retries can be configured.
4. Detailed Design
4.1. Task Abstraction
Tasks are container‑first. Every task specifies a container image (identified by its content hash) and a command line that uses placeholders for inputs, outputs, and parameters. The placeholders are resolved at run time by the engine.
Task Manifest Schema (YAML):
name: string
namespace: string
version: semver
description: string
image: string # e.g. docker://registry.example.org/org/image:tag or @sha256:digest
command: string # may include {{inputs.xxx}}, {{outputs.yyy}}, {{parameters.zzz}}
inputs:
- name: string
type: dataset | parameter
description: string
outputs:
- name: string
type: dataset
description: string
parameters:
- name: string
type: string|number|boolean|enum
default: any
enum: [list] # if type=enum
resources:
cpu: number # in cores
memory: string # e.g., "8Gi"
gpu: number
runtime: container | conda # future extension
Tasks can be registered via:
wflow task register mytask.yaml
The registry stores the manifest and calculates a TaskVersion ID as a hash of (namespace, name, version, image, command, input/output/parameter specs). This ensures that even small changes yield a new version.
4.2. Dataset Versioning
A Dataset is a named collection under a project. Its version history is a list of immutable snapshots. Creating a new version:
- The client (usually the Execution Engine) provides a local directory containing the output files.
- The Dataset Registry computes the SHA‑256 hash of each file.
- For each file, it checks if that hash already exists in the Data Store (metadata is stored separately). If not, it uploads the file to the Data Store under the key
<hash> (optionally with a directory prefix based on first few characters for sharding).
- It builds a manifest:
{
"dataset_id": "ds_123",
"version_hash": "dv_abcdef123...", // hash of manifest
"created_at": "2025-04-01T12:00:00Z",
"created_by_run": "run_456",
"files": [
{"path": "sample1.fastq.gz", "hash": "sha256:0123...", "size": 1024},
{"path": "sample2.fastq.gz", "hash": "sha256:0456...", "size": 2048}
]
}
- The manifest is stored in the Metadata Store as a
DatasetVersion node. The Data Store may also store the manifest for redundancy.
- The Dataset node points to its latest version via a
CURRENT relationship (or the project’s latest tag resolves to the highest version timestamp or a user‑defined tag).
To resolve a dataset reference like project/dataset:tag, the Dataset Registry navigates tags or returns the version id.
4.3. Provenance Graph Model
We use a property graph with the following node labels and relationships:
Nodes
Project (id, name, description)
User (id, email, name)
Dataset (id, name, project_id)
DatasetVersion (id, dataset_id, manifest_hash, created_at, tags, run_id)
Task (id, name, namespace) – optional, if we want to aggregate versions; often we just keep TaskVersion
TaskVersion (id, task_name, version, image, command, parameters_schema)
Workflow (id, project_id, name, version)
Run (id, workflow_id, status, start_time, end_time, parameters_json)
Edges (Relationships)
(:User)-[:MEMBER_OF {role}]->(:Project)
(:Project)-[:OWNS_DATASET]->(:Dataset)
(:Dataset)-[:HAS_VERSION]->(:DatasetVersion)
(:DatasetVersion)-[:NEXT_VERSION]->(:DatasetVersion) (optional to link versions linearly)
(:DatasetVersion)-[:TAGGED {tag}]->(:DatasetVersion) (tags like latest, stable)
(:Project)-[:HAS_WORKFLOW]->(:Workflow)
(:Workflow)-[:DEFINED_IN]->(:Project)
(:Run)-[:EXECUTES]->(:TaskVersion)
(:Run)-[:USES]->(:DatasetVersion)
(:Run)-[:PRODUCES]->(:DatasetVersion)
(:Run)-[:PART_OF]->(:Workflow)
Parameters and resource specs can be stored as properties on the USES edge (for input datasets) or on the Run node (for top‑level workflow parameters). For clarity, they are kept on the Run and the TaskVersion.
This model supports efficient lineage queries both backward and forward.
4.4. Reproducibility Guarantees
Reproducibility is achieved by pinning every aspect of a run:
- Immutable inputs: Input dataset versions are fixed IDs; their content never changes.
- Pinned task version: The TaskVersion ID references a specific container image digest and command. The container image is built from a specific Git commit (the registry records the commit hash). Even if the task evolves, the old image remains unchanged in the registry.
- Complete environment: The container image includes all system dependencies. No “works on my machine” issues.
- Deterministic execution: To the extent that the underlying computation is deterministic, the outputs will be byte‑identical. For non‑deterministic tasks, the user must expose a random seed as a parameter; the Run captures its value.
- Replay: The system provides a command
wflow run replay <run-id> that creates a new Run using the same input dataset versions and task versions (and parameters). The new Run will produce output datasets with new IDs, but bit‑for‑bit identical content if the computation is deterministic. The system can optionally compare checksums to verify.
Verification: The engine can optionally recompute the hash of the output file and compare it against the stored DatasetVersion manifest to ensure no corruption.
4.5. Collaboration Spaces
Projects are the collaboration hub:
- Namespace isolation: All datasets and workflows live under a project. Two projects can have datasets with the same name without conflict.
- Role‑Based Access Control (RBAC):
- Owner: can manage members, delete project.
- Contributor: can create/modify workflows, submit runs, upload datasets (by creating new versions).
- Viewer: read‑only access to workflows, runs, and datasets.
- Sharing: Datasets can be shared across projects via a “grant” operation, where the owner project gives another project read or write access. This is implemented by adding a cross‑project edge in the Metadata Store and enforcing checks in the API.
- Social features:
- Comments on Runs and DatasetVersions (stored as attached nodes in the graph).
- “Release” process: a dataset version can be marked as
stable after review, making it discoverable as the recommended version.
The Collaboration Service exposes APIs for user invites, role changes, and project creation. It integrates with the Metadata Store to check permissions on every request (the API Gateway or each service performs the check).
4.6. Workflow Definition Language (DSL)
A simple YAML‑based DSL describes a workflow. Example:
name: "variant_pipeline"
version: "1.0"
project: "myorg/lung_cancer"
inputs:
- id: raw_reads
dataset: "myorg/lung_cancer/raw_data:latest"
outputs:
- id: final_report
dataset: "myorg/lung_cancer/report"
tasks:
- id: align
task: "task/bio/bwa@v2.0.0"
inputs:
reads: raw_reads
outputs:
bam: aligned_bam
resources:
cpu: 8
memory: "16Gi"
- id: call
task: "task/bio/gatk@v3.0.0"
depends_on: [align]
inputs:
bam: align.outputs.bam
reference: "reference/hg38"
outputs:
vcf: variants
parameters:
minDepth: 20
- id: report
task: "task/reporting/generate_html@1.0"
depends_on: [call]
inputs:
vcf: call.outputs.vcf
outputs:
html: final_report
When submitted, the workflow service:
- Resolves all dataset references (
myorg/...:latest) to concrete DatasetVersion IDs.
- Validates that the tasks exist in the registry and that input/output types match.
- Creates a Run node with parameter values (if any) and status
queued.
- Enqueues tasks with their resolved input dataset version IDs and output dataset names.
4.7. Execution Engine
The engine consists of two parts:
- Scheduler: Pulls tasks from the queue, respects dependencies (
depends_on), and decides when a task is ready (all upstream tasks succeeded). It can be implemented as a simple topological executor or a more sophisticated dynamic scheduler (e.g., using Airflow or custom).
- Executor: For each ready task:
- Fetches the
TaskVersion manifest from the Task Registry.
- Determines input dataset file locations: For each input, the engine queries the Data Store for the list of files (hashes) and their storage URIs. It then stages them – either by copying to the compute node or by mounting the remote store (if supported).
- Prepares the container: pulls the image if not present, sets environment variables
WF_INPUT_<name> as mount points, WF_OUTPUT_<name> as writable directories, and injects parameters.
- Launches the container on the compute backend (e.g., a Kubernetes Pod). The backend is abstracted via a plugin interface, allowing Slurm, AWS Batch, etc.
- Streams logs to the Metadata Store (or Data Store) and monitors the process.
- On success:
- For each declared output dataset, the engine collects the files written to the output directory, computes hashes, and calls the Dataset Registry to create a new
DatasetVersion. The Dataset Registry may also upload files if they are new.
- Creates provenance edges in the Metadata Store:
(Run)-[:EXECUTES]->(TaskVersion), (Run)-[:USES]->(InputDatasetVersion), (Run)-[:PRODUCES]->(OutputDatasetVersion).
- Updates Run status to
succeeded.
- On failure: captures exit code, logs, marks Run as
failed. Optionally retries according to policy.
The engine must handle large datasets efficiently: it can use content‑addressable caching. If a file with a given hash is already present on the compute node (from a previous task), it is hard‑linked instead of copied. The Data Store can serve as a caching layer (e.g., an S3 bucket with a CDN).
4.8. API and Extensibility
All services expose RESTful endpoints and a GraphQL gateway for flexible queries (especially for provenance traversal). The CLI (wflow) uses these APIs.
The system is designed with plugin points:
- Compute backend plugins: implement interface
submit_task(manifest, inputs, outputs). Existing plugins: Kubernetes, Slurm, Local Docker.
- Data store plugins: abstract operations like
upload_file(hash, stream), get_file_location(hash).
- Authentication plugins: OIDC, LDAP, token.
- Provenence store plugins: currently graph DB, but could be extended.
New task languages can be supported by a workflow parser plugin (e.g., Snakemake, Nextflow, CWL) that translates them into our internal DAG representation.
4.9. Scalability and Fault Tolerance
- Horizontal scaling: Each microservice can be replicated behind a load balancer. The task queue distributes work among multiple executors.
- Metadata Store: Graph databases scale for reads; writes are relatively infrequent (per run). Clustering/read‑replicas can be used.
- Data Store: Object stores are inherently scalable. Deduplication reduces storage growth.
- Fault tolerance: The Execution Engine is stateless; task state is persisted in the Metadata Store. If an executor crashes, tasks remain in
running state and can be re‑assigned after a timeout.
- Checkpointing: For long tasks, optional intermediate outputs can be stored as separate dataset versions within the task (advanced).
5. Implementation Considerations
5.1. Metadata Store Choice
A graph database (Neo4j, Neptune) is recommended for intuitive lineage queries. However, a relational database with edge tables and recursive CTEs is also viable, especially if the team prefers PostgreSQL. The schema would include tables for nodes (generalized with a type column) and an edge table (src_id, dst_id, type, properties). Indexes on node IDs and types support fast lookups.
5.2. Data Store Details
Content‑addressed storage can be built on top S3 by using the hash as the key. For local filesystems, a simple git‑like object store (.wflow/objects) works. To avoid excessive network transfer for large datasets, a shared filesystem (NFS, Lustre) may be used as a cache for the compute nodes. The Dataset Registry then stores URIs that point to the physical location (e.g., s3://..., nfs://...).
5.3. Security
- All API traffic over TLS.
- Authentication via OAuth2/OIDC; short‑lived access tokens.
- Fine‑grained checks: every request to read/write a project resource is validated against the project’s ACL.
- Secrets (e.g., credentials for external data sources) are stored in a vault (HashiCorp Vault, Kubernetes Secrets) and injected at runtime.
5.4. Monitoring and Observability
- Centralized logging (ELK stack)
- Metrics (Prometheus) for queue depth, task success rate, storage usage.
- Alerts for failed runs or storage quota exceedance.
5.5. User Experience
- CLI:
wflow workflow submit myworkflow.yaml, wflow run list, wflow dataset show <id>, wflow run replay <run-id>.
- Web UI: Visual DAG editor, provenance graph browser, dataset browser, activity feed.
- IDE plugins: IntelliJ, VSCode integration for task development and debugging.
6. Conclusion
This design delivers a scientific workflow manager that combines robust task abstraction, immutable dataset versioning, automatic provenance capture, and collaboration spaces. By enforcing content‑addressing, containerization, and graph‑based tracking, it gives researchers confidence that their computations are reproducible and their data lineage is fully documented. The microservice architecture ensures scalability and extensibility, while the API‑first approach supports both command‑line and graphical interfaces.
The system can serve as a foundation for reproducible computational science across domains, from bioinformatics to climate modeling, and can be deployed on‑prem or in the cloud. Future enhancements may include support for interactive notebook tasks, automated data DOI minting, and integration with electronic lab notebooks.