cgat-developers / ruffus

CGAT-ruffus is a lightweight python module for running computational pipelines
MIT License
173 stars 34 forks source link

New Object-Orientated style syntax and ruffus.cmdline #48

Closed bunbun closed 9 years ago

bunbun commented 9 years ago

Alec Wysoker writes:

I'm trying to switch over to the new object-oriented syntax, but I'm having a problem I can't debug. In my non-OO pipeline, I used formatter(), because I want to name the output files explicitly rather than use the regex stuff. None of your OO examples use filter=formatter(), so I'm wondering if my problem relates to that.

Can you tell me if I'm doing something wrong? Example script, and output are below.

Thanks, Alec

oo_problem.py:


#!/usr/bin/env python
import sys
import ruffus.cmdline as cmdline
import ruffus
from ruffus.drmaa_wrapper import run_job, error_drmaa_job

print "Ruffus version: ", ruffus.__version__
parser = cmdline.get_argparse(prog=__name__, description="bug example")
options = parser.parse_args()
pipeline = ruffus.Pipeline(name="Hello!")
def example_func(input_file, output_file):
    run_job("cp %s %s" % (input_file, output_file), job_name="example")
pipeline.transform(task_func=example_func,
                   input=["input.file"],
                   filter=ruffus.formatter(),
                   output="output.file")
cmdline.run(options)

When I run it, I get the following:

% touch input.file
% python oo_problem.py 
Ruffus version:  2.6.2
Traceback (most recent call last):
  File "oo_problem.py", line 18, in <module>
    cmdline.run(options)
  File "/humgen/cnp04/sandbox/alecw/tmp/test_deploy/py-lib/ruffus/cmdline.py", line 824, in run
    **appropriate_options)
  File "/humgen/cnp04/sandbox/alecw/tmp/test_deploy/py-lib/ruffus/task.py", line 5818, in pipeline_run
    raise job_errors
ruffus.ruffus_exceptions.RethrownJobError: 

Original exception:

    Exception #1
      'exceptions.ValueError(need more than 0 values to unpack)' raised in ...
       Task = def example_func(...):
       Job  = [?? -> ??]

    Traceback (most recent call last):
      File "/humgen/cnp04/sandbox/alecw/tmp/test_deploy/py-lib/ruffus/task.py", line 749, in run_pooled_job_without_exceptions
        register_cleanup, touch_files_only)
      File "/humgen/cnp04/sandbox/alecw/tmp/test_deploy/py-lib/ruffus/task.py", line 556, in job_wrapper_io_files
        i, o = params[0:2]
    ValueError: need more than 0 values to unpack
bunbun commented 9 years ago

Fixed in 2.6.3

bunbun commented 9 years ago

The bug is triggered because Ruffus did not initialise (parts of ) pipelines that it erroneously thought was unreachable.