Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix od batch scoring notebook #2220

Merged
merged 3 commits into from
Apr 21, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@
"env = Environment(\n",
" name=\"automl-images-env\",\n",
" description=\"environment for automl images inference\",\n",
" image=\"mcr.microsoft.com/azureml/openmpi4.1.0-cuda11.1-cudnn8-ubuntu18.04\",\n",
" image=\"mcr.microsoft.com/azureml/openmpi4.1.0-cuda11.1-cudnn8-ubuntu20.04\",\n",
" conda_file=\"artifact_downloads/outputs/conda_env_v_1_0_0.yml\",\n",
")"
]
Expand Down Expand Up @@ -1079,7 +1079,7 @@
"# get the details of the job\n",
"job_name = job.name\n",
"batch_job = ml_client.jobs.get(name=job_name)\n",
"print(batch_job.status)\n",
"print(batch_job)\n",
"# stream the job logs\n",
"ml_client.jobs.stream(name=job_name)"
]
Expand All @@ -1097,13 +1097,42 @@
"metadata": {},
"outputs": [],
"source": [
"output_dir = \"./scoring_results\"\n",
"ml_client.jobs.download(\n",
" name=job.name, output_name=deployment.output_file_name, download_path=output_dir\n",
"from azureml.core import Experiment, Workspace\n",
"from azureml.pipeline.core import PipelineRun, StepRun, PortDataReference\n",
"\n",
"workspace_obj = Workspace(\n",
" subscription_id=ml_client.subscription_id,\n",
" resource_group=ml_client.resource_group_name,\n",
" workspace_name=ml_client.workspace_name,\n",
")\n",
"\n",
"# Get the Pipeline Run\n",
"experiment = Experiment(workspace=workspace_obj, name=batch_job.experiment_name)\n",
"pipeline_run = PipelineRun(experiment, batch_job.name)\n",
"\n",
"# Get the Step Run\n",
"step_run_id = pipeline_run.find_step_run(\"BatchScoring\")[0].id\n",
"node_id = pipeline_run.get_graph().node_name_dict[\"BatchScoring\"][0].node_id\n",
"print(\n",
" \"Pipeline Run ID: {} Step Run ID: {}, Step Run Node ID: {}\".format(\n",
" pipeline_run.id, step_run_id, node_id\n",
" )\n",
")\n",
"step_run = StepRun(experiment, step_run_id, pipeline_run.id, node_id)\n",
"\n",
"# Download Data\n",
"port_data_reference = step_run.get_output_data(\"score\")\n",
"port_data_reference.download(local_path=\".\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Print the first five lines of the output\n",
"result_file = os.path.join(output_dir, deployment.output_file_name)\n",
"result_file = os.path.join(\"azureml\", step_run_id, \"score\", deployment.output_file_name)\n",
"with open(result_file) as f:\n",
" for x in range(5):\n",
" print(next(f))"
Expand Down