Created
June 18, 2014 07:16
-
-
Save samuell/0f6d9edd4c9440874030 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TaskA1(luigi.Task): | |
def requires(self): | |
.... | |
def output(self): | |
return { 'output1' : luigi.LocalTarget( self.input().path + ".output1" ), | |
'output2' : luigi.LocalTarget( self.input().path + ".output2" ) } | |
def run(self): | |
.... | |
class TaskA2(luigi.Task): | |
def requires(self): | |
.... | |
def output(self): | |
return { 'output1' : luigi.LocalTarget( self.input().path + ".output1" ), | |
'output2' : luigi.LocalTarget( self.input().path + ".output2" ) } | |
def run(self): | |
.... | |
class TaskB(luigi.Task): | |
def requires(self): | |
return { 'input1' : TaskA1(), | |
'input2' : TaskA2() } | |
def output(self): | |
return { 'output1' : self.input()['input1']['output1'].path + ".output1", | |
'output2' : self.input()['input1']['output1'].path + ".output2" } | |
def run(self): | |
with self.input()['input11']['output1'].open("r") as infile, self.output['output1'].open("w") as outfile: | |
for line in infile: | |
line = do_something(line) | |
outfile.write(line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment