【问题标题】:save spark ML model in azure blobs在 azure blobs 中保存 spark ML 模型
【发布时间】:2019-03-13 03:43:06
【问题描述】:

我尝试将 pyspark 中的机器学习模型保存到 azure blob。但这会出错。

lr.save('wasbs:///user/remoteuser/models/')

Illegal Argument Exception: Cannot initialize WASB file system, URI authority not recognized.'

也试过了,

m = lr.save('wasbs://'+container_name+'@'+storage_account_name+'.blob.core.windows.net/models/')

但无法在堆栈跟踪中识别用户身份。 附言: 我没有使用 Azure HDInsight。我只是在使用 Databricks 和 Azure blob 存储

【问题讨论】:

    标签: azure pyspark azure-blob-storage databricks


    【解决方案1】:

    要直接从 Azure Databricks(未装载)访问 Azure Blob 存储,您必须设置一个帐户访问密钥:

    spark.conf.set(
      "fs.azure.account.key.<your-storage-account-name>.blob.core.windows.net",
      "<your-storage-account-access-key>")
    

    或容器的 SAS。然后您应该能够访问 Blob 存储:

    val df = spark.read.parquet("wasbs://<your-container-name>@<your-storage-account-name>.blob.core.windows.net/<your-directory-name>")
    

    【讨论】:

    • 其实阅读是可以的。但是我如何在 azure blob 中保存 spark ml 模型。作为一种解决方法,我创建了一个包含模型层和模型权重的文本文件,然后使用 azure-blob-storage 库使用 block_blob_service。但是 Spark 查询会直接使工作流程更加顺畅
    猜你喜欢
    • 2016-10-17
    • 2016-07-14
    • 2016-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-09
    • 2018-07-22
    • 1970-01-01
    相关资源
    最近更新 更多