長時間実行オペレーションを一覧表示する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
指定したリソースの長時間実行オペレーションを一覧表示します。
もっと見る
このコードサンプルを含む詳細なドキュメントについては、以下をご覧ください。
コードサンプル
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],[],[[["\u003cp\u003eThis code sample demonstrates how to list long-running operations for a specified resource using the Vertex AI Agent Builder.\u003c/p\u003e\n"],["\u003cp\u003eThe process requires setting up Application Default Credentials for authentication and defining parameters such as project ID, location, and search engine ID.\u003c/p\u003e\n"],["\u003cp\u003eThe code utilizes the \u003ccode\u003ediscoveryengine\u003c/code\u003e and \u003ccode\u003eoperations_pb2\u003c/code\u003e modules from the Google Cloud client library to create and send a ListOperations request.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003elist_operations_sample\u003c/code\u003e function allows for optional filtering of operations, and returns a list of operations response that can then be displayed.\u003c/p\u003e\n"],["\u003cp\u003eThe function returns a list of long running operations based on the provided parameters, within the specified search engine.\u003c/p\u003e\n"]]],[],null,["# List long running operations\n\nList the long running operations for a specified resource.\n\nExplore further\n---------------\n\n\nFor detailed documentation that includes this code sample, see the following:\n\n- [Monitor long-running operations](/agentspace/docs/long-running-operations)\n- [Monitor long-running operations](/generative-ai-app-builder/docs/long-running-operations)\n\nCode sample\n-----------\n\n### Python\n\n\nFor more information, see the\n[AI Applications Python API\nreference documentation](/python/docs/reference/discoveryengine/latest).\n\n\nTo authenticate to AI Applications, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n from typing import Optional\n\n from google.cloud import discoveryengine\n from google.longrunning import operations_pb2\n\n # TODO(developer): Uncomment these variables before running the sample.\n # project_id = \"YOUR_PROJECT_ID\"\n # location = \"YOUR_PROCESSOR_LOCATION\" # Options: \"global\"\n # search_engine_id = \"YOUR_SEARCH_ENGINE_ID\"\n\n # Create filter in https://google.aip.dev/160 syntax\n # operations_filter = \"YOUR_FILTER\"\n\n\n def list_operations_sample(\n project_id: str,\n location: str,\n search_engine_id: str,\n operations_filter: Optional[str] = None,\n ) -\u003e operations_pb2.ListOperationsResponse:\n # Create a client\n client = discoveryengine.https://cloud.google.com/python/docs/reference/discoveryengine/latest/google.cloud.discoveryengine_v1.services.document_service.DocumentServiceClient.html()\n\n # The full resource name of the search engine branch.\n name = f\"projects/{project_id}/locations/{location}/collections/default_collection/dataStores/{search_engine_id}\"\n\n # Make ListOperations request\n request = operations_pb2.ListOperationsRequest(\n name=name,\n filter=operations_filter,\n )\n\n # Make ListOperations request\n response = client.https://cloud.google.com/python/docs/reference/discoveryengine/latest/google.cloud.discoveryengine_v1.services.document_service.DocumentServiceClient.html#google_cloud_discoveryengine_v1_services_document_service_DocumentServiceClient_list_operations(request=request)\n\n # Print the Operation Information\n for operation in response.operations:\n print(operation)\n\n return response\n\nWhat's next\n-----------\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=genappbuilder)."]]