title: Luigi: Dynamic dependency on WrapperTask
body: <p>I have something like the following:</p>
  <pre class="lang-py prettyprint-override"><code>exports = {
  }
  
  
  class MainTask(luigi.WrapperTask):
      def requires(self):
          task_a = TaskA()
  
          yield TaskB(dependency=task_a)
  
  
  class TaskA(luigi.Task):
      &quot;&quot;&quot;
      This is where exports dictionary are evaluated
      &quot;&quot;&quot;
      pass
  
  
  class TaskB(luigi.WrapperTask):
      dependency = luigi.TaskParameter()
  
      def requires(self):
          for n in exports['task_a']:
              yield TaskC(some_number=n)
  
  
  class TaskC(luigi.Task):
      some_number = luigi.Parameter()
      # some other code
  </code></pre>
  <p>My problem is that when I run this I get a <code>KeyError</code> on <code>for n in exports['task_a']</code> since the <code>exports</code> dictionary has not been evaluated yet. What I actually want is for <code>TaskB</code> to not run its requires method until <code>TaskA</code> - which populates the <code>exports</code> dictionary - is done. Nevertheless, I want to keep the <code>WrapperTask</code> nature of <code>TaskB</code> since it does not produce any outputs. I tried to convert it to a <code>luigi.Task</code> which yield the dynamic dependencies under its <code>run</code> method like so:</p>
  <pre class="lang-py prettyprint-override"><code>class TaskB(luigi.Task):
      dependency = luigi.TaskParameter()
  
      def requires(self):
          yield self.dependency
          
      def run(self):
          for n in exports['task_a']:
              yield TaskC(some_number=n)
  
  </code></pre>
  <p>but this generated even more problems. So how can I make sure that TaskB's requires only runs after TaskA has been executed by keeping it as a wrapper task?</p>