Is there any examples available for the RangeHourly provision (or similar ones like RangeDaily) . I've been trying to use it to have recurring execution of tasks . But I always end up getting an error like below :
DEBUG: Checking if RangeHourly(of=FinalTask, of_params={}, reverse=False, task_limit=50, now=None, param_name=None, start=2017-06-28T15, stop=None, hours_back=0, hours_forward=0) is complete DEBUG: Empty range. No FinalTask instances expected
Below , is the definition of the task :
class FinalTask (luigi.Task):
start = luigi.DateHourParameter()
def requires(self):
return CleanupTask()
def run(self):
cmd='echo "Workflow Completed"'
args=shlex.split(cmd)
exc=subprocess.Popen(args,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
stdout,stderr=exc.communicate()
self.output().open('w').close()
def output(self):
return luigi.LocalTarget('/var/flags/FinalTask_success_%s.csv' %start)
Is there anything I'm missing , which is causing this problem ?
python tasks.py RangeHourlyBase --of FinalTask --start 2017-07-31T00 --stop 2017-07-31T23 --local-scheduler --workers 4
Notice that:
tasks.py
with the filename where FinalTask
is defined.--local-scheduler
is just for running your tasks locally. Don't use it @ production.There's an error at the last line: start
is not defined, it should be:
return luigi.LocalTarget('/var/flags/FinalTask_success_%s.csv' % self.start)