Example #1
0
    def start(self):
        self.controller.profile = self.label
        self.controller.ipython_dir = self.run_dir
        self.controller.start()

        self.engine_file = self.controller.engine_file

        with wait_for_file(self.controller.client_file, seconds=120):
            logger.debug("Waiting for {0}".format(self.controller.client_file))

        if not os.path.exists(self.controller.client_file):
            raise Exception("Controller client file is missing at {0}".format(
                self.controller.client_file))

        command_composer = self.compose_launch_cmd

        self.executor = Client(url_file=self.controller.client_file)
        if self.container_image:
            command_composer = self.compose_containerized_launch_cmd
            logger.info("Launching IPP with Docker:{0}".format(
                self.container_image))

        self.launch_cmd = command_composer(self.engine_file, self.engine_dir,
                                           self.container_image)
        self.engines = []

        if self.provider:
            self._scaling_enabled = self.provider.scaling_enabled
            logger.debug("Starting IPyParallelExecutor with provider:\n%s",
                         self.provider)
            if hasattr(self.provider, 'init_blocks'):
                try:
                    for i in range(self.provider.init_blocks):
                        engine = self.provider.submit(self.launch_cmd, 1)
                        logger.debug("Launched block: {0}:{1}".format(
                            i, engine))
                        if not engine:
                            raise (ScalingFailed(
                                self.provider.label,
                                "Attempts to provision nodes via provider has failed"
                            ))
                        self.engines.extend([engine])

                except Exception as e:
                    logger.error("Scaling out failed: %s" % e)
                    raise e

        else:
            self._scaling_enabled = False
            logger.debug("Starting IpyParallelExecutor with no provider")

        self.lb_view = self.executor.load_balanced_view()
        logger.debug("Starting executor")
Example #2
0
    def start(self):
        self.controller.profile = self.label
        self.controller.ipython_dir = self.run_dir
        if self.engine_dir is None:
            parent, child = pathlib.Path(self.run_dir).parts[-2:]
            self.engine_dir = os.path.join(parent, child)
        self.controller.start()

        self.engine_file = self.controller.engine_file

        with wait_for_file(self.controller.client_file, seconds=120):
            logger.debug("Waiting for {0}".format(self.controller.client_file))

        if not os.path.exists(self.controller.client_file):
            raise Exception("Controller client file is missing at {0}".format(
                self.controller.client_file))

        command_composer = self.compose_launch_cmd

        self.executor = Client(url_file=self.controller.client_file)
        if self.container_image:
            command_composer = self.compose_containerized_launch_cmd
            logger.info("Launching IPP with Docker image: {0}".format(
                self.container_image))

        self.launch_cmd = command_composer(self.engine_file, self.engine_dir,
                                           self.container_image)
        self.engines = []

        self._scaling_enabled = self.provider.scaling_enabled
        logger.debug("Starting IPyParallelExecutor with provider:\n%s",
                     self.provider)
        if hasattr(self.provider, 'init_blocks'):
            try:
                self.scale_out(blocks=self.provider.init_blocks)
            except Exception as e:
                logger.error("Scaling out failed: %s" % e)
                raise e

        self.lb_view = self.executor.load_balanced_view()
        logger.debug("Starting executor")