···1313 RunValidationFunction,
1414)
1515from osprey.engine.executor.execution_context import (
1616- EntityLabelMutation,
1716 ExecutionContext,
1817)
1918from osprey.engine.language_types.entities import EntityT
···2423from osprey.engine.udf.arguments import ArgumentsBase
2524from osprey.engine.udf.base import UDFBase
2625from osprey.engine.udf.registry import UDFRegistry
2727-from osprey.rpc.labels.v1.service_pb2 import LabelStatus
2626+from osprey.worker.lib.osprey_shared.labels import EntityLabelMutation, LabelStatus
2827from osprey.worker.sinks.sink.output_sink import _get_label_effects_from_result
2929-3030-# Moved here because WhenRules is not included in the MVP yet
312832293330class FailingUdf(UDFBase[ArgumentsBase, bool]):
+6-2
osprey_worker/src/osprey/engine/udf/registry.py
···2121 return instance
22222323 def register(self, func: Type[UDFBase[Any, Any]]) -> Type[UDFBase[Any, Any]]:
2424- if func.__name__ in self._functions:
2525- raise Exception(f'A function with the name {func.__name__} is already registered.')
2424+ # Allow idempotent re-registration of the exact same class.
2525+ existing = self.get(func.__name__)
2626+ if existing is not None:
2727+ if existing is func:
2828+ return existing
2929+ raise Exception(f'A function with the name {func.__name__} is already registered with {func}.')
26302731 try:
2832 rvalue_type = func.get_rvalue_type()