.. include:: ../global.inc ####################### Ruffus Decorators ####################### .. Note:: See also: .. toctree:: :maxdepth: 1 indicator_objects.rst .. _decorators: ============================================= *Basic* ============================================= .. csv-table:: :header: "Decorator", "Examples" :widths: 400, 600,1 "**@follows** - Indicates task dependency (:ref:`see Manual `) - optional :ref:`mkdir ` prerequisite (:ref:`see Manual `) ", " * :ref:`@follows ` ( ``task1``, ``'task2'`` )) \ * :ref:`@follows ` ( ``task1``, :ref:`mkdir `\ ( ``'my/directory/'`` )) \ ", "" "**@files** (:ref:`see Manual `) - I/O parameters - skips up-to-date jobs ", " * :ref:`@files `\ ( ``parameter_list`` ) \ * :ref:`@files `\ ( ``parameter_generating_function`` ) \ * :ref:`@files ` ( ``input_file``, ``output_file``, ``other_params``, ... ) \ ", "" ============================================= *Core* ============================================= .. csv-table:: :header: "Decorator", "Examples" :widths: 400, 600,1 "**@split** (:ref:`see Manual `) - Splits a single input into multiple output - Globs in ``output`` can specify an indeterminate number of files. ", " * :ref:`@split ` ( ``tasks_or_file_names``, ``output_files``, [``extra_parameters``,...] ) \ ", "" "**@transform** (:ref:`see Manual `) - Applies the task function to transform input data to output. ", " * :ref:`@transform ` ( ``tasks_or_file_names``, :ref:`suffix `\ *(*\ ``suffix_string``\ *)*\ , ``output_pattern``, [``extra_parameters``,...] ) \ * :ref:`@transform ` ( ``tasks_or_file_names``, :ref:`regex `\ *(*\ ``regex_pattern``\ *)*\ , ``output_pattern``, [``extra_parameters``,...] ) \ ", "" "**@merge** (:ref:`see Manual `) - Merges multiple input files into a single output. ", " * :ref:`@merge ` (``tasks_or_file_names``, ``output``, [``extra_parameters``,...] ) \ ", "" "**@posttask** - Calls function after task completes (:ref:`see Manual `) - Optional :ref:`touch_file ` indicator (:ref:`see Manual `) ", " * :ref:`@posttask ` ( ``signal_task_completion_function`` ) \ * :ref:`@posttask ` (:ref:`touch_file `\ ( ``'task1.completed'`` )) \ ", "" ============================================= *Advanced* ============================================= .. csv-table:: :header: "Decorator", "Examples" :widths: 400, 600,1 "**@collate** (See Manual :ref:`here ` and :ref:`here `) - Groups multiple input files using regular expression matching - Input resulting in the same output after substitution will be collated together. ", " * :ref:`@collate ` (``tasks_or_file_names``, :ref:`regex `\ *(*\ ``regex_pattern``\ *)*\ , ``output_pattern``, [``extra_parameters``,...] ) \ * :ref:`@collate ` (``tasks_or_file_names``, :ref:`regex `\ *(*\ ``regex_pattern``\ *)*\ , :ref:`inputs ` | :ref:`add_inputs `\ *(*\ ``input_pattern``\ *)*\ , ``output_pattern``, [``extra_parameters``,...] ) \ ", "" "**@transform** (:ref:`Manual `) - Infers input as well as output from regular expression substitutions - Useful for adding additional file dependencies ", " * :ref:`@transform ` ( ``tasks_or_file_names``, :ref:`suffix `\ *(*\ ``suffix_string``\ *)*\ , [ :ref:`inputs ` | :ref:`add_inputs `\ *(*\ ``input_pattern``\ *)*\ , ] ``output_pattern``, [``extra_parameters``,...] ) \ * :ref:`@transform ` ( ``tasks_or_file_names``, :ref:`regex `\ *(*\ ``regex_pattern``\ *)*\ , [ :ref:`inputs ` | :ref:`add_inputs `\ *(*\ ``input_pattern``\ *)*\ , ] ``output_pattern``, [``extra_parameters``,...] ) \ ", "" "**@split** (:ref:`see Manual `) - Splits multiple input each further into many more output - Globs in ``output`` can specify an indeterminate number of files. ", " * :ref:`@split ` ( ``tasks_or_file_names``, :ref:`regex `\ *(*\ ``regex_pattern``\ *)*\ , [ :ref:`inputs ` | :ref:`add_inputs `\ *(*\ ``input_pattern``\ *)*\ , ] ``output_pattern``, [``extra_parameters``,...] ) \ ", "" "**@jobs_limit** (:ref:`see Manual `) - Limits the amount of multiprocessing for the specified task - Ensures that fewer than N jobs for this task are run in parallel - Overrides ``multiprocess`` parameter in :ref:`pipeline_run(...) ` ", " * :ref:`@jobs_limit ` ( ``NUMBER_OF_JOBS_RUNNING_CONCURRENTLY`` ) \ ", "" ============================================= *Esoteric!* ============================================= .. csv-table:: :header: "Decorator", "Examples" :widths: 400, 600,1 "**@parallel** - By default, does not check if jobs are up to date - Best used in conjuction with :ref:`@check_if_uptodate ` ", " * :ref:`@parallel ` ( ``parameter_list`` ) (:ref:`see Manual `) \ * :ref:`@parallel ` ( ``parameter_generating_function`` ) (:ref:`see Manual `) \ ", "" "**@check_if_uptodate** (:ref:`see Manual `) - Custom function to determine if jobs need to be run ", " * :ref:`@check_if_uptodate ` ( ``is_task_up_to_date_function`` ) \ ", "" ".. tip:: The use of this overly complicated function is discouraged. **@files_re** - I/O file names via regular expressions - start from lists of file names or |glob|_ results - skips up-to-date jobs ", " * :ref:`@files_re ` ( ``tasks_or_file_names``, ``matching_regex``, [``input_pattern``,] ``output_pattern``, ``...`` ) ``input_pattern``/``output_pattern`` are regex patterns used to create input/output file names from the starting list of either glob_str or file names ", ""