Lange laufende Vorgänge auflisten
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Lange laufende Vorgänge für eine angegebene Ressource auflisten.
Weitere Informationen
Eine ausführliche Dokumentation, die dieses Codebeispiel enthält, finden Sie hier:
Codebeispiel
Nächste Schritte
Wenn Sie nach Codebeispielen für andere Google Cloud -Produkte suchen und filtern möchten, können Sie den Google Cloud -Beispielbrowser verwenden.
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","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)."]]