How to retrieve stdout / stderr.txt files from Azure Batch compute nodes using python SDK?

Viewed 1441

The .NET documentation for Batch includes a method for retrieving files off a node in the pool: link The corresponding classes in the python SDK don't have any methods. What is the best way of returning the stderr.txt file for a task when it fails?

1 Answers

I think you can do that by using the python batch_client, I found a implementation here: 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)
Related