Skip to content

Commit 87ddd59

Browse files
authored
Update spark runtime version (#3638)
1 parent 85e88b4 commit 87ddd59

File tree

2 files changed

+27
-11
lines changed

2 files changed

+27
-11
lines changed

sdk/python/jobs/spark/automation/run_interactive_session_notebook.ipynb

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
"metadata": {},
2525
"outputs": [],
2626
"source": [
27-
"from azure.ai.ml import MLClient, spark, Input, Output\n",
27+
"from azure.ai.ml import MLClient, spark\n",
2828
"from azure.identity import DefaultAzureCredential\n",
29+
"import time\n",
2930
"\n",
3031
"subscription_id = \"<SUBSCRIPTION_ID>\"\n",
3132
"resource_group = \"<RESOURCE_GROUP>\"\n",
@@ -49,30 +50,42 @@
4950
" },\n",
5051
")\n",
5152
"\n",
53+
"# Create or update the Spark job\n",
5254
"returned_spark_job = ml_client.jobs.create_or_update(spark_job)\n",
5355
"\n",
5456
"print(returned_spark_job.id)\n",
5557
"# Wait until the job completes\n",
56-
"ml_client.jobs.stream(returned_spark_job.name)"
58+
"job_name = returned_spark_job.name\n",
59+
"while True:\n",
60+
" job = ml_client.jobs.get(job_name)\n",
61+
" print(f\"Current job status: {job.status}\")\n",
62+
" if job.status in [\"Completed\", \"Failed\", \"Canceled\"]:\n",
63+
" break\n",
64+
" time.sleep(10)\n",
65+
"\n",
66+
"print(f\"Final job status: {job.status}\")"
5767
]
5868
}
5969
],
6070
"metadata": {
6171
"kernelspec": {
62-
"display_name": "Python 3.10 - SDK V2",
72+
"display_name": "Python 3",
6373
"language": "python",
64-
"name": "python310-sdkv2"
74+
"name": "python3"
6575
},
6676
"language_info": {
77+
"codemirror_mode": {
78+
"name": "ipython",
79+
"version": 3
80+
},
81+
"file_extension": ".py",
82+
"mimetype": "text/x-python",
6783
"name": "python",
68-
"version": "3.7.10"
84+
"nbconvert_exporter": "python",
85+
"pygments_lexer": "ipython3",
86+
"version": "3.12.10"
6987
},
70-
"orig_nbformat": 4,
71-
"vscode": {
72-
"interpreter": {
73-
"hash": "6aeff17a1aa7735c2f7cb3a6d691fe1b4d4c3b8d2d650f644ad0f24e1b8e3f3f"
74-
}
75-
}
88+
"orig_nbformat": 4
7689
},
7790
"nbformat": 4,
7891
"nbformat_minor": 2

sdk/python/jobs/spark/setup_spark.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ then
5656
GEN2_STORAGE_ACCOUNT_NAME=${RESOURCE_GROUP}gen2vnet
5757
ADLS_CONTAINER_NAME="gen2containervnet"
5858

59+
EXIST=$(az storage account check-name --name $DEFAULT_STORAGE_ACCOUNT --query nameAvailable)
60+
if [ "$EXIST" = "true" ]; then
5961
az storage account create -n $DEFAULT_STORAGE_ACCOUNT -g $RESOURCE_GROUP -l $LOCATION --sku Standard_LRS
62+
fi
6063

6164
az storage account create -n $AZURE_STORAGE_ACCOUNT -g $RESOURCE_GROUP -l $LOCATION --sku Standard_LRS
6265
az storage container create -n $BLOB_CONTAINER_NAME --account-name $AZURE_STORAGE_ACCOUNT

0 commit comments

Comments
 (0)