kmonsoor / ruffus

Automatically exported from code.google.com/p/ruffus
http://www.ruffus.org.uk/
MIT License
0 stars 0 forks source link

v2.6.3 ignores the flag files used with @check_if_uptodate and runs the task regardless #77

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Ruffus version 2.6.3 seems to ignore the output of @check_if_uptodate decorator 
and runs the task regardless.
Here is an example:

import os
from ruffus import *

def sentinel_file_exists(output_file):
    if not os.path.exists(output_file):
        return True, "Missing file %s" % output_file
    else:
        return False, "File %s exists" % output_file

@posttask(touch_file("task1_completed.flag"))
@parallel([["task1_completed.flag"]])
@check_if_uptodate(sentinel_file_exists)
def task1(x):
    print 'in task 1'

@follows(task1)    
@posttask(touch_file("task2_completed.flag"))
@parallel([["task2_completed.flag"]])
@check_if_uptodate(sentinel_file_exists)
def task2(x):
    print 'in task2'

pipeline_run(task2)

This code produces the following output when it is run for the first time 
(v2.6.3):
"
________________________________________
Tasks which will be run:

Task enters queue = 'task1'
in task 1
Completed Task = 'task1'
Task enters queue = 'task2'
in task2
Completed Task = 'task2'
"

It is supposed NOT to run 'task1' and 'task2' when re-running due to the 
presence of flag files 'task1_completed.flag' and 'task2_completed.flag'. But, 
the same output is produced again.

Version 2.4.1, on the other hand, works well.

Original issue reported on code.google.com by jafar.ta...@gmail.com on 8 Jun 2015 at 9:23