简体   繁体   English

使用数据块集群执行 azure 存储上存在的 python 代码

[英]Executing python code present on azure storage using databricks cluster

We are having code structure like我们有这样的代码结构在此处输入图像描述

In pkg folder we have main.py and execute.py imports (from pkg import main.hello)在 pkg 文件夹中,我们有 main.py 和 execute.py 导入(来自 pkg import main.hello)

execute.py执行.py

from mnt.cdr.code.pkg import main

main.hello()

main.py主程序

def hello():
    print("hello")

this code is present on azure storage and that blob container is mounted to /mnt/cdr/code.. But we are getting "mnt Module not found".此代码存在于 azure 存储中,并且该 blob 容器已安装到 /mnt/cdr/code.. 但我们收到“找不到 mnt 模块”。

How can I run this code from blob container on azure databricks cluster?如何从 azure databricks 集群上的 blob 容器运行此代码?

The Module Not Found Error usually occurs when Python cannot locate an error. Module Not Found Error 通常出现在Python 无法定位错误的时候。 The most common cause of this error is not installing modules required or importing a module incorrectly.此错误的最常见原因是没有安装所需的模块或错误地导入了模块。

please check if all modules are imported.If all are correct please restart the cluster and check请检查是否导入了所有模块。如果都正确请重启集群并检查

The issue can be due to version of azure library which may conflict with the already present libraries.Check by downgrading or upgrading Azure library.该问题可能是由于 azure 库的版本可能与现有库冲突。通过降级或升级 Azure 库进行检查。 Also When you try to access an already created mount point or create a new mount point, it fails with the error.此外,当您尝试访问已创建的安装点或创建新的安装点时,它会失败并出现错误。

To unmount a mount point, use the following command: dbutils.fs.unmount("/mnt/")要卸载挂载点,请使用以下命令:dbutils.fs.unmount("/mnt/")

check Failure when mounting Blob storage - Azure Databricks | 安装 Blob 存储时检查失败 - Azure Databricks | Microsoft Docs & bash - Azure Databricks cluster init script - install python wheel - Stack Overflow Microsoft Docs & bash - Azure Databricks 集群初始化脚本 - 安装 python wheel - 堆栈内存溢出

References:参考:

  1. azure-sdk-for-python-storage-blob-upload-download azure-sdk-for-python-存储-blob-上传-下载
  2. Libraries | 图书馆 | Databricks 数据块
  3. util-linux 实用程序-linux

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用数据块 python 代码删除 azure 帐户中的文件 - Deleting files in azure account using databricks python code 在 Azure Databricks 上并行化 Python 代码 - Parallelizing Python code on Azure Databricks 在 spark 集群配置数据块中参数化 azure 存储帐户名称 - parameterize azure storage account name in spark cluster config databricks 是否可以使用 PowerShell 脚本创建 Azure Databricks 集群? - Is it possible to create Azure Databricks Cluster using PowerShell script? Databricks python/pyspark 代码,用于查找 azure 容器中 blob 的年龄 - Databricks python/pyspark code to find the age of the blob in azure container Python 代码列出 Azure Databricks 中每个子目录中的文件 - Python code to list files in each sub directory in Azure Databricks 记录直到 Azure Databricks 集群重新启动才显示 - Records not showing until Azure Databricks cluster restarted 在 Azure 数据块中使用 Pyspark 代码比使用 SQL 有什么好处? - Any benefits of using Pyspark code over SQL in Azure databricks? 无法使用数据块连接从 Windows 连接到数据块集群 - Unable to connect to databricks cluster from Windows using databricks-connect 在不创建新集群的情况下在 azure 数据块中执行 spark-submit - Execute spark-submit in azure databricks without creating new cluster
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM