Skip to main content
 首页 » 编程设计

python之如何使用 python SDK 从 Azure Batch 计算节点检索 stdout/stderr.txt 文件

2024年10月01日31unruledboy

Batch 的 .NET 文档包括一种从池中的节点检索文件的方法:link python SDK中对应的类没有任何方法。任务失败时返回 stderr.txt 文件的最佳方式是什么?

请您参考如下方法:

我想你可以通过使用 python batch_client 来做到这一点,我在这里找到了一个实现:https://github.com/Azure/azure-sdk-for-python/blob/master/doc/batch.rst

# Download task output 
with open('task_output.txt', 'w') as file_output: 
        output = batch_client.file.get_from_task( 
                'python_test_job', 
                'python_task_1', 
                'stdout.txt' 
        ) 
        for data in output: 
                file_output.write(data)