apache/dolphinscheduler · error · TaskException

track linkis status error

Error message

track linkis status error

What it means

Catch-all wrapper in LinkisTask.trackApplicationStatus(): any non-interrupt Exception while polling the Linkis application status (e.g. appId lookup failure, log/regex parsing error) is rethrown as TaskException('track linkis status error').

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-linkis/src/main/java/org/apache/dolphinscheduler/plugin/task/linkis/LinkisTask.java:133

            String status = findStatus(commandExecuteResult.getResultString());
            LinkisJobStatus jobStatus = LinkisJobStatus.convertFromJobStatusString(status);
            switch (jobStatus) {
                case FAILED:
                    setExitStatusCode(EXIT_CODE_FAILURE);
                    break;
                case SUCCEED:
                    setExitStatusCode(EXIT_CODE_SUCCESS);
                    break;
                case CANCELLED:
                    setExitStatusCode(EXIT_CODE_KILL);
                    break;
            }
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            log.error("The current Linkis task has been interrupted", e);
            throw new TaskException("The current Linkis task has been interrupted", e);
        } catch (Exception e) {
            throw new TaskException("track linkis status error", e);
        }
    }

    @Override
    public void cancelApplication() throws TaskException {
        // cancel process
        initTaskId();
        try {
            List<String> args = new ArrayList<>();
            args.add(Constants.SHELL_CLI_OPTIONS);
            args.add(Constants.KILL_OPTIONS);
            args.add(taskId);
            String command = String.join(Constants.SPACE, args);

            IShellInterceptorBuilder<?, ?> shellActuatorBuilder = ShellInterceptorBuilderFactory.newBuilder()
                    .appendScript(command);
            shellCommandExecutor.run(shellActuatorBuilder, null);
            setExitStatusCode(EXIT_CODE_KILL);

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Inspect the wrapped stack trace to identify which status query step failed.
  2. Verify the Linkis job actually emitted a task id (appId) in its output; check getAppIds()/logs.
  3. If a Linkis version upgrade changed output format, update LINKIS_TASK_ID_REGEX in LinkisTask.
  4. Fix or manually complete the job, then rerun the workflow.

Example fix

// before
Pattern LINKIS_TASK_ID_REGEX = Pattern.compile("<outdated pattern>");
// after
Pattern LINKIS_TASK_ID_REGEX = Pattern.compile("jobId\\s*=\\s*(\\d+)");
Defensive patterns

Strategy: retry

Try / catch

try {
    task.trackApplicationStatus();
} catch (TaskException e) {
    // retry with backoff; inspect cause if it persists (regex/output mismatch)
}

Prevention

When it happens

Trigger: findTaskId()/initTaskId() fails, log lines do not match LINKIS_TASK_ID_REGEX, or the status-parsing switch encounters unexpected output from the shell command.

Common situations: Linkis CLI output format changed (version upgrade) so the task-id regex no longer matches; log files unreadable; the status-query command itself fails.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/4a820a5b9017e356. Report an issue: GitHub.