Skip to content

Instantly share code, notes, and snippets.

@samuell
Created June 18, 2014 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samuell/0f6d9edd4c9440874030 to your computer and use it in GitHub Desktop.
Save samuell/0f6d9edd4c9440874030 to your computer and use it in GitHub Desktop.
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