Esempio n. 1
0
    def invocation_flow(self, sreq, extra_sources=None):
        """
        Invoke the backend protocl with gateway

        :param sreq: StorletRequest instance
        :param extra_sources (WIP): A list of StorletRequest instance to gather
                                    as extra resoureces to feed to storlet
                                    container as data source
        :return: StorletResponse instance
        """
        run_time_sbox = RunTimeSandbox(self.scope, self.conf, self.logger)
        docker_updated = self.update_docker_container_from_cache(sreq)
        run_time_sbox.activate_storlet_daemon(sreq, docker_updated)
        self._add_system_params(sreq)

        slog_path = self.paths.get_host_slog_path(sreq.storlet_main)
        storlet_pipe_path = \
            self.paths.get_host_storlet_pipe(sreq.storlet_main)

        sprotocol = StorletInvocationProtocol(sreq,
                                              storlet_pipe_path,
                                              slog_path,
                                              self.storlet_timeout,
                                              self.logger,
                                              extra_sources=extra_sources)

        sresp = sprotocol.communicate()

        self._upload_storlet_logs(slog_path, sreq)

        return sresp
Esempio n. 2
0
 def setUp(self):
     self.logger = FakeLogger()
     # TODO(takashi): take these values from config file
     self.conf = {'docker_repo': 'localhost:5001'}
     self.scope = '0123456789abc'
     self.sbox = RunTimeSandbox(self.scope, self.conf, self.logger)