Closed GoogleCodeExporter closed 9 years ago
Oh, also, if I try:
@files(task1,None)
def task2(infile) :
print infile
error_task_files:
Input or output file parameters should contain at least one or more file names strings.[<function task1 at 0x205e758>, None] for
'def task2(...):'
Original comment by alabad...@gmail.com
on 1 Aug 2011 at 6:18
Not sure what you are trying to do but the attached code is what I would expect.
AFAIK, the @files decorator does not take task arguments.
@files takes either input/output parameters (usually file names)
(http://www.ruffus.org.uk/decorators/files.html)
or a generator which yields the appropriate parameters.
http://www.ruffus.org.uk/decorators/files_ex.html
The latter explains your error message.
To have "task" dependencies, use @transform, @split, @merge etc.
Please see the tutorial or manual at www.ruffus.org.uk or post to the
ruffus_discuss newsgroup (http://groups.google.com/group/ruffus_discuss) for
help.
Leo
from ruffus import *
@files(None,"task1.out")
def task1(infile,outfile) :
print infile
open(outfile,'w')
# empty suffix because we are not generating an output
@transform(task1, suffix(""), None)
def task2(infile, outfile):
print infile
# See what is going to happen
import sys
pipeline_printout(sys.stdout, [task2], verbose = 3)
# run pipeline
pipeline_run([task2])
Original comment by bunbu...@gmail.com
on 5 Oct 2011 at 12:50
Thanks for the response. The documentation I followed for supplying tasks to
the @files decorator is here:
http://www.ruffus.org.uk/tutorials/manual/tasks_and_globs_in_inputs.html
The first topic describes how to implicitly chain task output/input files
together, is this documentation out of date? Passing tasks to the @files
decorator does work as described. In any case, my issue was only about minor
inconveniences - when a task is provided as the input to a step and there is no
output, I have to provide a placeholder string that means nothing as the output
parameter to @files and also include a placeholder formal argument to the task
method. I admittedly have not fully explored the @transform decorator, so it
may be that that's what I should be using instead of @files. The second small
inconvenience is that in this situation, if a task is provided as a first
argument and None is the second, which I think should be legal based on the
documentation, the package complains that at least one of the input/output
filename arguments must be a string. Very minor things.
I've been using ruffus quite a lot since this post, I really like the package.
Thanks!
Original comment by alabad...@gmail.com
on 5 Oct 2011 at 3:48
I apologise. You are indeed right.
Nevertheless... Much of the point to @files is that ruffus will check if
your task or your jobs are up to date by looking at the modification times.
If there is no output, then task2 will always run, using the inputs from task1.
In which case, you might consider
@parallel(task1, None)
Original comment by bunbu...@gmail.com
on 5 Oct 2011 at 11:30
Original issue reported on code.google.com by
alabad...@gmail.com
on 1 Aug 2011 at 6:15