gpt4 book ai didi

apache-spark - 使用 Databricks 提交 api 运行 python_wheel_task

转载 作者:行者123 更新时间:2023-12-05 04:38:58 25 4
gpt4 key购买 nike

我想通过提供 package_name 和 entry_point 使用 api/2.0/jobs/runs/submit API 端点将 Python wheel 作为 Spark 作业运行:

{
'existing_cluster_id': self.cluster_id,
"python_wheel_task": {
"package_name": "my.package",
"entry_point": "my_method"
},
"libraries": [
{"whl": "dbfs:/FileStore/jars/1e023c35_ca3a_42c0_958b_fa308124ccc3/my_lib-0.0.1-py3-none-any.whl"}
]

}

但是,在处理请求时,Databricks 正在使用 %conda magic 命令(用于使用熟悉的 pip 和 conda 语法在笔记本范围内管理 Python 包依赖项),这些命令在标准 Databricks Runtime(仅 Databricks Runtime ML v6.4+ 支持):

Py4JJavaError: An error occurred while calling t.getCondaEnvState.
: org.apache.spark.SparkException: Conda magic is only available on Databricks Runtime for Machine Learning.
at com.databricks.backend.daemon.driver.PythonDriverLocal$PythonEntryPointInterfaceImpl.getCondaEnvState(PythonDriverLocal.scala:265)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:380)
at py4j.Gateway.invoke(Gateway.java:295)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.GatewayConnection.run(GatewayConnection.java:251)
at java.lang.Thread.run(Thread.java:748)

除了使用 spark_python_task 结合导入 wheel 的入口点并运行它的脚本之外,还有其他选项可以运行 Python wheel 吗?

提前致谢。

最佳答案

我相信这应该可以通过 libraries 字段的规范来实现(参见 docs ),尽管我不记得如何在现有集群上处理它(并且无法检查现在)。你能试试这样吗:

{
"existing_cluster_id": <cluster_id>,
"python_wheel_task": {
"package_name": <package_name>,
"entry_point": <entry_point>
},
"libraries": [
{ "whl": "dbfs:/FileStore/my-lib.whl" }
]
}

关于apache-spark - 使用 Databricks 提交 api 运行 python_wheel_task,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70497394/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com