Updated on 2024-02-07 GMT+08:00

SQL Job Management

SQL jobs allow you to execute SQL statements entered in the SQL job editing window, import data, and export data.

SQL job management provides the following functions:

SQL Jobs Page

On the Overview page of the DLI console, click SQL Jobs to go to the SQL job management page. Alternatively, you can click Job Management > SQL Jobs. The job list displays all SQL jobs. If there are a large number of jobs, they will be displayed on multiple pages. You can switch to the specified page as needed. DLI allows you to view jobs in all statuses. By default, jobs in the job list are displayed in descending order of the job creation time.

Table 1 SQL Job management parameters

Parameter

Description

Queues

Name of the queue to which a job belongs

Engine

SQL jobs support the Spark and Trino engines.

  • spark: displays jobs whose execution engine is spark.
  • trino: displays jobs whose execution engine is trino.

Username

Name of the user who executed the job.

Type

Job type. The following types are supported:

  • IMPORT: A job that imports data to DLI
  • EXPORT: A job that exports data from DLI
  • DCL: Conventional DCLs and operations related to queue permissions
  • DDL:Conventional DDLs, including creating and deleting databases and tables
  • QUERY: A job that querys data by running SQL statements
  • INSERT: A job that inserts data by running SQL statements
  • UPDATE: A job that updates data.
  • DELETE: A job that deletes a SQL job.
  • DATA_MIGRATION: A job that migrates data.
  • RESTART_QUEUE: A job that restarts a queue.
  • SCALE_QUEUE: A job that changes queue specifications, including sale-out and scale-in.

Status

Job status. Possible values are as follows:

  • Submitting
  • Running
  • Finished
  • Canceled
  • Failed
  • Scaling

Query

SQL statements for operations such as exporting and creating tables

You can click to copy the query statement.

Duration

Running duration of a job

Created

Time when a job is created. Jobs can be displayed in ascending or descending order of the job creation time.

Operation

  • Edit: Edit the job.
  • Cancel
    • You can terminate a job only when the job is in Submitting or Running status.
    • A job whose status is Finished, Failed, or Canceled cannot be terminated.
    • If the Cancel button is gray, you are not allowed to perform this operation.
  • Re-execute: Execute the job again.
  • SparkUI: Display the Spark job execution page.
    NOTE:
    • When you execute a job on a created queue, the cluster is restarted. It takes about 10 minutes. If you click SparkUI before the cluster is created, an empty projectID will be cached. The SparkUI page cannot be displayed. You are advised to use a dedicated queue so that the cluster will not be released. Alternatively, wait for a while after the job is submitted (the cluster is created), and then check SparkUI.
    • Currently, only the latest 100 job information records are displayed on the SparkUI of DLI.
  • In addition to the preceding operations, the following operations are available for QUERY jobs and asynchronous DDL jobs.
    • Submit Download Request: Download the results of asynchronous DDL and QUERY statements to a local directory. For details, see Submitting Download Request.
    • View Result: View the job running result.
    • Export Result: Export the job running result to the created OBS bucket.
  • In addition to the preceding operations, the EXPORT job also includes the following operations:
    • Download
  • View Log: Save job logs to the temporary OBS bucket created by DLI.
NOTE:

The View Log button is not available for synchronization jobs and jobs running on the default queue.

Searching for a Job

On the SQL Jobs page, you can search jobs with any of the following operations.

  • Select a queue name.
  • Select an engine.
  • Set the date range.
  • Enter a username, statement, tag, or job ID.
  • Select the creation time in ascending or descending order.
  • Select a job type.
  • Select a job status.
  • Select the job execution duration in ascending or descending order.

Viewing Job Details

On the SQL Jobs page, you can click in front of a job record to view details about the job.

Job details vary with job types. The job details vary depending on the job types, status, and configuration options. The following describes how to load data, create a table, and select a job. For details about other job types, see the information on the management console.

  • Load data (job type: IMPORT) include the following information: queue, job ID, username, type, status, execution statement, running duration, creation time, end time, parameter settings, label, number of results, scanned data, number of scanned data, number of error records, storage path, data format, database, table, table header, separator, reference character, escape character, date format, timestamp format, total CPU used, and output bytes.
  • Create table (job type: DDL) include the following information: queue, job ID, username, type, status, execution statement, running duration, creation time, end time, parameter settings, tags, number of results, scanned data, and database.
  • Select (job type: QUERY) include the following information: queue, job ID, username, type, status, execution statement, running duration, creation time, end time, parameter setting, label, number of results (results of successful executions can be exported), and scanned data, username, result status (results of successful tasks can be viewed. Failure causes of failed tasks are displayed), database, total CPU used, and output bytes.
    • Total CPU Used (Core x ms): total CPU used during job execution.
    • Output Bytes: number of output bytes after the job is executed.

Terminating a Job

On the SQL Jobs page, you can click Terminate in the Operation column to stop a submitting or running job.

Submitting Download Request

Results of asynchronous DDL and QUERY statements can be downloaded to a local directory. The procedure is as follows:

  1. Click Submit Download Request in the Operation column of the asynchronous DDL or QUERY job that is successfully executed. In the dialog box that is displayed, click OK. After a few seconds, the Submit Download Request button would change to Download.

  2. Click Download to download the result to your local PC.

Exporting Query Results

Starting from January 2024, DLI will only support reading query results from job buckets. To use this feature, the following conditions must be met:
  • On the DLI management console, choose Global Configuration > Project to configure the job bucket. For details about how to configure a job bucket, see Project Configurations.
  • Submit a service ticket to request the whitelisting of the feature that allows writing query results to buckets.

For details about how to download OBS objects to a local host, see Object Management > Downloading Objects in Object Storage Service User Guide.