Mengonfigurasi percobaan ulang untuk tugas pipeline
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Anda dapat menentukan apakah tugas pipeline harus dijalankan ulang jika gagal, dengan mengonfigurasi percobaan ulang untuk tugas tersebut. Anda dapat menetapkan jumlah upaya untuk menjalankan ulang tugas saat terjadi kegagalan dan penundaan antara upaya percobaan ulang berikutnya.
Gunakan contoh kode berikut untuk mengonfigurasi kebijakan kegagalan tugas pipeline
bernama train_op dengan menggunakan
metode set_retry
di Kubeflow Pipelines SDK:
NUMBER_OF_RETRIES: Jumlah percobaan ulang tugas jika gagal.
BACKOFF_DURATION: Opsional. Durasi waktu tunggu setelah tugas
gagal sebelum mencoba kembali. Jika Anda tidak menetapkan parameter ini, durasi
akan ditetapkan ke 0s secara default.
BACKOFF_FACTOR: Opsional. Faktor yang digunakan untuk mengalikan durasi jeda
untuk setiap percobaan ulang berikutnya. Jika Anda tidak menetapkan parameter ini, faktor jeda akan ditetapkan ke 2.0 secara default.
BACKOFF_MAX_DURATION: Opsional. Durasi backoff maksimum antara percobaan ulang berikutnya.
Jika Anda tidak menetapkan parameter ini, durasi maksimum akan ditetapkan ke 3600s secara default.
[[["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-09-02 UTC."],[],[],null,["# Configure retries for a pipeline task\n\nYou can specify whether a pipeline task must be rerun if it fails, by\nconfiguring the retries for that task. You can set the number of attempts to\nrerun the task on failure and the delay between subsequent retries.\n\nUse the following code sample to configure the failure policy of a pipeline task\nnamed `train_op` by using the\n[`set_retry`](https://kubeflow-pipelines.readthedocs.io/page/source/dsl.html#kfp.dsl.PipelineTask.set_retry)\nmethod in the Kubeflow Pipelines SDK: \n\n from kfp import dsl\n\n @dsl.pipeline(name='custom-container-pipeline')\n def pipeline():\n generate = generate_op()\n train = (\n train_op(\n training_data=generate.outputs['training_data'],\n test_data=generate.outputs['test_data'],\n config_file=generate.outputs['config_file'])\n .set_retry(\n num_retries=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eNUMBER_OF_RETRIES\u003c/span\u003e\u003c/var\u003e,\n backoff_duration='\u003cvar translate=\"no\"\u003eBACKOFF_DURATION\u003c/var\u003e',\n backoff_factor=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eBACKOFF_FACTOR\u003c/span\u003e\u003c/var\u003e,\n backoff_maxk_duration='\u003cvar translate=\"no\"\u003eBACKOFF_MAX_DURATION\u003c/var\u003e'\n )\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eNUMBER_OF_RETRIES\u003c/var\u003e: The number of times to retry the task upon failure.\n\n- \u003cvar translate=\"no\"\u003eBACKOFF_DURATION\u003c/var\u003e: Optional. The duration of time wait after the task\n fails before retrying. If you don't set this parameter, the duration\n is set to `0s`, by default.\n\n- \u003cvar translate=\"no\"\u003eBACKOFF_FACTOR\u003c/var\u003e: Optional. The factor by which the backoff duration\n is multiplied for each subsequent retry. If you don't set this parameter, the\n backoff factor is set to `2.0`, by default.\n\n- \u003cvar translate=\"no\"\u003eBACKOFF_MAX_DURATION\u003c/var\u003e: Optional. The maximum backoff duration between subsequent retries.\n If you don't set this parameter, the maximum duration is set to `3600s`, by default.\n\n| **Caution:** You can't pass output parameters from other pipeline tasks or pipeline input parameters as parameter values for the set_retry method. These values must be available when you compile the pipeline."]]