def gatewayObjectGetFlow(self, req, container, obj, orig_resp): sreq = StorletGETRequest(self.account, orig_resp, req.params) self.idata = self._get_storlet_invocation_data(req) run_time_sbox = RunTimeSandbox(self.account, self.sconf, self.logger) docker_updated = self.update_docker_container_from_cache() run_time_sbox.activate_storlet_daemon(self.idata, docker_updated) self._add_system_params(req.params) slog_path = self.\ paths.slog_path(self.idata['storlet_main_class']) storlet_pipe_path = self.paths.\ host_storlet_pipe(self.idata['storlet_main_class']) sprotocol = StorletInvocationGETProtocol(sreq, storlet_pipe_path, slog_path, self.storlet_timeout) out_md, self.data_read_fd = sprotocol.communicate() orig_resp = sreq._getInitialRequest() self._set_metadata_in_headers(orig_resp.headers, out_md) self._upload_storlet_logs(slog_path) return out_md, StorletGatewayDocker.IterLike(self.data_read_fd, self.storlet_timeout, sprotocol._cancel)
def gatewayProxyPutFlow(self, orig_req, container, obj): sreq = StorletPUTRequest(self.account, orig_req) req = sreq._getInitialRequest() self.idata = self._get_storlet_invocation_data(req) run_time_sbox = RunTimeSandbox(self.account, self.sconf, self.logger) docker_updated = self.update_docker_container_from_cache() run_time_sbox.activate_storlet_daemon(self.idata, docker_updated) self._add_system_params(req.params) # Clean all Storlet stuff from the request headers # we do not need them anymore, and they # may interfere with the rest of the execution. self._clean_storlet_stuff_from_request(req.headers) req.headers.pop('X-Run-Storlet') slog_path = self.\ paths.slog_path(self.idata['storlet_main_class']) storlet_pipe_path = self.\ paths.host_storlet_pipe(self.idata['storlet_main_class']) sprotocol = StorletInvocationPUTProtocol(sreq, storlet_pipe_path, slog_path, self.storlet_timeout) out_md, self.data_read_fd = sprotocol.communicate() self._set_metadata_in_headers(req.headers, out_md) self._upload_storlet_logs(slog_path) return out_md, StorletGatewayDocker.IterLike(self.data_read_fd, self.storlet_timeout, sprotocol._cancel)
def gatewayProxyPutFlow(self, orig_req, container, obj): sreq = StorletPUTRequest(self.account, orig_req) req = sreq._getInitialRequest() self.idata = self._get_storlet_invocation_data(req) run_time_sbox = RunTimeSandbox(self.account, self.sconf, self.logger) docker_updated = self.update_docker_container_from_cache() run_time_sbox.activate_storlet_daemon(self.idata, docker_updated) self._add_system_params(req.params) # Clean all Storlet stuff from the request headers # we do not need them anymore, and they # may interfere with the rest of the execution. self._clean_storlet_stuff_from_request(req.headers) req.headers.pop('X-Run-Storlet') slog_path = self.\ paths.slog_path(self.idata['storlet_main_class']) storlet_pipe_path = self.\ paths.host_storlet_pipe(self.idata['storlet_main_class']) sprotocol = StorletInvocationPUTProtocol(sreq, storlet_pipe_path, slog_path, self.storlet_timeout) out_md, self.data_read_fd = sprotocol.communicate() self._set_metadata_in_headers(req.headers, out_md) self._upload_storlet_logs(slog_path) return out_md, self.data_read_fd
def gatewayObjectGetFlow(self, req, container, obj, orig_resp): sreq = StorletGETRequest(self.account, orig_resp, req.params) self.idata = self._get_storlet_invocation_data(req) run_time_sbox = RunTimeSandbox(self.account, self.sconf, self.logger) docker_updated = self.update_docker_container_from_cache() run_time_sbox.activate_storlet_daemon(self.idata, docker_updated) self._add_system_params(req.params) slog_path = self.\ paths.slog_path(self.idata['storlet_main_class']) storlet_pipe_path = self.paths.\ host_storlet_pipe(self.idata['storlet_main_class']) sprotocol = StorletInvocationGETProtocol(sreq, storlet_pipe_path, slog_path, self.storlet_timeout) out_md, self.data_read_fd = sprotocol.communicate() orig_resp = sreq._getInitialRequest() self._set_metadata_in_headers(orig_resp.headers, out_md) self._upload_storlet_logs(slog_path) return out_md, self.data_read_fd
def gatewayProxyGETFlow(self, req, container, obj, orig_resp): # Flow for running the GET computation on the proxy sreq = StorletSLORequest(self.account, orig_resp, req.params) self.idata = self._get_storlet_invocation_data(req) run_time_sbox = RunTimeSandbox(self.account, self.sconf, self.logger) docker_updated = self.update_docker_container_from_cache() run_time_sbox.activate_storlet_daemon(self.idata, docker_updated) self._add_system_params(req.params) slog_path = self.\ paths.slog_path(self.idata['storlet_main_class']) storlet_pipe_path = self.\ paths.host_storlet_pipe(self.idata['storlet_main_class']) sprotocol = StorletInvocationSLOProtocol(sreq, storlet_pipe_path, slog_path, self.storlet_timeout) out_md, self.data_read_fd = sprotocol.communicate() self._set_metadata_in_headers(orig_resp.headers, out_md) self._upload_storlet_logs(slog_path) return out_md, StorletGatewayDocker.IterLike(self.data_read_fd, self.storlet_timeout, sprotocol._cancel)