Cara menggunakan diagnostik ruang kerja

BERLAKU UNTUK:SDK Python azureml v1

Azure Machine Learning menyediakan API diagnostik yang dapat digunakan untuk mengidentifikasi masalah terkait ruang kerja Anda. Kesalahan yang dikembalikan dalam laporan diagnostik mencakup informasi tentang cara menyelesaikan masalah.

Anda dapat menggunakan diagnostik ruang kerja dari studio Azure Machine Learning atau Python SDK.

Prasyarat

Sebelum mengikuti langkah-langkah dalam artikel ini, pastikan Anda memiliki prasyarat berikut:

Diagnostik dari studio

Dari studio Azure Machine Learning, Anda dapat menjalankan diagnostik di ruang kerja untuk memeriksa penyiapan Anda. Untuk menjalankan diagnostik, pilih ikon '?' di sudut kanan atas halaman. Kemudian pilih Jalankan diagnostik ruang kerja.

Cuplikan layar tombol diagnostik ruang kerja.

Setelah diagnostik berjalan, daftar masalah yang terdeteksi dikembalikan. Daftar ini mencakup tautan ke solusi yang memungkinkan.

Diagnostik dari Python

Cuplikan berikut menunjukkan cara menggunakan diagnostik ruang kerja dari Python.

BERLAKU UNTUK: Python SDK azure-ai-ml v2 (saat ini)

from azure.ai.ml import MLClient
from azure.ai.ml.entities import Workspace
from azure.identity import DefaultAzureCredential

subscription_id = '<your-subscription-id>'
resource_group = '<your-resource-group-name>'
workspace = '<your-workspace-name>'

ml_client = MLClient(DefaultAzureCredential(), subscription_id, resource_group)
resp = ml_client.workspaces.begin_diagnose(workspace).result()
# Inspect the attributes of the response you are interested in
for result in resp.application_insights_results:
    print(f"Diagnostic result: {result.code}, {result.level}, {result.message}")

Responsnya adalah objek DiagnoseResponseResultValue yang berisi informasi tentang masalah apa pun yang terdeteksi dengan ruang kerja.

BERLAKU UNTUK:SDK Python azureml v1

from azureml.core import Workspace

ws = Workspace.from_config()

diag_param = {
      "value": {
      }
    }

resp = ws.diagnose_workspace(diag_param)
print(resp)

Responsnya adalah dokumen JSON yang berisi informasi mengenai masalah apa pun yang terdeteksi terkait ruang kerja. JSON berikut adalah contoh responsnya:

{
    "value": {
        "user_defined_route_results": [],
        "network_security_rule_results": [],
        "resource_lock_results": [],
        "dns_resolution_results": [{
            "code": "CustomDnsInUse",
            "level": "Warning",
            "message": "It is detected VNet '/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Network/virtualNetworks/<virtual-network-name>' of private endpoint '/subscriptions/<subscription-id>/resourceGroups/<myresourcegroup>/providers/Microsoft.Network/privateEndpoints/<workspace-private-endpoint>' is not using Azure default DNS. You need to configure your DNS server and check https://learn.microsoft.com/azure/machine-learning/how-to-custom-dns to make sure the custom DNS is set up correctly."
        }],
        "storage_account_results": [],
        "key_vault_results": [],
        "container_registry_results": [],
        "application_insights_results": [],
        "other_results": []
    }
}

Jika tidak ada masalah yang terdeteksi, dokumen JSON kosong akan ditampilkan.

Untuk informasi selengkapnya, lihat referensi Ruang kerja.

Untuk informasi lebih lanjut, lihat referensi Workspace.diagnose_workspace().

Langkah selanjutnya