The Realtime Compute development platform provides you with a local debugging environment. You can upload custom data, simulate job running, and check output in the local debugging environment to make sure that your business logic is valid.

Characteristics

The local debugging environment is completely isolated from the production environment. In the local debugging environment, all Flink SQL jobs run in an independent debugging container, and the debugging results are displayed on pages in the debugging environment. Local debugging does not affect online production streams, Realtime Compute jobs, or data storage systems.
Note In local debugging mode, Realtime Compute cannot detect running failures caused by incompatible data formats in data storage resources. For example, it cannot detect whether the length of output data exceeds the maximum length specified when you create an ApsaraDB for RDS table.

Procedure

Note Before you debug a job, make sure that you have developed the job. For more information, see Develop a job.
  1. On the top of the job edit section, click Debug.
  2. In the Debug File dialog box, enter the test data. You can obtain test data by using one of the following methods:
    • Upload local data.
      1. In the data preview section, click Download Template.
      2. Edit the debugging data based on the template.
        Note By default, the debugging data uses a comma (,) as the delimiter. For more information about how to customize a delimiter, see Delimiter of the debugging data.
      3. In the Upload File section, click Upload to upload the debugging data.
    • Sample online data.
      Note Before you use the Sequential Online Data Sampling feature, make sure that the data source contains data during the sampling.
      1. In the data preview section, click Random Online Data Sampling or Sequential Online Data Sampling.
      2. Enter the sample configuration information.
      3. Click OK.
    Note After the data is uploaded, you can view it in the data preview section.
  3. Click OK.
  4. In the lower part of the job edit section, view the debugging results.

Delimiter of the debugging data

By default, the debugging data uses a comma (,) as the delimiter. If the input data, such as a JSON file, already contains commas (,), you must define another delimiter for the debugging data, such as a vertical bar (|).

Note Realtime Compute only supports a single character as the delimiter, such as a vertical bar (|). You cannot use a string as the delimiter, such as aaa.
To configure a delimiter for debugging data, follow these steps:
Note Before you configure a delimiter, make sure that you have developed a job. For more information, see Develop a job.
  1. On the right of the job edit section, click Parameters.
  2. In the parameter edit section of the job, enter the configuration of the delimiter. The following code specifies a vertical bar (|) as the delimiter:
    debug.input.delimiter = |

UDX logs

  • Display user-defined extension (UDX) logs generated during local debugging.
    In Java, use the following method to convert the log format so the logs can be parsed by Realtime Compute and display the UDX logs generated during local debugging:
    public static void debugMsgOutput(String msg) {
        System.out.println(
          String.format("{\"type\":\"log\",\"level\": \"INFO\", \"time\": \"%s\", \"message\": \"%s\", \"throwable\": \"null\"}\n",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()), msg));
    }
  • View UDX logs.
    After the debugging is complete, you can view the UDX logs on the Completed tab at the lower part of the job edit section.
    Note You can press Ctrl+F to search for the logs.