mirror of
https://github.com/lancedb/lancedb.git
synced 2026-09-02 03:28:41 +00:00
package demo udf callable for remote execution
This commit is contained in:
@@ -741,7 +741,11 @@ def _package_source(function: Callable[..., Any]) -> bytes:
|
||||
if globals_source:
|
||||
parts.extend(["", *globals_source])
|
||||
parts.extend(["", function_source, ""])
|
||||
return "\n".join(parts).encode("utf-8")
|
||||
try:
|
||||
import cloudpickle
|
||||
except ImportError as error:
|
||||
raise RuntimeError("@udf remote registration requires cloudpickle") from error
|
||||
return cloudpickle.dumps(function)
|
||||
|
||||
|
||||
class UdfDefinition:
|
||||
|
||||
Reference in New Issue
Block a user