Skip to main content

Python API

The main entry point for the Python API is the reftrace namespace. This has the core classes.

Individual directives are available under the reftrace.directives namespace. Parts of the configuration file are available under the reftrace.configfile namespace.

API version: 0.4.8

Core Classes

Available under the reftrace namespace.

class Module

Represents a Nextflow module that contains process definitions.

property path : str

The file path of the module.

property dsl_version : int

The DSL (Domain Specific Language) version of the module.

property processes : List[Process]

All processes defined in this module.

class Process

Wrapper for protobuf Process message that provides easier access to directives.

property name : str

The name of the process.

property line : int

The line number where this process is defined.

property accelerators : List[Accelerator]

Accelerator directives for this process.

property after_scripts : List[AfterScript]

After script directives for this process.

property arches : List[Arch]

Architecture directives for this process.

property arrays : List[Array]

Array directives for this process.

property before_scripts : List[BeforeScript]

Before script directives for this process.

property caches : List[Cache]

Cache directives for this process.

property cluster_options : List[ClusterOptions]

Cluster options directives for this process.

property condas : List[Conda]

Conda directives for this process.

property containers : List[Container]

Container specifications for this process.

property container_options : List[ContainerOptions]

Container options directives for this process.

property cpus : List[Cpus]

CPU directives for this process.

property debugs : List[Debug]

Debug directives for this process.

property disks : List[Disk]

Disk directives for this process.

property dynamics : List[Dynamic]

Dynamic directives for this process.

property echos : List[Echo]

Echo directives for this process.

property error_strategies : List[ErrorStrategy]

Error strategy directives for this process.

property executors : List[Executor]

Executor directives for this process.

property exts : List[Ext]

Extension directives for this process.

property fairs : List[Fair]

Fair scheduling directives for this process.

property labels : List[Label]

Labels attached to this process.

property machine_types : List[MachineType]

Machine type directives for this process.

property max_errors : List[MaxErrors]

Maximum errors directives for this process.

property max_forks : List[MaxForks]

Maximum forks directives for this process.

property max_retries : List[MaxRetries]

Maximum retries directives for this process.

property max_submit_awaits : List[MaxSubmitAwait]

Maximum submit await directives for this process.

property memories : List[Memory]

Memory directives for this process.

property modules : List[Module]

Module directives for this process.

property penvs : List[Penv]

Parallel environment directives for this process.

property pods : List[Pod]

Pod directives for this process.

property publish_dirs : List[PublishDir]

Publish directory directives for this process.

property queues : List[Queue]

Queue directives for this process.

property resource_labels : List[ResourceLabels]

Resource labels directives for this process.

property resource_limits : List[ResourceLimits]

Resource limits directives for this process.

property scratches : List[Scratch]

Scratch directives for this process.

property shells : List[Shell]

Shell directives for this process.

property spacks : List[Spack]

Spack directives for this process.

property stage_in_modes : List[StageInMode]

Stage in mode directives for this process.

property stage_out_modes : List[StageOutMode]

Stage out mode directives for this process.

property store_dirs : List[StoreDir]

Store directory directives for this process.

property tags : List[Tag]

Tag directives for this process.

property times : List[Time]

Time directives for this process.

property unknowns : List[Unknown]

Unknown directives for this process.

property first_accelerator : Accelerator | None

First accelerator directive or None.

property first_after_script : AfterScript | None

First after script directive or None.

property first_arch : Arch | None

First architecture directive or None.

property first_array : Array | None

First array directive or None.

property first_before_script : BeforeScript | None

First before script directive or None.

property first_cache : Cache | None

First cache directive or None.

property first_cluster_options : ClusterOptions | None

First cluster options directive or None.

property first_conda : Conda | None

First conda directive or None.

property first_container : Container | None

First container directive or None.

property first_container_options : ContainerOptions | None

First container options directive or None.

property first_cpus : Cpus | None

First CPU directive or None.

property first_debug : Debug | None

First debug directive or None.

property first_disk : Disk | None

First disk directive or None.

property first_dynamic : Dynamic | None

First dynamic directive or None.

property first_echo : Echo | None

First echo directive or None.

property first_error_strategy : ErrorStrategy | None

First error strategy directive or None.

property first_executor : Executor | None

First executor directive or None.

property first_ext : Ext | None

First extension directive or None.

property first_fair : Fair | None

First fair scheduling directive or None.

property first_label : Label | None

First label directive or None.

property first_machine_type : MachineType | None

First machine type directive or None.

property first_max_errors : MaxErrors | None

First maximum errors directive or None.

property first_max_forks : MaxForks | None

First maximum forks directive or None.

property first_max_retries : MaxRetries | None

First maximum retries directive or None.

property first_max_submit_await : MaxSubmitAwait | None

First maximum submit await directive or None.

property first_memory : Memory | None

First memory directive or None.

property first_module : Module | None

First module directive or None.

property first_penv : Penv | None

First parallel environment directive or None.

property first_pod : Pod | None

First pod directive or None.

property first_publish_dir : PublishDir | None

First publish directory directive or None.

property first_queue : Queue | None

First queue directive or None.

property first_resource_labels : ResourceLabels | None

First resource labels directive or None.

property first_resource_limits : ResourceLimits | None

First resource limits directive or None.

property first_scratch : Scratch | None

First scratch directive or None.

property first_shell : Shell | None

First shell directive or None.

property first_spack : Spack | None

First spack directive or None.

property first_stage_in_mode : StageInMode | None

First stage in mode directive or None.

property first_stage_out_mode : StageOutMode | None

First stage out mode directive or None.

property first_store_dir : StoreDir | None

First store directory directive or None.

property first_tag : Tag | None

First tag directive or None.

property first_time : Time | None

First time directive or None.

property first_unknown : Unknown | None

First unknown directive or None.

class ConfigFile

Represents a Nextflow config file that contains process configurations.

property path : str

The file path of the config file.

property process_scopes : list[ProcessScope]

All process scopes defined in this config file.

Directives

Available under the reftrace.directives namespace.

Directive types for Nextflow process analysis.

class Accelerator

The ‘accelerator’ directive specifies GPU requirements.

property num_gpus : int

Number of GPUs requested.

property gpu_type : str

Type of GPU requested.

line : int

class AfterScript

The ‘afterScript’ directive specifies a script to run after the main process.

property script : str

The script to execute after the main process.

line : int

class Arch

The ‘arch’ directive specifies architecture requirements.

property name : str

The architecture name.

property target : str

The architecture target.

line : int

class Array

The ‘array’ directive specifies array job size.

property size : int

The size of the array job.

line : int

class BeforeScript

The ‘beforeScript’ directive specifies a script to run before the main process.

property script : str

The script to execute before the main process.

line : int

class Cache

The ‘cache’ directive controls process-level caching behavior.

property enabled : bool

Whether caching is enabled.

property deep : bool

Whether deep caching is enabled.

property lenient : bool

Whether lenient caching is enabled.

line : int

class ClusterOptions

The ‘clusterOptions’ directive specifies additional cluster submission options.

property options : str

The cluster submission options string.

line : int

class Conda

The ‘conda’ directive specifies Conda environment requirements.

property possible_values : List[str]

List of possible Conda environment specifications.

line : int

class Container

The ‘container’ directive specifies the container image to use.

property format : ContainerFormat

The format of the container specification (simple or ternary).

property name : str

The container name/image.

property condition : str

The condition for ternary format.

property true_name : str

Container to use when condition is true.

property false_name : str

Container to use when condition is false.

line : int

class ContainerFormat

Container directive format types.

SIMPLE = 0

TERNARY = 1

class ContainerOptions

The ‘containerOptions’ directive specifies additional container runtime options.

property options : str

The container runtime options string.

line : int

class Cpus

The ‘cpus’ directive specifies CPU requirements.

property value : int

Number of CPUs requested.

line : int

class Debug

The ‘debug’ directive enables or disables debug mode for a process.

property enabled : bool

Whether debug mode is enabled.

line : int

class Disk

The ‘disk’ directive specifies disk space requirements.

property space : str

The disk space requirement (e.g., ‘2 GB’, ‘1 TB’).

line : int

class Dynamic

The ‘dynamic’ directive enables or disables dynamic input handling.

property enabled : bool

Whether dynamic input handling is enabled.

line : int

class Echo

The ‘echo’ directive enables or disables command echoing.

property enabled : bool

Whether command echoing is enabled.

line : int

class ErrorStrategy

The ‘errorStrategy’ directive specifies how to handle process errors.

property strategy : str

The error handling strategy (e.g., ‘terminate’, ‘ignore’, ‘retry’).

line : int

class Executor

The ‘executor’ directive specifies which executor to use for the process.

property executor : str

The executor name (e.g., ‘local’, ‘sge’, ‘slurm’).

line : int

class Ext

The ‘ext’ directive specifies extension configuration.

property version : str

The extension version.

property args : str

The extension arguments.

line : int

class Fair

The ‘fair’ directive enables or disables fair scheduling.

property enabled : bool

Whether fair scheduling is enabled.

line : int

class Label

The ‘label’ directive adds a label to the process for organization.

property value : str

The label text.

line : int

class MachineType

The ‘machineType’ directive specifies the cloud instance type.

property machine_type : str

The machine/instance type (e.g., ‘n1-standard-2’, ‘t2.micro’).

line : int

class MaxErrors

The ‘maxErrors’ directive specifies the maximum number of errors allowed.

property num : int

The maximum number of errors allowed.

line : int

class MaxForks

The ‘maxForks’ directive specifies the maximum number of parallel process instances.

property num : int

The maximum number of parallel forks allowed.

line : int

class MaxRetries

The ‘maxRetries’ directive specifies the maximum number of retry attempts.

property num : int

The maximum number of retry attempts allowed.

line : int

class MaxSubmitAwait

The ‘maxSubmitAwait’ directive specifies the maximum time to wait for job submission.

property max_submit_await : str

The maximum submission wait time (e.g., ‘1h’, ‘30m’).

line : int

class Memory

The ‘memory’ directive specifies memory requirements.

property memory_gb : float

The memory requirement in gigabytes.

line : int

class Module

The ‘module’ directive specifies environment modules to load.

property name : str

The name of the environment module to load.

line : int

class Penv

The ‘penv’ directive specifies the parallel environment to use.

property environment : str

The parallel environment name.

line : int

class Pod

The ‘pod’ directive specifies Kubernetes pod configuration.

property env : str

The pod environment variable name.

property value : str

The pod environment variable value.

line : int

class PublishDir

The ‘publishDir’ directive specifies where to publish output files.

property path : str

The directory path where files should be published.

property params : str

Additional publishing parameters.

property content_type : bool | None

Whether to determine content type.

property enabled : bool | None

Whether publishing is enabled.

property fail_on_error : bool | None

Whether to fail on publishing errors.

property mode : str

The publishing mode.

property overwrite : bool | None

Whether to overwrite existing files.

line : int

class Queue

The ‘queue’ directive specifies which job queue to use.

property name : str

The queue name.

line : int

class ResourceLabels

The ‘resourceLabels’ directive specifies labels for resources.

property labels : Dict[str, str]

The resource labels as a dictionary.

line : int

class ResourceLimits

The ‘resourceLimits’ directive specifies resource limits.

property limits : Dict[str, str]

The resource limits as a dictionary.

line : int

class Scratch

The ‘scratch’ directive specifies the scratch directory path.

property path : str

The scratch directory path.

line : int

class Shell

The ‘shell’ directive specifies the shell to use for script execution.

property shell : str

The shell to use (e.g., ‘bash’, ‘zsh’).

line : int

class Spack

The ‘spack’ directive specifies Spack package requirements.

property possible_values : List[str]

List of possible Spack package specifications.

line : int

class StageInMode

The ‘stageInMode’ directive specifies how input files should be staged.

property mode : str

The staging mode for input files (e.g., ‘copy’, ‘link’, ‘symlink’).

line : int

class StageOutMode

The ‘stageOutMode’ directive specifies how output files should be staged.

property mode : str

The staging mode for output files (e.g., ‘copy’, ‘move’, ‘rsync’).

line : int

class StoreDir

The ‘storeDir’ directive specifies where to store cached task outputs.

property path : str

The directory path where cached outputs should be stored.

line : int

class Tag

The ‘tag’ directive specifies a tag for the process execution.

property tag : str

The tag value.

line : int

class Time

The ‘time’ directive specifies the maximum execution time allowed.

property time : str

The time limit (e.g., ‘1h’, ‘30m’, ‘2d’).

line : int

class Unknown

A directive that isn’t recognized or supported.

property name : str

The name of the unknown directive.

property value : str

The raw value of the unknown directive.

line : int

Config File

Available under the reftrace.configfile namespace.

class ProcessScope

Represents a process scope containing directives and named scopes.

property line_number : int

The line number where this scope begins.

property directives : list[Directive]

The directives in this scope.

property named_scopes : list[NamedScope]

The named scopes within this scope.

class NamedScope

Represents a named scope with its directives.

property line_number : int

The line number where this scope begins.

property name : str

The scope name.

property directives : list[Directive]

The directives in this scope.

class Directive

Represents a directive configuration.

property line_number : int

The line number where this directive appears.

property name : str

The directive name.

property options : list[NamedOption]

The directive options.

property value : Value

The directive value.

class NamedOption

Represents a named option with its value.

property line_number : int

The line number where this option appears.

property name : str

The option name.

property value : Value

The option value.

class Value

Represents a directive value with parameters and closure information.

property params : list[str]

The directive parameters.

property in_closure : bool

Whether the directive is in a closure.