Skip to content
Stand with Ukraine flag

Task Service

The Task Service manages and runs background jobs for data processing — scheduling, executing, and monitoring them so that model training, telemetry saves, anomaly detection, and report generation happen efficiently without blocking the UI.

Navigate to Tasks in the main menu to view and control all jobs.

Jobs are grouped by domain. Most jobs are triggered by a user action; a few also support a recurring schedule configured in the relevant feature settings.

JobRunsDescription
Execute task sequenceOn demandExecutes a predefined ordered sequence of tasks, useful for chaining multi-step operations
Import configurationOn demandImports views, models, and other Trendz configuration objects from an exported file
Topology discoveryOn demandFull scan of ThingsBoard — builds the complete list of entity types, telemetry fields, and relations available for analysis
Lite topology discoveryScheduledIncremental scan triggered automatically when new device or asset types appear in ThingsBoard; uses a cooldown to avoid redundant runs
Refresh cacheOn demand or scheduledClears and rebuilds the data cache for a view; runs on a configurable periodic or calendar-based schedule when auto-refresh is enabled in view settings
JobRunsDescription
Build view reportOn demandLoads and processes raw telemetry for a view so the chart or table can be rendered
Load view filterOn demandFetches the set of available values for a view’s filter fields (e.g., entity names or attribute values)
Save telemetry to TBOn demand or scheduledComputes aggregated telemetry from a view and writes the results back to ThingsBoard as device attributes or time-series; runs on a configurable schedule when enabled in view settings
Build alarm reportOn demandEvaluates alarm conditions defined in a view and generates the corresponding alarm report
JobRunsDescription
Build anomaly modelOn demandTrains the anomaly detection model on historical telemetry data for the selected entities
Find anomaliesOn demandRe-runs anomaly scoring over a specified historical time range and entity set without retraining the model
Anomaly autodiscoveryScheduledRuns on a configurable periodic schedule to scan incoming data for new anomalies; disabled by default, enabled in anomaly model settings
JobRunsDescription
Test calculationOn demandEvaluates a calculation field definition against sample data to verify the formula before saving
Save calculation result to TBOn demand or scheduledComputes the calculation field values for a time range and writes the results to ThingsBoard; runs on a configurable schedule when auto-refresh is enabled in calculation field settings
JobRunsDescription
Train prediction modelOn demandFits a forecasting model on the selected entities’ historical telemetry
Save prediction model result to TBScheduledExtends the forecast using incremental training, then saves the predicted values to ThingsBoard; runs on a configurable schedule configured in prediction model settings
Prediction model accuracyOn demandCompares the model’s predictions against actual telemetry to report accuracy metrics
JobRunsDescription
AI Assistant responseOn demandSends the current view data to the AI model and returns a natural-language explanation or answer
Run custom promptOn demandExecutes a user-defined AI prompt against the view context
Generate view summaryOn demandProduces an AI-generated summary of the key insights in a view
Find metricOn demandUses AI to propose metric definitions based on available telemetry fields in the Metric Explorer
Generate metric calculationOn demandUses AI to write the Python implementation for a metric definition

Click any task in the list to view its execution details:

FieldDescription
Time StartedWhen the task execution began
DurationHow long the task has been running
Time FinishedWhen the task completed or is expected to finish
StatusCurrent state — see Task Statuses below

From the task detail panel you can also:

  • Execute Task — trigger the task to run immediately.
  • Stop Task — stop a running task.
  • Go to entity — navigate to the ThingsBoard entity associated with the task.
┌──────────┐
│ CREATED │ ← scheduled, waiting to run
└────┬─────┘
│ picked up by scheduler
┌──────────┐
│ RUNNING │ ← executing on a thread
└────┬─────┘
┌─────────────┼──────────────┐
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ FINISHED │ │ FAILED │ │ CANCELED │
└──────────┘ └──────────┘ └──────────┘
LOST ← execution interrupted by a server restart
(detected and marked automatically on next startup)
StatusMeaning
CreatedScheduled but not yet started
RunningCurrently executing
FinishedCompleted successfully
FailedTerminated with an error
CanceledStopped manually before completion
LostExecution was interrupted unexpectedly (e.g., server restart)
NoneNo status available
  • Stop All Tasks — immediately stops all currently running task executions. The tasks themselves and their configurations are not affected.
  • Clear All Executions — removes the execution history for all tasks. Execution records are retained for 3 days. This action only clears history and does not affect future task execution.

The Executions tab provides a detailed log of all task executions. Filter by status — All, Created, Running, or Failed — to quickly find relevant entries.

For each execution the tab shows: Time Started, Duration, Time Finished, and Status.

VariableDefaultDescription
TASK_SERVICE_ENABLEtrueEnable or disable the entire task service
TASK_SERVICE_BACKGROUND_ENABLEtrueEnable or disable automatic background job scheduling
TASK_SERVICE_TASK_QUERY_SIZE10Max jobs picked up per scheduling cycle
TASK_SERVICE_DEFAULT_TASK_TIMEOUT86400000 (24 h)Timeout in milliseconds; jobs running longer are canceled
TASK_SERVICE_TTL_TRACKING_ENABLEtrueAutomatically remove execution records older than 3 days
TASK_SERVICE_LOST_TRACKING_ENABLEtrueDetect and mark executions interrupted by a restart
TASK_SERVICE_STATE_RECORD_TIMEOUT5000 (5 s)Interval in milliseconds for writing execution state to the database