マネージド Feature Store のトラブルシューティング

この記事では、Azure Machine Learning のマネージド Feature Store で発生する可能性がある一般的な問題のトラブルシューティング方法について説明します。

Feature Store の作成時と更新時に見られる問題

Feature Store を作成または更新するときに、次の問題が発生することがあります。

ARM 調整エラー

症状

Feature Store の作成または更新が失敗します。 エラーは、次のようになります。

{
  "error": {
    "code": "TooManyRequests",
    "message": "The request is being throttled as the limit has been reached for operation type - 'Write'. ..",
    "details": [
      {
        "code": "TooManyRequests",
        "target": "Microsoft.MachineLearningServices/workspaces",
        "message": "..."
      }
    ]
  }
}

ソリューション

Feature Store の作成または更新操作を後で実行します。 デプロイは複数の手順で行われるので、リソースの一部が既に存在するために、2 番めの試行が失敗する場合があります。 それらのリソースを削除し、ジョブを再開します。

RBAC アクセス許可エラー

Feature Store を作成するには、ユーザーに ContributorUser Access Administrator のロール (あるいは、同じアクションのセットまたはスーパー セットに対応したカスタム ロール) が必要です。

症状

ユーザーに必要なロールが付与されていない場合、デプロイは失敗します。 エラー応答は次のようになります

{
  "error": {
    "code": "AuthorizationFailed",
    "message": "The client '{client_id}' with object id '{object_id}' does not have authorization to perform action '{action_name}' over scope '{scope}' or the scope is invalid. If access was recently granted, please refresh your credentials."
  }
}

ソリューション

Feature Store の作成先リソース グループに対する ContributorUser Access Administrator のロールをユーザーに付与します。 次に、デプロイをもう一度実行するようユーザーに指示します。

詳細については、「feature store materialization managed identity ロールに必要なアクセス許可」を参照してください。

重複した具体化 ID に関する ARM ID の問題

Feature Store が更新されて具体化が有効になると、その後の Feature Store に対する更新によって、このエラーが発生する場合があります。

症状

SDK または CLI を使用して Feature Store を更新すると、更新が失敗し、次のエラー メッセージが表示されます。

エラー:

{
  "error":{
    "code": "InvalidRequestContent",
    "message": "The request content contains duplicate JSON property names creating ambiguity in paths 'identity.userAssignedIdentities['/subscriptions/{sub-id}/resourceGroups/{rg}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{your-uai}']'. Please update the request content to eliminate duplicates and try again."
  }
}

ソリューション

この問題には、materialization_identity ARM ID 形式の ARM ID が関係しています。

Azure UI または SDK では、ユーザー割り当てマネージド ID の ARM ID で小文字の resourcegroups が使用されます。 こちらの例を参照してください。

  • (A): /subscriptions/{sub-id}/resourcegroups/{rg}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{your-uai}

Feature Store がユーザー割り当てマネージド ID をその materialization_identity として使用すると、その ARM ID が正規化されて resourceGroups として格納されます。 こちらの例を参照してください。

  • (B): /subscriptions/{sub-id}/resourceGroups/{rg}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{your-uai}

更新要求で、具体化 ID と一致するユーザー割り当て ID を使用して、Feature Store を更新することがあります。 その目的でマネージド ID を使用するとき、ARM ID を形式 (A) で使用すると、更新は失敗し、前記のエラー メッセージが返されます。

この問題を解決するには、ユーザー割り当てマネージド ID の ARM ID の文字列 resourcegroupsresourceGroups に置き換えます。 次に、Feature Store の更新をもう一度実行します。

古いバージョンの azure-mgmt-authorization パッケージが AzureMLOnBehalfOfCredential と連携して動作しない

症状

azureml-examples リポジトリの featurestore_sample フォルダーに用意されている setup_storage_uai スクリプトを使用すると、次のエラー メッセージでスクリプトが失敗します。

AttributeError: 'AzureMLOnBehalfOfCredential' object has no attribute 'signed_session'

解決方法:

インストールされている azure-mgmt-authorization パッケージのバージョンを確認し、最新バージョン (少なくとも 3.0.0 以降) を使用していることを確認します。 古いバージョン (0.61.0 など) は、AzureMLOnBehalfOfCredential と連携して動作しません。

特徴量セット仕様の作成エラー

特徴量セット仕様のスキーマが無効

特徴量セットを Feature Store に登録する前に、特徴量セット仕様をローカルで定義し、<feature_set_spec>.to_spark_dataframe() を実行して検証します。

症状

ユーザーが <feature_set_spec>.to_spark_dataframe() を実行すると、特徴量セット データフレームのスキーマが特徴量セット仕様の定義と一致しない場合、さまざまなスキーマ検証エラーが発生する可能性があります。

次に例を示します。

  • エラー メッセージ: azure.ai.ml.exceptions.ValidationException: Schema check errors, timestamp column: timestamp is not in output dataframe
  • エラー メッセージ: Exception: Schema check errors, no index column: accountID in output dataframe
  • エラー メッセージ: ValidationException: Schema check errors, feature column: transaction_7d_count has data type: ColumnType.long, expected: ColumnType.string

ソリューション

スキーマ検証失敗のエラーを確認し、列の名前と型の両方について、特徴量セット仕様の定義を適宜更新します。 次に例を示します。

  • source.timestamp_column.name プロパティを更新して、タイムスタンプ列名を正しく定義します。
  • index_columns プロパティを更新して、インデックス列を正しく定義します。
  • features プロパティを更新して、特徴量列の名前と型を正しく定義します。
  • 特徴量ソース データの種類が csv の場合、CSV ファイルが列ヘッダー付きで生成されていることを確認します。

次に、もう一度 <feature_set_spec>.to_spark_dataframe() を実行して、検証に合格するかどうかを確認します。

SDK で特徴量セット仕様を定義している場合は、features を手動入力せずに値を自動入力する推奨の方法として infer_schema オプションもお勧めします。 timestamp_columnindex columns はオートフィルできません。

詳細については、特徴量セット仕様スキーマのドキュメントを参照してください。

変換クラスが見つからない

症状

ユーザーが <feature_set_spec>.to_spark_dataframe() を実行すると、エラー AttributeError: module '<...>' has no attribute '<...>' が返されます。

次に例を示します。

  • AttributeError: module '7780d27aa8364270b6b61fed2a43b749.transaction_transform' has no attribute 'TransactionFeatureTransformer1'

ソリューション

特徴量変換クラスは、コード フォルダーのルートの下にある Python ファイルで定義されていることが想定されています。 コード フォルダーには、他のファイルやサブフォルダーが存在する可能性があります。

feature_transformation_code.transformation_class プロパティの値を <py file name of the transformation class>.<transformation class name> に設定します。

たとえば、コード フォルダーが次のようになっていて、

code/
└── my_transformation_class.py

my_transformation_class.py ファイルが MyFeatureTransformer クラスを定義している場合、feature_transformation_code.transformation_classmy_transformation_class.MyFeatureTransformer に設定します。

コード フォルダーでの FileNotFoundError

症状

特徴量セット仕様 YAML が手動で作成され、SDK が特徴量セットを生成しない場合、エラーが発生する可能性があります。 コマンド runs <feature_set_spec>.to_spark_dataframe() がエラー FileNotFoundError: [Errno 2] No such file or directory: .... を返します

ソリューション

コード フォルダーを確認します。 これは特徴量セット仕様フォルダーの下のサブフォルダーである必要があります。 特徴量セット仕様で、feature_transformation_code.path を、特徴量セット仕様フォルダーの相対パスになるように設定します。 次に例を示します。

feature set spec folder/
├── code/
│ ├── my_transformer.py
│ └── my_orther_folder
└── FeatureSetSpec.yaml

この例では、YAML の feature_transformation_code.path プロパティは ./code である必要があります

Note

azureml-featurestore の create_feature_set_spec 関数を使用して python オブジェクト FeatureSetSpec を作成するとき、feature_transformation_code.path 値として任意のローカル フォルダーが受け付けられます。 FeatureSetSpec オブジェクトがダンプされ、ターゲット フォルダー内に特徴量セット仕様の yaml が作成されると、コードのパスがターゲット フォルダーにコピーされ、仕様の yaml の feature_transformation_code.path プロパティが更新されます。

機能セット CRUD エラー

無効な FeatureStoreEntity が原因で機能セットの GET が失敗する

症状

Feature Store の CRUD クライアントを使用して特徴量セットを GET するとき (例: fs_client.feature_sets.get(name, version)"`)、次のエラーが表示されることがあります。


Traceback (most recent call last):

  File "/home/trusted-service-user/cluster-env/env/lib/python3.8/site-packages/azure/ai/ml/operations/_feature_store_entity_operations.py", line 116, in get

    return FeatureStoreEntity._from_rest_object(feature_store_entity_version_resource)

  File "/home/trusted-service-user/cluster-env/env/lib/python3.8/site-packages/azure/ai/ml/entities/_feature_store_entity/feature_store_entity.py", line 93, in _from_rest_object

    featurestoreEntity = FeatureStoreEntity(

  File "/home/trusted-service-user/cluster-env/env/lib/python3.8/site-packages/azure/ai/ml/_utils/_experimental.py", line 42, in wrapped

    return func(*args, **kwargs)

  File "/home/trusted-service-user/cluster-env/env/lib/python3.8/site-packages/azure/ai/ml/entities/_feature_store_entity/feature_store_entity.py", line 67, in __init__

    raise ValidationException(

azure.ai.ml.exceptions.ValidationException: Stage must be Development, Production, or Archived, found None

このエラーは FeatureStore 具体化ジョブでも発生する可能性があり、そちらでジョブが失敗すると同じエラー トレース バックが出力されます。

ソリューション

新しいバージョンの SDKS を使用してノートブック セッションを開始する

  • azure-ai-ml を使用している場合は、azure-ai-ml==1.8.0 に更新します。
  • Feature Store のデータプレーン SDK を使用している場合は、azureml-featurestore== 0.1.0b2 に更新します。

ノートブック セッションで、次の例に示すように、フィーチャー ストア エンティティが stage を設定するように更新します。

from azure.ai.ml.entities import DataColumn, DataColumnType
 
account_entity_config = FeatureStoreEntity(

    name="account",

    version="1",

    index_columns=[DataColumn(name="accountID", type=DataColumnType.STRING)],

    stage="Development",

    description="This entity represents user account index key accountID.",

    tags={"data_typ": "nonPII"},

)

poller = fs_client.feature_store_entities.begin_create_or_update(account_entity_config)

print(poller.result())

FeatureStoreEntity を定義するときは、作成されたときに使用されたプロパティと一致するようにプロパティを設定します。 唯一の違いは、stage プロパティを追加することです。

begin_create_or_update() 呼び出しが正常に返されると、次の feature_sets.get() 呼び出しと次の具体化ジョブが成功するはずです。

特徴量取得ジョブとクエリのエラー

特徴量取得ジョブが失敗したときは、エラーの詳細を確認します。 実行の詳細ページに移動し、[出力とログ] タブを選択し、logs/azureml/driver/stdout ファイルを調べます。

ユーザーがノートブックで get_offline_feature() クエリを実行すると、セルの出力にエラーが直接表示されます。

特徴量取得の仕様解決エラー

症状

特徴量取得クエリ/ジョブに次のエラーが表示されます。

  • 無効な特徴量
code: "UserError"
mesasge: "Feature '<some name>' not found in this featureset."
  • 無効な Feature Store URI:
message: "the Resource 'Microsoft.MachineLearningServices/workspaces/<name>' under resource group '<>>resource group name>'->' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix",
code: "ResourceNotFound"
  • 無効な特徴量セット:
code: "UserError"
message: "Featureset with name: <name >and version: <version> not found."

ソリューション

ジョブが使用する feature_retrieval_spec.yaml の内容を確認します。 すべての Feature Store URI、特徴量セットの名前とバージョン、特徴量の名前が有効であり、Feature Store に存在することを確認します。

Feature Store から特徴量を選択し、特徴量取得仕様 YAML ファイルを生成するには、ユーティリティ関数の使用をお勧めします。

このコード スニペットでは、generate_feature_retrieval_spec ユーティリティ関数を使用しています。

from azureml.featurestore import FeatureStoreClient
from azure.ai.ml.identity import AzureMLOnBehalfOfCredential

featurestore = FeatureStoreClient(
credential = AzureMLOnBehalfOfCredential(),
subscription_id = featurestore_subscription_id,
resource_group_name = featurestore_resource_group_name,
name = featurestore_name
)

transactions_featureset = featurestore.feature_sets.get(name="transactions", version = "1")

features = [
    transactions_featureset.get_feature('transaction_amount_7d_sum'),
    transactions_featureset.get_feature('transaction_amount_3d_sum')
]

feature_retrieval_spec_folder = "./project/fraud_model/feature_retrieval_spec"
featurestore.generate_feature_retrieval_spec(feature_retrieval_spec_folder, features)

特徴量取得ジョブへの入力としてモデルを使用する場合に、ファイル feature_retrieval_spec.yaml が見つからない

症状

登録済みモデルを特徴量取得ジョブ入力として使用すると、ジョブは次のエラーで失敗します。

ValueError: Failed with visit error: Failed with execution error: error in streaming from input data sources
    VisitError(ExecutionError(StreamError(NotFound)))
=> Failed with execution error: error in streaming from input data sources
    ExecutionError(StreamError(NotFound)); Not able to find path: azureml://subscriptions/{sub_id}/resourcegroups/{rg}/workspaces/{ws}/datastores/workspaceblobstore/paths/LocalUpload/{guid}/feature_retrieval_spec.yaml

解決方法:

特徴量取得ステップへの入力としてモデルを指定すると、モデルは、モデル成果物フォルダーの下に取得の仕様 YAML ファイルが存在すると想定します。 そのファイルがない場合、ジョブは失敗します。

この問題を修正するには、モデルを登録する前に、モデル成果物フォルダーのルート フォルダーで feature_retrieval_spec.yaml をパッケージ化します。

観測データが特徴量の値と結合されていない

症状

ユーザーが特徴量取得クエリ/ジョブを実行しても、出力データが特徴量の値を取得しません。 たとえば、ユーザーが特徴量 transaction_amount_3d_avgtransaction_amount_7d_avg を取得するために特徴量取得ジョブを実行すると、結果が次のようになります。

transactionID accountID timestamp is_fraud transaction_amount_3d_avg transaction_amount_7d_avg
83870774-7A98-43B... A1055520444618950 2023-02-28 04:34:27 0 null null
25144265-F68B-4FD... A1055520444618950 2023-02-28 10:44:30 0 null null
8899ED8C-B295-43F... A1055520444812380 2023-03-06 00:36:30 0 null null

解決策

特徴量の取得では、ポイントインタイム結合クエリが実行されます。 空の結合結果が示される場合は、考えられる次の解決策を試してみてください。

  • 特徴量セット仕様の定義で temporal_join_lookback の範囲を拡大するか、これを一時的に削除します。 これにより、ポイントインタイム結合が、観測イベントのタイムスタンプより前にさらに (または無限に) さかのぼって特徴量の値を見つけることができます。
  • 特徴量セット仕様の定義に source.source_delay も設定されている場合は、temporal_join_lookback > source.source_delay であることを確認します。

上記の解決策のいずれも効果がない場合は、Feature Store から特徴量セットを取得し、<feature_set>.to_spark_dataframe() を実行して、特徴量のインデックス列とタイムスタンプを手動で検査します。 失敗には次のような原因が考えられます。

  • 観測データのインデックス値が特徴量セットのデータフレーム内に存在しない
  • 観測タイムスタンプの前にタイムスタンプ値を持つ特徴値が存在しない。

このような場合、特徴量のオフライン具体化が有効になっていると、より多くの特徴量データのバックフィルが必要になる可能性があります。

ユーザーまたはマネージド ID に Feature Store に対する適切な RBAC アクセス許可がない

現象:

特徴量取得ジョブ/クエリが失敗し、logs/azureml/driver/stdout ファイルに次のエラー メッセージが表示されます。

Traceback (most recent call last):
  File "/home/trusted-service-user/cluster-env/env/lib/python3.8/site-packages/azure/ai/ml/_restclient/v2022_12_01_preview/operations/_workspaces_operations.py", line 633, in get
    raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
azure.core.exceptions.HttpResponseError: (AuthorizationFailed) The client 'XXXX' with object id 'XXXX' does not have authorization to perform action 'Microsoft.MachineLearningServices/workspaces/read' over scope '/subscriptions/XXXX/resourceGroups/XXXX/providers/Microsoft.MachineLearningServices/workspaces/XXXX' or the scope is invalid. If access was recently granted, please refresh your credentials.
Code: AuthorizationFailed

解決方法:

  1. 特徴量取得ジョブがマネージド ID を使用する場合は、Feature Store に対する AzureML Data Scientist ロールをその ID に割り当てます。
  2. 問題が発生するのが次のようなとき、
  • ユーザーが Azure Machine Learning Spark ノートブックでコードを実行
  • そのノートブックが、ユーザー自身の ID を使用して Azure Machine Learning service にアクセス

Feature Store に対する AzureML Data Scientist ロールをユーザーの Microsoft Entra ID に割り当てます。

Azure Machine Learning Data Scientist が推奨されるロールです。 ユーザーは、次のアクションを使用して独自のカスタム ロールを作成できます

  • Microsoft.MachineLearningServices/workspaces/datastores/listsecrets/action
  • Microsoft.MachineLearningServices/workspaces/featuresets/read
  • Microsoft.MachineLearningServices/workspaces/read

RBAC のセットアップについて詳しくは、「マネージド Feature Store のアクセス制御を管理する」を参照してください。

ユーザーまたはマネージド ID に、ソース ストレージまたはオフライン ストアから読み取るための適切な RBAC アクセス許可がない

症状

特徴量取得ジョブ/クエリが失敗し、logs/azureml/driver/stdout に次のエラー メッセージが表示されます。

An error occurred while calling o1025.parquet.
: java.nio.file.AccessDeniedException: Operation failed: "This request is not authorized to perform this operation using this permission.", 403, GET, https://{storage}.dfs.core.windows.net/test?upn=false&resource=filesystem&maxResults=5000&directory=datasources&timeout=90&recursive=false, AuthorizationPermissionMismatch, "This request is not authorized to perform this operation using this permission. RequestId:63013315-e01f-005e-577b-7c63b8000000 Time:2023-05-01T22:20:51.1064935Z"
    at org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem.checkException(AzureBlobFileSystem.java:1203)
    at org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem.listStatus(AzureBlobFileSystem.java:408)
    at org.apache.hadoop.fs.Globber.listStatus(Globber.java:128)
    at org.apache.hadoop.fs.Globber.doGlob(Globber.java:291)
    at org.apache.hadoop.fs.Globber.glob(Globber.java:202)
    at org.apache.hadoop.fs.FileSystem.globStatus(FileSystem.java:2124)

解決方法:

  • 特徴量取得ジョブがマネージド ID を使用している場合は、ソース ストレージとオフライン ストア ストレージに対する Storage Blob Data Reader ロールをその ID に割り当てます。
  • このエラーは、クエリを実行するためにノートブックがユーザーの ID を使用して Azure Machine Learning service にアクセスするときに発生します。 エラーを解決するには、ソース ストレージとオフライン ストア ストレージ アカウントに対する Storage Blob Data Reader ロールをユーザーの ID に割り当てます。

Storage Blob Data Reader が、推奨される最小アクセス要件です。 ユーザーはより高い権限を持つロール (Storage Blob Data ContributorStorage Blob Data Owner など) を割り当てることもできます。

トレーニング ジョブで、組み込みの特徴量取得コンポーネントによって生成されたデータを読み取ることができない

症状

トレーニング ジョブが失敗し、トレーニング データが存在しないか、形式が正しくないか、パーサー エラーが発生したことを示すエラー メッセージが表示されます。

FileNotFoundError: [Errno 2] No such file or directory
  • 形式が正しくありません。
ParserError:

ソリューション

組み込みの特徴量取得コンポーネントには、output_data という 1 つの出力があります。 出力データは、uri_folder データ資産です。 フォルダー構造は、常に次のようになっています。

<training data folder>/
├── data/
│ ├── xxxxx.parquet
│ └── xxxxx.parquet
└── feature_retrieval_spec.yaml

出力データは常に parquet 形式です。 "data" サブフォルダーから読み取り、データを parquet として読み取るようにトレーニング スクリプトを更新します。

ローカルの特徴量セット仕様を使用すると generate_feature_retrieval_spec() が失敗する

現象:

次の python コードは、特定の特徴量リストに対する特徴量取得仕様を生成します。

featurestore.generate_feature_retrieval_spec(feature_retrieval_spec_folder, features)

ローカルの特徴量セット仕様によって定義された特徴量が特徴量リストに含まれている場合、generate_feature_retrieval_spec() はこのエラー メッセージで失敗します。

AttributeError: 'FeatureSetSpec' object has no attribute 'id'

解決方法:

特徴量取得仕様は、Feature Store に登録されている特徴量セットを使用してのみ生成できます。 この問題を解決するには、データベース所有者が次の操作を行う必要があります。

  • ローカルの特徴量セット仕様を、特徴量セットとして Feature Store に登録します
  • 登録済みの特徴量セットを取得します
  • 登録済みの特徴量セットからの特徴量のみを使用してもう一度特徴量リストを作成します
  • 新しい特徴量リストを使用して特徴量取得仕様を生成します

get_offline_features() クエリにかかる時間が長い

現象:

Feature Store のいくつかの特徴量を使用してトレーニング データを生成するために get_offline_features を実行すると、完了までにかかる時間が長すぎます。

ソリューション

次の構成を確認します。

  • クエリで使用される各特徴量セットに対して、特徴量セット仕様に temporal_join_lookback が設定されていること。 その値を小さい値に設定します。
  • 観測データフレーム上のサイズとタイムスタンプ ウィンドウが大きい場合、ドライバーと Executor のサイズ (メモリおよびコア) を増やしてノートブック セッション (またはジョブ) を構成すること。 さらに、Executor の数を増やすこと。

特徴の具体化ジョブのエラー

特徴の具体化ジョブが失敗したときは、次の手順に従ってジョブの失敗の詳細を確認します。

  1. Feature Store ページに移動します: https://ml.azure.com/featureStore/{your-feature-store-name}
  2. [feature set] タブに移動し、関連する特徴量セットを選択し、特徴量セットの詳細ページに移動します。
  3. 特徴量セットの詳細ページで、[Materialization jobs] タブを選択し、失敗したジョブを選択してジョブ詳細ビューで開きます。
  4. ジョブ詳細ビューの Properties カードで、ジョブの状態とエラー メッセージを確認します。
  5. [Outputs + logs] タブに移動し、logs\azureml\driver\stdout ファイルで stdout ファイルを見つけることもできます。

修正の適用後、手動でバックフィル具体化ジョブをトリガーして、修正が反映されることを確認できます。

オフライン ストアの構成が無効

症状

具体化ジョブが失敗し、次のエラー メッセージが logs/azureml/driver/stdout ファイルに表示されます。

Caused by: Status code: -1 error code: null error message: InvalidAbfsRestOperationExceptionjava.net.UnknownHostException: adlgen23.dfs.core.windows.net
java.util.concurrent.ExecutionException: Operation failed: "The specified resource name contains invalid characters.", 400, HEAD, https://{storage}.dfs.core.windows.net/{container-name}/{fs-id}/transactions/1/_delta_log?upn=false&action=getStatus&timeout=90

ソリューション

SDK を使用して、Feature Store に定義されているオフライン ストア ターゲットを確認します。


from azure.ai.ml import MLClient
from azure.ai.ml.identity import AzureMLOnBehalfOfCredential

fs_client = MLClient(AzureMLOnBehalfOfCredential(), featurestore_subscription_id, featurestore_resource_group_name, featurestore_name)

featurestore = fs_client.feature_stores.get(name=featurestore_name)
featurestore.offline_store.target

Feature Store の UI 概要ページでオフライン ストア ターゲットを確認することもできます。 ストレージとコンテナーの両方が存在し、ターゲットが次の形式であることを確認します。

/subscriptions/{sub-id}/resourceGroups/{rg}/providers/Microsoft.Storage/storageAccounts/{storage}/blobServices/default/containers/{container-name}

具体化 ID に Feature Store に対する適切な RBAC アクセス許可がない

現象:

具体化ジョブが失敗し、logs/azureml/driver/stdout に次のエラー メッセージが表示されます。

Traceback (most recent call last):
  File "/home/trusted-service-user/cluster-env/env/lib/python3.8/site-packages/azure/ai/ml/_restclient/v2022_12_01_preview/operations/_workspaces_operations.py", line 633, in get
    raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
azure.core.exceptions.HttpResponseError: (AuthorizationFailed) The client 'XXXX' with object id 'XXXX' does not have authorization to perform action 'Microsoft.MachineLearningServices/workspaces/read' over scope '/subscriptions/XXXX/resourceGroups/XXXX/providers/Microsoft.MachineLearningServices/workspaces/XXXX' or the scope is invalid. If access was recently granted, please refresh your credentials.
Code: AuthorizationFailed

解決方法:

Feature Store に対する Azure Machine Learning Data Scientist ロールを Feature Store の具体化 ID (ユーザー割り当てマネージド ID) に割り当てます。

Azure Machine Learning Data Scientist が推奨されるロールです。 次のアクションを使用して、独自のカスタム ロールを作成できます。

  • Microsoft.MachineLearningServices/workspaces/datastores/listsecrets/action
  • Microsoft.MachineLearningServices/workspaces/featuresets/read
  • Microsoft.MachineLearningServices/workspaces/read

詳細については、「feature store materialization managed identity ロールに必要なアクセス許可」を参照してください。

具体化 ID にストレージから読み取りを行うための適切な RBAC アクセス許可がない

症状

具体化ジョブが失敗し、logs/azureml/driver/stdout に次のエラー メッセージが表示されます。

An error occurred while calling o1025.parquet.
: java.nio.file.AccessDeniedException: Operation failed: "This request is not authorized to perform this operation using this permission.", 403, GET, https://{storage}.dfs.core.windows.net/test?upn=false&resource=filesystem&maxResults=5000&directory=datasources&timeout=90&recursive=false, AuthorizationPermissionMismatch, "This request is not authorized to perform this operation using this permission. RequestId:63013315-e01f-005e-577b-7c63b8000000 Time:2023-05-01T22:20:51.1064935Z"
    at org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem.checkException(AzureBlobFileSystem.java:1203)
    at org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem.listStatus(AzureBlobFileSystem.java:408)
    at org.apache.hadoop.fs.Globber.listStatus(Globber.java:128)
    at org.apache.hadoop.fs.Globber.doGlob(Globber.java:291)
    at org.apache.hadoop.fs.Globber.glob(Globber.java:202)
    at org.apache.hadoop.fs.FileSystem.globStatus(FileSystem.java:2124)

解決方法:

Feature Store の具体化 ID (ユーザー割り当てマネージド ID) に、ソース ストレージに対する Storage Blob Data Reader ロールを割り当てます。

Storage Blob Data Reader が、推奨される最小アクセス要件です。 より高い権限を持つロール (Storage Blob Data ContributorStorage Blob Data Owner など) を割り当てることもできます。

RBAC 構成の詳細については、「feature store materialization managed identity ロールに必要なアクセス許可」を参照してください。

具体化 ID に、オフライン ストアにデータを書き込むための適切な RBAC アクセス許可がない

症状

具体化ジョブが失敗し、logs/azureml/driver/stdout に次のエラー メッセージが表示されます。

An error occurred while calling o1162.load.
: java.util.concurrent.ExecutionException: java.nio.file.AccessDeniedException: Operation failed: "This request is not authorized to perform this operation using this permission.", 403, HEAD, https://featuresotrestorage1.dfs.core.windows.net/offlinestore/fs_xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_fsname/transactions/1/_delta_log?upn=false&action=getStatus&timeout=90
    at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:306)
    at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:293)
    at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)
    at com.google.common.util.concurrent.Uninterruptibles.getUninterruptibly(Uninterruptibles.java:135)
    at com.google.common.cache.LocalCache$Segment.getAndRecordStats(LocalCache.java:2410)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2380)
    at com.google.common.cache.LocalCache$S

ソリューション

Feature Store の具体化 ID (ユーザー割り当てマネージド ID) に、ソース ストレージに対する Storage Blob Data Reader ロールを割り当てます。

Storage Blob Data Contributor が、推奨される最小アクセス要件です。 より高い権限を持つロール (Storage Blob Data Owner など) を割り当てることもできます。

RBAC 構成の詳細については、「feature store materialization managed identity ロールに必要なアクセス許可」を参照してください。

ジョブの出力をノートブックにストリーミングできない

現象:

Feature Store CRUD クライアントから fs_client.jobs.stream("<job_id>") を使用して具体化ジョブの結果をノートブックにストリーミングしようとすると、エラーが発生して SDK 呼び出しが失敗します

HttpResponseError: (UserError) A job was found, but it is not supported in this API version and cannot be accessed.

Code: UserError

Message: A job was found, but it is not supported in this API version and cannot be accessed.

解決方法:

具体化ジョブを (バックフィルの呼び出しなどによって) 作成するとき、ジョブが適切に初期化されるまでに数秒かかる場合があります。 数秒後に jobs.stream() コマンドをもう一度実行します。 これで問題が解消されるはずです。

無効な Spark 構成

現象:

具体化ジョブが失敗し、次のエラー メッセージが表示されます。

Synapse job submission failed due to invalid spark configuration request

{

"Message":"[..] Either the cores or memory of the driver, executors exceeded the SparkPool Node Size.\nRequested Driver Cores:[4]\nRequested Driver Memory:[36g]\nRequested Executor Cores:[4]\nRequested Executor Memory:[36g]\nSpark Pool Node Size:[small]\nSpark Pool Node Memory:[28]\nSpark Pool Node Cores:[4]"

}

解決方法:

特徴量セットの materialization_settings.spark_configuration{} を更新します。 これらのパラメーターが使用するメモリ サイズの量とコア値の合計数が、インスタンスの種類が提供する (materialization_settings.resource で定義) よりも少ないことを確認します。

spark.driver.cores spark.driver.memory spark.executor.cores spark.executor.memory

たとえば、インスタンスの種類が standard_e8s_v3 の場合、この Spark 構成は次の有効なオプションのいずれかになります。


transactions_fset_config.materialization_settings = MaterializationSettings(

    offline_enabled=True,

    resource = MaterializationComputeResource(instance_type="standard_e8s_v3"),

    spark_configuration = {

        "spark.driver.cores": 4,

        "spark.driver.memory": "36g",

        "spark.executor.cores": 4,

        "spark.executor.memory": "36g",

        "spark.executor.instances": 2

    },

    schedule = None,

)

fs_poller = fs_client.feature_sets.begin_create_or_update(transactions_fset_config)

次のステップ