Undeploying a task removes it from the production scheduling system. After a task is undeployed, it can no longer be scheduled. This topic describes how to undeploy and restore a scheduled task in a standard workspace. It also explains how the platform handles existing instances after undeployment.
Usage notes
To protect downstream tasks, DataWorks prevents you from undeploying tasks that have downstream dependencies. Otherwise, an error occurs. For more information, see Error: The task fails to be deleted or undeployed because the task has downstream tasks. To view the dependencies of a task, see Manage scheduled tasks.
By default, undeploying a task from the scheduled task page in the Operation Center reverts it to the editing state in the development environment, rather than moving it to the recycle bin. You can find the task by searching for its name in Data Studio.
Undeploy a task
Step 1: Delete the task in the development environment
Delete the task in Data Studio.
Operation | Description |
Delete a single task | You can delete a specific task from the workflow directory or the workflow panel. After deleting the task, you must click the |
Delete tasks in batches | You can use the batch operation feature to delete multiple tasks at once. |
Delete tasks by using a node group | You can create a node group by selecting multiple nodes and then delete the group. You can also delete nodes from an existing node group. After deleting the task, you must click the |
Step 2: Deploy the record to the production environment
After you delete the task in Data Studio, DataWorks by default creates an undeployment record on the Create Deploy Task page. Users with Workspace Administrator or O&M permissions must deploy this record to the production environment. The production task is undeployed only after a successful deployment. Note that workflow controls may affect the deployment. Ensure that the deployment is successful. For more information about the deployment process and permission control, see Deployment. 
Step 3: Confirm the task is undeployed in production
Go to the Scheduled Task page in Operation Center. If the task no longer exists, the task is successfully undeployed.
Impact of undeployment on existing instances
Unexecuted instances
During the undeployment, the system skips unexecuted instances. It sets their status to Succeeded without executing the task code. For pay-as-you-go billing, DataWorks does not charge for scheduling these skipped instances.
Running instances
During the undeployment, running instances continue to execute until they are complete.
The system automatically deletes instances after they expire, typically after 30 days. DataWorks does not support manual deletion of instances.
If a scheduled task does not need to run on a specific day, you can freeze the instances scheduled for that day. If a task does not need to run for an extended period, you can freeze the scheduled task itself. For more information, see Basic O&M operations for scheduled tasks.
Restore a task
From the recycle bin in Data Studio, you can restore the 100 most recently deleted tasks and then submit and deploy them again.
Restoring a task generates a new task ID.
You can only restore tasks that have been deleted from both the development and production environments. Otherwise, the following error occurs: Please deploy the file ${filename} to the production environment or cancel the deployment in the Deployment Center first.
FAQ
How do I resolve the error "Please deploy the file ${filename} to the production environment or cancel the deployment..." when restoring a file from the recycle bin?
Cause: The recycle bin in DataWorks can only restore tasks that are fully deleted from both the development and production environments. If a task is deleted in development but the deletion is still pending in a deployment package, the system considers it in an intermediate state and blocks the restoration.
Solution: To resolve this, go to the deployment page to cancel the deployment of the task. Afterward, you can return to Data Studio and successfully restore the file from the recycle bin.
How can I undeploy a DataWorks task when I get the error "Failed to delete or undeploy... the task has downstream tasks"?
Cause: This error is a safeguard to prevent breaking data pipelines. DataWorks blocks the undeploying of a task that has downstream dependencies in either the development or production environment.
Solution:
To proceed, you must remove all downstream dependencies first by following these steps:
Identify downstream dependencies: Go to the scheduled task page in the Operation Center for both the development and production environments to find all tasks that depend on the task that you want to undeploy. For more information, see Manage scheduled tasks.
NoteUndeploying a task can cause dependent tasks to fail. Ensure you communicate with the owners of all dependent tasks before proceeding.
Remove the dependencies: For each downstream dependent task, perform the following actions:
Go to its Scheduling configuration page and remove the dependency on the task you intend to undeploy. For instructions, see Delete or change task dependencies.
Submit the downstream task to remove the dependency in the development environment.
Deploy the downstream task to remove the dependency in the production environment.
Undeploy the original task: Once all downstream dependencies are removed from both environments, you can retry undeploying the original task. For more information, see Undeploy tasks.


