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 infile1,self.input()['input11']['output2'].open("r") as infile2,self.input()['input12']['output1'].open("r") as infile3,self.input()['input12']['output2'].open("r") as infile4,self.output['output1'].open("w") as outfile:self.output['output2'].open("w") as outfile2:for line in infile:line = exec_command("some-command -reffile=" + infile1 + " -dataset=" + infile2 " <.....> "-outfile=" + outfile1 + " -newreffile=" + outfile2...)outfile.write(line)
I'm also facing a similar issue and would like to share how I've been dealing with multiple output targets.
I have an example of a Task that generates multiple files as outputs, all of them known only at `run()` time. Because of that I can't define what the Targets are in the `output()` method.
In order to solve this, I've followed an approach similar to Martin's:
1. Define a plain text file as this Task's output Target.
2. While inside the `run()` method: append the path to the *real* output targets in this file as they're discovered.
3. Override the `complete()` method so that it reads the `output()` file and asserts that every path listed there exists.
I suppose that downstream tasks could also read this file and dinamically generate their requirements.
This might seem a bit hacky, but it kind of solved my problem. :)
Cheers,
Tiago.
--
You received this message because you are subscribed to the Google Groups "Luigi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to luigi-user+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "Luigi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/luigi-user/ybWN_lEcPrU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to luigi-user+unsubscribe@googlegroups.com.
Directory targets are a really interesting idea. I didn't know Luigi supported directories as targets like that. Could you point me to an example by chance?
To unsubscribe from this group and stop receiving emails from it, send an email to luigi-user+...@googlegroups.com.