
import IPython.parallel

from .simple import SimpleRunner
from .mixinparallel import MixInParallelRunner


class IPythonParallelRunner(MixInParallelRunner, SimpleRunner):

    def submit_tasks(self):
        self.client = IPython.parallel.Client()
        self.view = view = self.client.load_balanced_view()
        self.results = results = {}
        for node in self.sorted_nodes():
            deps = [results[n] for n in self.graph.predecessors(node)]
            with view.temp_flags(after=deps):
                results[node] = view.apply_async(self.run_func,
                                                 self.nodetaskmap[node])

    def wait_tasks(self):
        self.view.wait(self.results.values())


import IPython.parallel

from .simple import SimpleRunner
from .mixinparallel import MixInParallelRunner


class IPythonParallelRunner(MixInParallelRunner, SimpleRunner):

    def submit_tasks(self):
        self.client = IPython.parallel.Client()
        self.view = view = self.client.load_balanced_view()
        self.results = results = {}
        for node in self.sorted_nodes():
            deps = [results[n] for n in self.graph.predecessors(node)]
            with view.temp_flags(after=deps):
                results[node] = view.apply_async(self.run_func,
                                                 self.nodetaskmap[node])

    def wait_tasks(self):
        for r in self.results.values():
            r.get()

Raise error if any in IPythonParallelRunner.wait_tasks
Raise error if any in IPythonParallelRunner.wait_tasks

  
  import IPython.parallel
  
  from .simple import SimpleRunner
  from .mixinparallel import MixInParallelRunner
  
  
  class IPythonParallelRunner(MixInParallelRunner, SimpleRunner):
  
      def submit_tasks(self):
          self.client = IPython.parallel.Client()
          self.view = view = self.client.load_balanced_view()
          self.results = results = {}
          for node in self.sorted_nodes():
              deps = [results[n] for n in self.graph.predecessors(node)]
              with view.temp_flags(after=deps):
                  results[node] = view.apply_async(self.run_func,
                                                   self.nodetaskmap[node])
  
      def wait_tasks(self):
-         self.view.wait(self.results.values())
+         for r in self.results.values():
+             r.get()
  
Raise error if any in IPythonParallelRunner.wait_tasks
## Code Before:

import IPython.parallel

from .simple import SimpleRunner
from .mixinparallel import MixInParallelRunner


class IPythonParallelRunner(MixInParallelRunner, SimpleRunner):

    def submit_tasks(self):
        self.client = IPython.parallel.Client()
        self.view = view = self.client.load_balanced_view()
        self.results = results = {}
        for node in self.sorted_nodes():
            deps = [results[n] for n in self.graph.predecessors(node)]
            with view.temp_flags(after=deps):
                results[node] = view.apply_async(self.run_func,
                                                 self.nodetaskmap[node])

    def wait_tasks(self):
        self.view.wait(self.results.values())

## Instruction:
Raise error if any in IPythonParallelRunner.wait_tasks
## Code After:

import IPython.parallel

from .simple import SimpleRunner
from .mixinparallel import MixInParallelRunner


class IPythonParallelRunner(MixInParallelRunner, SimpleRunner):

    def submit_tasks(self):
        self.client = IPython.parallel.Client()
        self.view = view = self.client.load_balanced_view()
        self.results = results = {}
        for node in self.sorted_nodes():
            deps = [results[n] for n in self.graph.predecessors(node)]
            with view.temp_flags(after=deps):
                results[node] = view.apply_async(self.run_func,
                                                 self.nodetaskmap[node])

    def wait_tasks(self):
        for r in self.results.values():
            r.get()
