From 7dc9426eb9445986001faa11c0c3cd0dfb8d905e Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Fri, 12 Aug 2016 22:59:37 -0400 Subject: [PATCH] More stable hash ID --- metrik/flows/libor_flow.py | 4 ++-- metrik/tasks/ice.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/metrik/flows/libor_flow.py b/metrik/flows/libor_flow.py index 3ef4e01..37f843c 100644 --- a/metrik/flows/libor_flow.py +++ b/metrik/flows/libor_flow.py @@ -1,10 +1,10 @@ -from luigi import Task, DateParameter, LocalTarget +from luigi import WrapperTask, DateParameter, LocalTarget from metrik.tasks.ice import LiborRateTask from metrik.targets.temp_file import TempFileTarget -class LiborFlow(Task): +class LiborFlow(WrapperTask): date = DateParameter() def requires(self): diff --git a/metrik/tasks/ice.py b/metrik/tasks/ice.py index 52a57cd..e80f967 100644 --- a/metrik/tasks/ice.py +++ b/metrik/tasks/ice.py @@ -1,3 +1,4 @@ +from __future__ import print_function from luigi.task import Task from luigi.parameter import DateParameter, Parameter # noinspection PyUnresolvedReferences @@ -25,7 +26,8 @@ class LiborRateTask(Task): currency = Parameter() def output(self): - return MongoTarget('libor', hash(self.task_id)) + h = hash(str(self.to_str_params())) + return MongoTarget('libor', h) def run(self): libor_record = self.retrieve_data(self.date, self.currency)