请问当我启动 Function 应用程序时,如何从 Azure 存储帐户读取数据。我需要在运行时读取机器学习模型保存的权重。我想直接从存储帐户读取模型,因为模型预计每天更新,并且不想手动重新部署模型。
谢谢
azure-blob-storage azure-data-lake azure-devops azure-functions azure-function-app
我正在尝试直接连接到 abfss(无需安装到 DBFS)并尝试使用 databricks 中的 open() 方法打开 json 文件。
json_file = open("abfss://@.dfs.core.windows.net/test.json') databricks 无法打开 azure blob 容器中存在的文件并出现以下错误:FileNotFoundError: [Errno 2] No such file 或目录:'abfss://@.dfs.core.windows.net/test.json'
我已经使用服务主体完成了所有配置设置。请建议使用 abfss 直接路径打开文件的其他方式。
我有一个控制台应用程序可以.Net core 2.2将文件上传到 Azure blob 存储。它完全没问题,并且可以在我的本地计算机上运行,但是当我将应用程序部署到 Azure 应用程序服务时,它会引发异常并显示以下错误:
Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd
问题出在这行代码上:
BlobServiceClient storageAccount = new BlobServiceClient("connection string")
System.Diagnostics.DiagnosticSource我尝试更改和的版本Azure.Storage.Blobs,但它在 Azure 应用服务上不起作用
编辑:我没有找到问题的任何解决方案,我更改了代码,以便使用 aps.net core 应用程序中的 Azure 存储。
除了日志分析之外,还有其他方法可以确定 Azure 存储文件的上次访问时间吗?那么,有没有人遇到过这种情况,实现这一目标的最佳方法是什么?还是我太在意这个了?
提前谢谢您。
我正在开发允许用户下载 Azure Blob 存储项目的功能。
我正在尝试使用以下方法获取 blob 列表:
var list = await container.GetBlobsAsync(BlobTraits.All, BlobStates.All, string.Empty).ConfigureAwait(false);
Run Code Online (Sandbox Code Playgroud)
这是我遇到的错误:
错误 CS1061“ConfiguredCancelableAsyncEnumerable”不包含“GetAwaiter”的定义,并且找不到接受“ConfiguredCancelableAsyncEnumerable”类型的第一个参数的可访问扩展方法“GetAwaiter”(您是否缺少 using 指令或程序集引用?)
C# 7.3 可以使用异步吗?或者使用异步调用来获取容器中的所有 blob,我需要升级到 8.0 C#?
如果我将代码更改为:
await foreach (BlobItem page in container.GetBlobsAsync(BlobTraits.None, BlobStates.None, string.Empty))
{
yield return container.GetBlobClient(page.Name);
}
Run Code Online (Sandbox Code Playgroud)
然后我有这个错误:
错误 CS8370 功能“异步流”在 C# 7.3 中不可用。请使用 8.0 或更高版本的语言。
我知道 GetBlobsAsync() 返回AsyncPageable<>,并且我假设它仅在 C# 8.0 中可用?
我正在尝试使用 python 从 blob 存储读取多个 CSV 文件。
我正在使用的代码是:
blob_service_client = BlobServiceClient.from_connection_string(connection_str)
container_client = blob_service_client.get_container_client(container)
blobs_list = container_client.list_blobs(folder_root)
for blob in blobs_list:
blob_client = blob_service_client.get_blob_client(container=container, blob="blob.name")
stream = blob_client.download_blob().content_as_text()
Run Code Online (Sandbox Code Playgroud)
我不确定存储在 pandas 数据框中读取的 CSV 文件的正确方法是什么。
我尝试使用:
df = df.append(pd.read_csv(StringIO(stream)))
Run Code Online (Sandbox Code Playgroud)
但这向我显示了一个错误。
知道我该怎么做吗?
我们正在使用parquet.net来编写 parquet 文件。我设置了一个包含 3 列和 2 行的简单架构:
// Set up the file structure
var UserKey = new Parquet.Data.DataColumn(
new DataField<Int32>("UserKey"),
new Int32[] { 1234, 12345}
);
var AADID = new Parquet.Data.DataColumn(
new DataField<string>("AADID"),
new string[] { Guid.NewGuid().ToString(), Guid.NewGuid().ToString() }
);
var UserLocale = new Parquet.Data.DataColumn(
new DataField<string>("UserLocale"),
new string[] { "en-US", "en-US" }
);
var schema = new Schema(UserKey.Field, AADID.Field, UserLocale.Field
);
Run Code Online (Sandbox Code Playgroud)
当使用 FileStream 写入本地文件时,会创建一个文件,当代码完成时,我可以在文件中看到两行(后面是 1 kb):
using (Stream fileStream = System.IO.File.OpenWrite("C:\\Temp\\Users.parquet")) {
using (var parquetWriter = new …Run Code Online (Sandbox Code Playgroud) 我有一个 Azure Functions Powershell 核心,如下所示:
# Input bindings are passed in via param block.
param([byte[]] $InputBlob, $TriggerMetadata)
# Write out the blob name and size to the information log.
Write-Host "PowerShell Blob trigger function Processed blob! Name: $($TriggerMetadata.Name) Size: $($InputBlob.Length) bytes Uri: $($TriggerMetadata.Uri)"
Run Code Online (Sandbox Code Playgroud)
通过使用 Blob 触发器,我想使用 Powershell 从 Azure Blob 读取 VDH 操作系统映像并将其转换为托管磁盘。图像大小为30GB。当函数被触发时,我得到下面的System.OutOfMemoryException:
2020-09-07T09:52:44.704 [Error] Executed 'Functions.BlobTrigger1' (Failed, Id=93b00718-9941-4379-abd0-348137cdcff2, Duration=56449ms)Exception of type 'System.OutOfMemoryException' was thrown.
2020-09-07T09:52:45.061 [Information] Stopping JobHost
Run Code Online (Sandbox Code Playgroud)
我增加了应用程序计划以获得 14GB 内存,但我遇到了相同的内存异常。
当我直接从Cloud Shell执行此操作时,我取得了成功,但我的主要目标是使用 …
powershell out-of-memory azure azure-blob-storage azure-functions
我有一个 kql-query,它计算自过去 24 小时以来 Azure 存储中上传的 BLOBS 数量。在 Azure 日志分析中运行时,查询打击会返回预期的数字。
StorageBlobLogs
| where TimeGenerated > ago(1d) and OperationName has "PutBlob" and StatusText contains "success" a
| distinct Uri
| summarize count()
Run Code Online (Sandbox Code Playgroud)
我现在想在时间表中可视化这些信息以获得一些详细视图。尝试将“渲染时间表”添加到查询链中,如下所示
StorageBlobLogs
| where TimeGenerated > ago(1d) and OperationName has "PutBlob" and StatusText contains "success" a
| distinct Uri
| summarize count()
| render timechart
Run Code Online (Sandbox Code Playgroud)
但是,当执行查询时,我收到错误消息;
无法创建可视化 无法创建堆叠条形图,因为您缺少以下类型之一的列:int、long、decimal 或 real
关于如何实现这一点有什么建议吗?
azure ×5
c# ×3
azure-devops ×1
kql ×1
open-json ×1
pandas ×1
parquet ×1
parquet.net ×1
powershell ×1
pyspark ×1
python ×1
python-3.x ×1