aldbr / dirac-cwl-proto

GNU General Public License v3.0
0 stars 0 forks source link

dirac cwl prototype

This Python prototype provides a command-line interface (CLI) for the end-to-end execution of Common Workflow Language (CWL) workflows. It enables users to locally test CWL workflows, submit them as jobs to the DIRAC Workload Management System (WMS) for execution on remote computing resources, and manage large-scale productions by splitting a workflow into multiple transformations.

Installation

To use this package, you first need to create a conda environment:

mamba env create -f environment.yaml
conda activate dirac-cwl

Then, install the package:

pip install -e .

Usage

dirac-cwl production submit <workflow_path> <input_path> <metadata model>

This package contains modules and tools to manage CWL workflows:

To use the workflows and inputs directly with cwltool, you need to add the modules directory to the $PATH:

export PATH=$PATH:</path/to/dirac-cwl-proto/src/dirac_cwl_proto/modules>
cwltool <workflow_path> <inputs>

Contribute

Add a workflow

To add a new workflow to the project, follow these steps:

Directory Structure Example:

workflows/
├── my_new_workflow/
│   ├── description.cwl
│   └── inputs.yml

Add a module

If your workflow requires calling a script, you can add this script as a module. Follow these steps to properly integrate the module:

Example

Let’s say you have a script named generic_command.py located at src/dirac_cwl_proto/modules/generic_command.py. Here's how you can integrate it:

#!/usr/bin/env python3
import typer
from rich.console import Console

app = typer.Typer()
console = Console()

@app.command()
def run_example():
    console.print("This is an example command.")

if __name__ == "__main__":
    app()
[project.scripts]
generic-command = "dirac_cwl_proto.modules.generic_command:app"
baseCommand: [generic-command]