Exemple #1
0
 def CommitManifest(self, request, context=None):
   retrieval_token = self.retrieval_token(request.staging_session_token)
   proxy_manifest = beam_artifact_api_pb2.ProxyManifest(
       manifest=request.manifest,
       location=[
           beam_artifact_api_pb2.ProxyManifest.Location(
               name=metadata.name,
               uri=self._artifact_path(retrieval_token, metadata.name))
           for metadata in request.manifest.artifact])
   with self._open(self._manifest_path(retrieval_token), 'w') as fout:
     fout.write(json_format.MessageToJson(proxy_manifest).encode('utf-8'))
   return beam_artifact_api_pb2.CommitManifestResponse(
       retrieval_token=retrieval_token)
Exemple #2
0
 def _get_manifest_proxy(self, retrieval_token):
   # type: (str) -> beam_artifact_api_pb2.ProxyManifest
   with self._open(self._manifest_path(retrieval_token), 'r') as fin:
     return json_format.Parse(
         fin.read().decode('utf-8'), beam_artifact_api_pb2.ProxyManifest())