After you develop the code for a node, you can debug the script or a code snippet using features like Run, Run with Parameters, and Quick run. After debugging is complete, you can view the results. This topic describes how to debug nodes and workflows in DataWorks.
Prerequisite
A node has been developed. For more information, see Data Studio.
Background
You can choose to debug a single node or debug a workflow. After a run is complete, you can view the results in Operating history or use the ad hoc query feature to view the results, and process the query results.
When you debug a single node or a workflow, you are not charged for DataWorks scheduling resources, but you are charged for the compute engines used. For more information about compute engine fees, see the billing documentation for the respective engine.
Queries that use query acceleration have a maximum runtime limit of 1 hour.
Debug a single node
Go to the Data Studio page. In the left-side navigation pane, under Data Development or Manually Triggered Workflow, find the target workflow and double-click the node that you want to edit.
Run the node to debug it.
On the node's editor tab, use Run or Run with Parameters from the toolbar to debug the code logic. You can also use Quick run to debug a code snippet. The following table describes each option.
NoteIf you do not have permissions for the data you want to query when you run a node, see Overview of permission management for compute engines and data to learn about permission control for different compute engines in DataWorks.
Run option
Description
Use case
Run (
icon)This option lets you assign values to variables and specify a resource group for testing. These settings are saved for future runs.
NoteWhen you run a newly created node for the first time, a configuration dialog appears. You must manually assign constant values to the variables in the code. DataWorks saves the values you assign. The next time you run the node, the saved configuration is used by default.
Use this option when you need to debug code frequently.
Run with Parameters (
icon)Each time you run the node, you must assign constant values to variables for the test scenario and specify a resource group.
Use this option when you need to modify the values assigned to variables in the code or change the resource group used by the task.
Quick run (
icon)This option lets you debug a code snippet in the code area on the node's editor tab.
Use this option when you only need to debug a code snippet in a node.
NoteThis feature is only used to debug the correctness of a code snippet. To debug the complete code logic, use Run or Run with Parameters.
Debug a workflow
Go to the Data Studio page. In the left-side navigation pane, under Data Development or Manually Triggered Workflow, double-click the target workflow to open its panel.
Debug the workflow.
Click the Run (
icon) button on the workflow panel toolbar to run all tasks in the workflow sequentially based on their dependencies.You can also right-click a node in the workflow panel and select Run Node and Downstream Nodes to run the node and all its downstream nodes based on their dependencies.
The toolbar run and the right-click Run Node and Downstream Nodes options work differently:
Toolbar run: Runs all nodes sequentially from upstream to downstream based on the complete DAG of the workflow. Each node is submitted for running independently, which is equivalent to running each node individually from its editor tab.
Right-click Run Node and Downstream Nodes: Starts from the selected node and runs the node and its downstream nodes with the dependency scheduling logic applied. This option validates the run status and output of upstream nodes, which is different from running a node directly from its editor tab (standalone debugging mode).
If an error occurs when you use Run Node and Downstream Nodes but the same SQL runs successfully from the node's editor tab, it is because the right-click run applies the dependency scheduling logic to validate the run status and output data of upstream nodes, whereas a direct run only executes the SQL code of the current node. You can troubleshoot the issue as follows:
Check the run status of upstream nodes. The right-click run validates upstream dependencies. If an upstream node has not been run or has failed, the current node will report an error. View the run status icons of upstream nodes in the workflow panel to confirm that all upstream nodes have run successfully.
Check the dependency configurations between nodes. Verify that the input and output parameter passing between nodes is correct and that the scheduling parameter assignments match your expectations. On the schedule settings page of the node, check whether the upstream output tables match the input tables of the current node.
Right-click the node that reports an error, select the option to view runtime logs, and locate the specific error message. The error in the logs usually contains the specific cause, such as a table not existing, insufficient permissions, or syntax errors.
Check for comment syntax issues in the SQL code. Some engines parse comments differently in scheduling mode compared to direct execution, which may cause syntax errors. To troubleshoot, try removing block comments (
/* */) from the SQL code while keeping only line comments (--), and check whether the error persists.Check whether the output data of upstream nodes is ready. The right-click run relies on data tables produced by upstream nodes as input. If an upstream node has run successfully but its output data is not yet ready or has been cleaned up, the current node will report an error because it cannot read the input table.
NoteIf nodes in a manually triggered workflow have variables with the same name and those variables can be assigned uniformly, you can define workflow parameters in the workflow panel and assign values to the parameters. Then, run the workflow to view the assignment results and execution status of the manual tasks.
Only some node types support workflow parameters. Refer to the actual interface for details.
After the run is complete, you can right-click a node in the workflow panel to view the runtime logs of that node.
View operating history
You can go to the Operating history page in Data Studio to view all task records that have been run by the current logon account in Data Studio within the last three days.
After a task is run in Data Studio, it is submitted to the corresponding engine for execution. Even if you accidentally close the task during execution, the task continues to run. You can go to the Operating history page to view runtime logs or stop tasks that have already been submitted for execution.
Create an ad hoc query file
If you only need to query data and test SQL code in Data Studio (the development environment) to verify whether the actual results match the expected values or to validate the correctness of the code, without deploying the data or SQL code to the production environment, you can create an ad hoc query file.
If you do not have permissions for the data you want to query when you run a node, see Overview of permission management for compute engines and data to learn about permission control for different compute engines in DataWorks.
Process query results
After SQL code is executed successfully, you can perform the following operations on the query results.
Operation | Description | References |
Analyze data | Synchronize query results to a spreadsheet for richer analysis operations. | |
Share data | Synchronize query results to a spreadsheet and share the data with specified users by using the data sharing feature of spreadsheets. | |
Download data | Download the query results as a spreadsheet to your local machine. By default, up to 10,000 rows of data are displayed. |
RAM users who have been assigned the Tenant Administrator, Tenant Security Administrator, or Workspace Administrator role can go to configure query result settings to control the number of rows displayed, the number of rows that can be downloaded, and whether downloading is allowed. For more information about authorization, see Grant access to roles.
The download feature is available only for DataWorks Standard Edition, Professional Edition, and Enterprise Edition. To use this feature, upgrade DataWorks to the corresponding edition. For more information, see DataWorks editions.