Make sure that the identity running the code has the necessary permissions to read from the Azure Blob Storage where the outputs are stored.
Also, you can check the job's status to verify that it has indeed finished.
job_status = job.get_status()
print(f"Job status: {job_status}")
Only proceed to download if the status indicates completion.
You mentioned that there aren't any error messages. Try catching any potential exceptions that might be thrown silently.
try:
ml_client.jobs.download(batch_job.name,
download_path=f"{batch_prediction_dir}/csv/",
output_name="predictions")
except Exception as e:
print(f"Error encountered: {e}")
Ensure that the download_path
you provided exists and is accessible. You can use the os
module to check or create the directory:
import os
download_dir = f"{batch_prediction_dir}/csv/"
if not os.path.exists(download_dir):
os.makedirs(download_dir)
Check if batch_job.name
actually corresponds to a job that exists. You can list the jobs and see if your job is there.
jobs = ml_client.jobs.list()
for j in jobs:
print(j.name)
Share the output for each step so we can help you :)