Exemple #1
0
 def _write_registry(self, registry_proto: RegistryProto):
     registry_proto.version_id = str(uuid.uuid4())
     registry_proto.last_updated.FromDatetime(datetime.utcnow())
     # we have already checked the bucket exists so no need to do it again
     file_obj = TemporaryFile()
     file_obj.write(registry_proto.SerializeToString())
     file_obj.seek(0)
     self.s3_client.Bucket(self._bucket).put_object(Body=file_obj, Key=self._key)
Exemple #2
0
 def _write_registry(self, registry_proto: RegistryProto):
     registry_proto.version_id = str(uuid.uuid4())
     registry_proto.last_updated.FromDatetime(datetime.utcnow())
     # we have already checked the bucket exists so no need to do it again
     gs_bucket = self.gcs_client.get_bucket(self._bucket)
     blob = gs_bucket.blob(self._blob)
     file_obj = TemporaryFile()
     file_obj.write(registry_proto.SerializeToString())
     file_obj.seek(0)
     blob.upload_from_file(file_obj)
Exemple #3
0
 def _write_registry(self, registry_proto: RegistryProto):
     registry_proto.version_id = str(uuid.uuid4())
     registry_proto.last_updated.FromDatetime(datetime.utcnow())
     file_dir = self._filepath.parent
     file_dir.mkdir(exist_ok=True)
     self._filepath.write_bytes(registry_proto.SerializeToString())
Exemple #4
0
 def _write_registry(self, registry_proto: RegistryProto):
     registry_proto.version_id = str(uuid.uuid4())
     registry_proto.last_updated.FromDatetime(datetime.utcnow())
     self._filepath.write_bytes(registry_proto.SerializeToString())
     return