Skip to content

End-to-End Task Flow

This page describes the complete lifecycle of a task in the system — from creation, through scheduling, execution by an agent, and final status updates shown in the UI.


1. Task Creation

A task is created by the user through the UI or API.

Example task definition:

{
  "tid": 1000002,
  "name": "task2",
  "task_owner": "admin",
  "cmd": "ls -l ; sleep 120; ls -l ",
  "run_on_host": "production-server-1",
  "max_run_time": 300,
  "description": "A Stray task : Run an ls command",
  "retry_attempts": 3,
  "stderr": "task1.out",
  "stdout": "task1.err",
  "timezone": "US/Eastern",
  "active": true,
  "calendar": "US_HOLIDAYS",
  "instance": "default",
  "day_of_week": "1111111",
  "trigger_times": "08:30"
}
  • UI: Enter task details using a form or upload a JSON file.

  • EasyTask CLI:

Use the EasyTask CLI to insert tasks from a JSON definition file.

  • CLI Output Example:

The CLI confirms task validation and insertion with messages indicating: 1. Task validation completed 2. Task inserted successfully


2. Scheduler Picks Up the Task

The scheduler periodically polls the task queue and:

  • Checks dependencies
  • Validates time windows

The task status changes from IDLE -> ACTIVE -> TRIGGER in the UI.


3. Task Sent to Agent

The scheduler dispatches the task to the target agent:

  • Agent receives task via internal message broker.
  • Status updates from TRIGGER -> STARTED

The UI shows Dispatched to Agent.


4. Agent Executes the Task

The agent:

  • Runs the command.
  • Captures stdout and stderr.
  • Monitors task completion or failure.
  • Status updates from RUNNING -> SUCCESS or a FAILED state

Live logs or progress can be viewed in the UI.


5. Agent Reports Status to Scheduler

Once execution completes:

  • Agent sends result (success, failure, timeout) back to scheduler.
  • Scheduler updates the task record.

The UI shows the final status: - Success - Failed - Timed Out


Checking Task States in Scheduler Logs

Check scheduler logs to trace task progression and state updates. The scheduler logs show the following progression:

  1. Task Triggered — The scheduler identifies the task and matches its schedule.
  2. Task Validated — The task definition is verified (retries, timeout, host, dependencies).
  3. Task Dispatched — The task is sent to the target worker agent.
  4. Agent Acknowledgment — The agent confirms receipt of the task.
  5. Status Updated — The task status transitions through STARTEDRUNNING.
  6. Execution Result — The final outcome is recorded with status (SUCCESS/FAILED), duration, and return code.

Use the system service manager to access scheduler logs for on-prem deployments.


Checking Task States in Agent Logs

Agent logs show command execution details. The logs capture the following steps:

  1. Task Received — The agent receives the task from the scheduler.
  2. Command Prepared — Environment variables are resolved and output paths are configured.
  3. Execution Start — The command begins running with a start timestamp.
  4. Execution End — The command completes with an end timestamp.
  5. Return Code — A return code of 0 indicates success; any non-zero value indicates failure.

Checking Task States in the UI


Summary

This flow ensures:

  • Traceability — Clear visibility of every task step.
  • Real-time updates — Instant feedback in UI and logs.
  • Reliability — Robust execution and error handling.

Frequently Asked Questions

What states does a task go through during execution?

A task progresses through these states: IDLE (created but inactive) -> ACTIVE (enabled and being evaluated) -> TRIGGER (scheduled time arrived) -> STARTED (dispatched to agent) -> RUNNING (executing on agent) -> SUCCESS or FAILED or TERMINATED (final state). If retry is configured, a FAILED task may be resubmitted automatically.

How can I monitor a task's progress in real time?

You can monitor tasks in three ways: the web console shows live status updates and real-time log streaming, scheduler logs (accessible via the system service manager) show trigger and dispatch events, and agent logs show command execution details including stdout and stderr output.

What happens when a task fails?

When a task fails, the agent reports the failure status and non-zero return code back to the scheduler. If the task has retry_attempts configured, the scheduler will automatically resubmit the task up to the configured number of retries. All attempts are logged with timestamps and output for debugging. If all retries are exhausted, the task remains in FAILED state and alerts are triggered if configured.


Next Steps