Cloud Deployment Manager akan mencapai akhir dukungan pada 31 Desember 2025. Jika saat ini Anda menggunakan Deployment Manager, migrasikan ke Infrastructure Manager atau teknologi deployment alternatif paling lambat 31 Desember 2025 untuk memastikan layanan Anda berlanjut tanpa gangguan.
Mengelola operasi yang berjalan lama dengan Deployment Manager API
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Saat Anda membuat permintaan API ke Deployment Manager, Deployment Manager
akan membuat permintaan yang sesuai ke API Google Cloud lainnya. Misalnya,
saat Anda membuat deployment yang menyertakan instance Compute Engine, Deployment Manager akan mengirimkan permintaan instances.insert ke Compute Engine API.
Saat Anda membuat, memperbarui, atau menghapus deployment, atau menggunakan metode API lain yang mungkin memerlukan waktu beberapa menit atau lebih lama untuk diselesaikan, permintaan API ke Deployment Manager akan menampilkan operasi yang berjalan lama.
Halaman ini menjelaskan panduan untuk mengelola operasi yang berjalan lama dengan Deployment Manager API.
Sebelum memulai
Jika Anda ingin menggunakan contoh command line dalam panduan ini, instal alat command line`gcloud`.
Jika Anda ingin menggunakan contoh API dalam panduan ini, siapkan akses API.
Metode yang mungkin memulai operasi yang berjalan lama meliputi:
Untuk memeriksa status operasi, gunakan kolom name operasi untuk
membuat permintaan operations.get(), dan periksa status atau progress operasi.
Jika status adalah DONE, progress adalah 100, dan objek error
kosong, deployment Anda selesai dan resource Anda siap digunakan.
Jika ada error selama operasi, error tersebut akan tercantum dalam objek error,
dalam format berikut:
"error":{"errors":[{"code":"error code"#string,"location":"location of the error"#string,"message":"error message"#string},...]}
Sebagai praktik terbaik, sebaiknya lakukan polling status operasi dengan
backoff eksponensial. Misalnya, buat permintaan pertama setelah 5 detik, permintaan berikutnya setelah 10 detik, permintaan ketiga setelah 20 detik, dan seterusnya. Sebaiknya tetapkan waktu backoff maksimum beberapa menit. Setelah mencapai waktu backoff maksimum, Anda tidak perlu terus meningkatkan waktu backoff.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-04-21 UTC."],[[["\u003cp\u003eDeployment Manager sends requests to other Google Cloud APIs, like Compute Engine, when you interact with it, and some of these API requests result in long-running operations.\u003c/p\u003e\n"],["\u003cp\u003eLong-running operations are triggered by actions like \u003ccode\u003einsert\u003c/code\u003e, \u003ccode\u003eupdate\u003c/code\u003e, or \u003ccode\u003edelete\u003c/code\u003e and return an Operation resource.\u003c/p\u003e\n"],["\u003cp\u003eThe status and progress of a long-running operation can be tracked using the \u003ccode\u003eoperations.get()\u003c/code\u003e method with the operation's name.\u003c/p\u003e\n"],["\u003cp\u003eWhen the operation's \u003ccode\u003estatus\u003c/code\u003e is \u003ccode\u003eDONE\u003c/code\u003e and \u003ccode\u003eprogress\u003c/code\u003e is \u003ccode\u003e100\u003c/code\u003e, the requested deployment is complete, if the \u003ccode\u003eerror\u003c/code\u003e field is not empty, there are errors listed within it.\u003c/p\u003e\n"],["\u003cp\u003eIt's recommended to poll the status of operations using exponential backoff, starting with a few seconds and increasing up to a maximum backoff time of a few minutes.\u003c/p\u003e\n"]]],[],null,["# Managing long-running operations with the Deployment Manager API\n\nWhen you make an API request to Deployment Manager, Deployment Manager\nmakes corresponding requests to other Google Cloud APIs. For example,\nwhen you create a deployment that includes a Compute Engine instance,\nDeployment Manager sends an [`instances.insert`](/compute/docs/reference/rest/v1/instances/insert)\nrequest to the Compute Engine API.\n\nWhen you are creating, updating, or deleting deployments, or using other\nAPI methods that might take several minutes or longer to complete,\nAPI requests to Deployment Manager return *long-running operations*.\n\nThis page describes the guidelines for managing long-running operations with\nthe Deployment Manager API.\n\nBefore you begin\n----------------\n\n- If you want to use the command-line examples in this guide, install the [\\`gcloud\\` command-line tool](/sdk).\n- If you want to use the API examples in this guide, set up [API access](/deployment-manager/docs/reference/latest).\n\nMethods that might start long-running operations include:\n\n- `insert` operations, such as [`deployments.insert()`](/deployment-manager/docs/reference/latest/deployments/insert), [`typeProviders.insert()`](/deployment-manager/docs/reference/v2beta/typeProviders/insert), and so on.\n- `update` operations, such as [`deployments.update()`](/deployment-manager/docs/reference/latest/deployments/update).\n- `delete` operations, such as [`deployments.delete()`](/deployment-manager/docs/reference/latest/deployments/delete).\n\nIn these requests, the response is an [Operation resource](/deployment-manager/docs/reference/latest/operations),\nwhich looks like this example: \n\n {\n \"kind\": \"deploymentmanager#operation\",\n \"id\": \"7123423453456654321\", # generated ID\n \"name\": \"operation-11233234311678-587af2c0xyz9c-0987fa54-baccd59f\", # generated name\n \"operationType\": \"insert\",\n \"targetLink\": \"https://www.googleapis.com/deploymentmanager/v2/projects/example-project/global/deployments/wordpress-1\",\n \"targetId\": \"5123321654456321123\",\n \"status\": \"DONE\", # possible values: RUNNING, PENDING, DONE\n \"user\": \"example@example.com\",\n \"progress\": 100,\n \"insertTime\": \"2019-04-29T11:08:32.190-07:00\",\n \"startTime\": \"2019-04-29T11:08:32.200-07:00\",\n \"endTime\": \"2019-04-29T11:09:38.176-07:00\",\n \"selfLink\": \"https://www.googleapis.com/deploymentmanager/v2/projects/example-project/global/operations/operation-11233234311678-587af2c0xyz9c-0987fa54-baccd59f\"\n }\n\nGet the status of an operation\n------------------------------\n\nTo check the status of an operation, use the operation's `name` field to\nmake an [`operations.get()`](/deployment-manager/docs/reference/latest/operations/get)\nrequest, and check the `status` or `progress` of the operation.\n\nWhen the `status` is `DONE`, `progress` is `100`, and the `error` object is\nempty, your deployment is complete and your resources are ready to use.\n\nIf there are errors during the operation, they are listed in the `error` object,\nin the following format: \n\n \"error\": {\n \"errors\": [\n {\n \"code\": \"error code\" # string,\n \"location\": \"location of the error\" # string,\n \"message\": \"error message\" # string\n },\n ...\n ]\n }\n\nAs a best practice, we recommend polling the operation's status with an\nexponential backoff. For example, make the first request after 5 seconds, the\nnext after 10 seconds, the third after 20 seconds, and so on. We recommend\nsetting a maximum backoff time of a few minutes. After you reach the maximum\nbackoff time, you do not need to continue increasing the backoff time."]]