Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
feature_set.is_valid()
feature_set_proto = feature_set.to_proto()
if len(feature_set_proto.spec.project) == 0:
if self.project is None:
raise ValueError(
f"No project found in feature set {feature_set.name}. "
f"Please set the project within the feature set or within "
f"your Feast Client."
)
else:
feature_set_proto.spec.project = self.project
# Convert the feature set to a request and send to Feast Core
try:
apply_fs_response = self._core_service_stub.ApplyFeatureSet(
ApplyFeatureSetRequest(feature_set=feature_set_proto),
timeout=GRPC_CONNECTION_TIMEOUT_APPLY,
) # type: ApplyFeatureSetResponse
except grpc.RpcError as e:
raise grpc.RpcError(e.details())
# Extract the returned feature set
applied_fs = FeatureSet.from_proto(apply_fs_response.feature_set)
# If the feature set has changed, update the local copy
if apply_fs_response.status == ApplyFeatureSetResponse.Status.CREATED:
print(
f'Feature set updated/created: "{applied_fs.name}:{applied_fs.version}"'
)
# If no change has been applied, do nothing
if apply_fs_response.status == ApplyFeatureSetResponse.Status.NO_CHANGE:
request_deserializer=feast_dot_core_dot_CoreService__pb2.GetFeatureSetRequest.FromString,
response_serializer=feast_dot_core_dot_CoreService__pb2.GetFeatureSetResponse.SerializeToString,
),
'ListFeatureSets': grpc.unary_unary_rpc_method_handler(
servicer.ListFeatureSets,
request_deserializer=feast_dot_core_dot_CoreService__pb2.ListFeatureSetsRequest.FromString,
response_serializer=feast_dot_core_dot_CoreService__pb2.ListFeatureSetsResponse.SerializeToString,
),
'ListStores': grpc.unary_unary_rpc_method_handler(
servicer.ListStores,
request_deserializer=feast_dot_core_dot_CoreService__pb2.ListStoresRequest.FromString,
response_serializer=feast_dot_core_dot_CoreService__pb2.ListStoresResponse.SerializeToString,
),
'ApplyFeatureSet': grpc.unary_unary_rpc_method_handler(
servicer.ApplyFeatureSet,
request_deserializer=feast_dot_core_dot_CoreService__pb2.ApplyFeatureSetRequest.FromString,
response_serializer=feast_dot_core_dot_CoreService__pb2.ApplyFeatureSetResponse.SerializeToString,
),
'UpdateStore': grpc.unary_unary_rpc_method_handler(
servicer.UpdateStore,
request_deserializer=feast_dot_core_dot_CoreService__pb2.UpdateStoreRequest.FromString,
response_serializer=feast_dot_core_dot_CoreService__pb2.UpdateStoreResponse.SerializeToString,
),
'CreateProject': grpc.unary_unary_rpc_method_handler(
servicer.CreateProject,
request_deserializer=feast_dot_core_dot_CoreService__pb2.CreateProjectRequest.FromString,
response_serializer=feast_dot_core_dot_CoreService__pb2.CreateProjectResponse.SerializeToString,
),
'ArchiveProject': grpc.unary_unary_rpc_method_handler(
servicer.ArchiveProject,
request_deserializer=feast_dot_core_dot_CoreService__pb2.ArchiveProjectRequest.FromString,
response_serializer=feast_dot_core_dot_CoreService__pb2.ArchiveProjectResponse.SerializeToString,
request_serializer=feast_dot_core_dot_CoreService__pb2.GetFeatureSetRequest.SerializeToString,
response_deserializer=feast_dot_core_dot_CoreService__pb2.GetFeatureSetResponse.FromString,
)
self.ListFeatureSets = channel.unary_unary(
'/feast.core.CoreService/ListFeatureSets',
request_serializer=feast_dot_core_dot_CoreService__pb2.ListFeatureSetsRequest.SerializeToString,
response_deserializer=feast_dot_core_dot_CoreService__pb2.ListFeatureSetsResponse.FromString,
)
self.ListStores = channel.unary_unary(
'/feast.core.CoreService/ListStores',
request_serializer=feast_dot_core_dot_CoreService__pb2.ListStoresRequest.SerializeToString,
response_deserializer=feast_dot_core_dot_CoreService__pb2.ListStoresResponse.FromString,
)
self.ApplyFeatureSet = channel.unary_unary(
'/feast.core.CoreService/ApplyFeatureSet',
request_serializer=feast_dot_core_dot_CoreService__pb2.ApplyFeatureSetRequest.SerializeToString,
response_deserializer=feast_dot_core_dot_CoreService__pb2.ApplyFeatureSetResponse.FromString,
)
self.UpdateStore = channel.unary_unary(
'/feast.core.CoreService/UpdateStore',
request_serializer=feast_dot_core_dot_CoreService__pb2.UpdateStoreRequest.SerializeToString,
response_deserializer=feast_dot_core_dot_CoreService__pb2.UpdateStoreResponse.FromString,
)
self.CreateProject = channel.unary_unary(
'/feast.core.CoreService/CreateProject',
request_serializer=feast_dot_core_dot_CoreService__pb2.CreateProjectRequest.SerializeToString,
response_deserializer=feast_dot_core_dot_CoreService__pb2.CreateProjectResponse.FromString,
)
self.ArchiveProject = channel.unary_unary(
'/feast.core.CoreService/ArchiveProject',
request_serializer=feast_dot_core_dot_CoreService__pb2.ArchiveProjectRequest.SerializeToString,
response_deserializer=feast_dot_core_dot_CoreService__pb2.ArchiveProjectResponse.FromString,