[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[],[],null,["# Rerun a pipeline\n\n| **Preview**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nYou can rerun specific tasks from a completed, cancelled, or failed machine\nlearning (ML) pipeline runs. When you initiate a rerun, you can modify task-level\nconfigurations, or choose to skip tasks, and then create a run based on the\nupdated configuration. The new pipeline run maintains a reference to the\noriginal pipeline run for traceability. If a task succeeded in a prior run,\nVertex AI Pipelines reuses the cached outcomes for that task. Otherwise,\nif the step had failed, Vertex AI Pipelines runs the step during\nthe pipeline rerun.\n\nThis lets you efficiently address ML pipeline failures by making adjustments to\nyour ML pipeline without restarting the entire ML pipeline. You can adjust a\nfailed task, compare outcomes with different sets of parameters, or skip a\nnon-essential task that's failing.\n\nRerunning a pipeline is useful for MLOps practitioners managing complex\nML pipelines in production. Examples of scenarios where it's useful include the\nfollowing:\n\n- **Handling partial failures in parallel processes**: When one part of a\n large parallel process fails, you can skip the failed task and let the remainder\n of the pipeline run continue. For example, if a data pipeline for one out of 100\n tasks fails, you can skip it.\n\n- **Rerunning a task with updated input data**: If a single task needs to be\n rerun with updated data, you can rerun that specific task.\n\n- **Debugging production issues without requiring code changes**: Rerun a\n specific task and all the tasks that depend on it without involving the author\n of the pipeline code.\n\nRerun a pipeline\n----------------\n\nTo rerun a pipeline, use the Vertex AI SDK for Python. \n\n### Python\n\nUse the following sample to rerun a pipeline by skipping a failed task and\nrerunning another task with updated parameters by using the\n`PipelineJob.rerun()` method:\n\n\u003cbr /\u003e\n\n```python\nfrom google.cloud import aiplatform\nfrom google.cloud.aiplatform.preview.pipelinejob.pipeline_jobs import (\n _PipelineJob as PipelineJob\n)\nfrom google.cloud.aiplatform_v1beta1.types.ui_pipeline_spec import RuntimeArtifact\nfrom google.protobuf.struct_pb2 import Value\nfrom google.cloud.aiplatform_v1beta1.types import PipelineTaskRerunConfig\naiplatform.init(project=\"\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\", location=\"\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e\")\njob = aiplatform.PipelineJob.get(resource_name=\"\u003cvar translate=\"no\"\u003ePIPELINE_RUN_RESOURCE_NAME\u003c/var\u003e\")\noriginal_job_name = job.resource_name\nrerun_task_id = None\nskip_failed_task_id = None\ntask_inputs_override = PipelineTaskRerunConfig.Inputs(\n parameter_values={\n \"\u003cvar translate=\"no\"\u003eTASK_PARAMETER_1\u003c/var\u003e\": Value(TASK_PARAMETER_1_VALUE),\n \"\u003cvar translate=\"no\"\u003eTASK_PARAMETER_2\u003c/var\u003e\": Value(TASK_PARAMETER_2_VALUE)\n }\n)\nfor task in job.task_details:\n if task.task_name == RERUN_TASK_NAME:\n rerun_task_id = task.task_id\n if task.task_name == SKIP_FAILED_TASK_NAME:\n skip_failed_task_id = task.task_id\npipeline_job.rerun(original_pipelinejob_name=original_job_name,\n pipeline_task_rerun_configs=[\n PipelineTaskRerunConfig(task_id = rerun_task_id,\n skip_task = False,\n inputs = PipelineTaskRerunConfig.Inputs(task_inputs_override)\n ),\n PipelineTaskRerunConfig(task_id = skip_failed_task_id,\n skip_task = True\n )\n ],\n parameter_values=PIPELINE_PARAMETER_VALUES,\n job_id=RERUN_PIPELINE_JOB_ID)\n```\n\n\u003cbr /\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: The Google Cloud project containing the pipeline run.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: The region where the pipeline run is located. For more information about the regions where Vertex AI Pipelines is available, see the [Vertex AI locations guide](/vertex-ai/docs/general/locations#feature-availability).\n- \u003cvar translate=\"no\"\u003ePIPELINE_RUN_RESOURCE_NAME\u003c/var\u003e: The fully qualified resource name of\n the completed, failed, or cancelled pipeline run that you want to rerun.\n Enter the resource name in the format\n `projects/`\u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e`/locations/`\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e`/pipelineJobs/`\u003cvar translate=\"no\"\u003ePIPELINE_RUN_ID\u003c/var\u003e, where:\n\n - \u003cvar translate=\"no\"\u003ePROJECT_NUMBER\u003c/var\u003e: The project number for your project. You can locate this project number in the Google Cloud console. For more information, see [Find the project name, number, and ID](/resource-manager/docs/creating-managing-projects#identifying_projects).\n - \u003cvar translate=\"no\"\u003ePIPELINE_RUN_ID\u003c/var\u003e with the unique ID of the pipeline run that you want to rerun. The ID is displayed in the **Runs** tab on the **Pipelines** page in the Google Cloud console.\n- \u003cvar translate=\"no\"\u003eRERUN_TASK_NAME\u003c/var\u003e: The name of the task to rerun with updated parameters.\n- \u003cvar translate=\"no\"\u003eSKIP_FAILED_TASK_NAME\u003c/var\u003e: The name of the failed task to skip during the rerun.\n- \u003cvar translate=\"no\"\u003eTASK_PARAMETER_1\u003c/var\u003e and \u003cvar translate=\"no\"\u003eTASK_PARAMETER_2\u003c/var\u003e: The names of the parameters for the task that you want to override in the pipeline rerun.\n- \u003cvar translate=\"no\"\u003eTASK_PARAMETER_1_VALUE\u003c/var\u003e and \u003cvar translate=\"no\"\u003eTASK_PARAMETER_2_VALUE\u003c/var\u003e: The new values of \u003cvar translate=\"no\"\u003eTASK_PARAMETER_1\u003c/var\u003e and \u003cvar translate=\"no\"\u003eTASK_PARAMETER_2\u003c/var\u003e respectively in the pipeline rerun.\n- \u003cvar translate=\"no\"\u003ePIPELINE_PARAMETER_VALUES\u003c/var\u003e: Optional. The updated pipeline run-level parameter values to use for the pipeline rerun.\n- \u003cvar translate=\"no\"\u003eRERUN_PIPELINE_JOB_ID\u003c/var\u003e: Optional. A unique ID to assign to the new pipeline rerun job.\n\n\u003cbr /\u003e"]]