detached.scripts

Scripts detached

type

object

properties

  • accessedValues

The list of values read by the script, in addition to triggers.

The wildcard ‘*’ can be used to match multiple value. For example, ‘root.*.test’ will match ‘root.device.1.test’, ‘root.server.test’.

The value with retention FIRE_AND_FORGET will be ignored because they cannot be stored in cache and cannot be provided to a script. Their can only be used as a script trigger.

Default value is [[]]

type

array

default

items

type

string

  • backpressureStrategy

Defines what happens when a new execution arrives and the in-flight limit is reached (i.e. maxInFlightExecutions > 0 and pending + running >= maxInFlightExecutions).

Running executions are never interrupted only pending (queued) executions can be dropped.

  • DROP_LATEST: the incoming execution is silently discarded. The existing queue is preserved. Use when older executions are more important.

  • DROP_OLDEST: the oldest pending execution in the queue is removed to make room for the new one, keeping the script up-to-date with recent triggers. If the queue is empty (all slots are occupied by running executions), the incoming execution is dropped instead.

This setting is ignored when maxInFlightExecutions is -1 (unlimited) or 0 (disabled).

Default value is [“DROP_OLDEST”]

type

string

enum

DROP_OLDEST, DROP_LATEST

default

DROP_OLDEST

  • isTemplateGeneratedByOspComposer

Name of the playbook that generated this file. If present, the file is managed by the Composer and may be overwritten on regeneration. Used for selective clean. Do not edit or set manually.

type

string

  • maxConcurrentExecutions

The maximum simultaneous execution. Be careful when using a value other than 1 and executing tasks on external device.

The script can be executed two times in simultaneous, this means the external service can receive any action from the source script in any order.

Default value is [1]

type

integer

minimum

1

default

1

  • maxInFlightExecutions

Maximum number of executions of this script that can be in flight simultaneously, counting both pending (queued) and currently running executions. A new execution is accepted only when pending + running < maxInFlightExecutions.

Three modes are available:

  • -1: unlimited — every incoming execution is accepted regardless of how many are already pending or running. Use with care on high-frequency triggers to avoid unbounded memory growth.

  • 0: disabled — all executions are unconditionally rejected. Useful as a kill switch to pause a script without removing its configuration.

  • > 0: bounded — when the limit is reached, the backpressureStrategy determines what happens to the excess execution.

Example: with maxInFlightExecutions = 2 and maxConcurrentExecutions = 1, two states are possible:

  • The shared execution pool is fully occupied by other scripts, leaving no slot available: 2 queued, 0 running.

  • A pool slot is available and processing one execution while the other waits: 1 running, 1 queued.

Default value is [-1]

type

integer

minimum

-1

default

-1

  • moduleId

The ItemId of the module script ID who own (ex: modules.scripts.scripts-1)

type

string

  • priority

Scheduling priority of this script relative to other scripts sharing the same execution pipeline. Lower values are scheduled first.

Priority only determines the order in which different scripts compete for execution slots.

Default value is [50]

type

integer

minimum

1

default

50

  • scheduledExecutions

The list of cron expression ↗️ to schedule the script execution.

The expected format is <Seconds> <Minutes> <Hours> <Day of month> <Month> <Day of week> <Year>.

For example, the following expression schedule one execution every:

  • seconds: * * * ? * * *

  • 10 seconds: 0/10 * * ? * * *

  • monday at 13:00: 0 0 13 ? * MON *

  • every hour at 0 and 30 minutes: 0 0,30 * ? * * *

  • every first day of each month: 0 0 0 1/1 * ? *

The / can be used to specify a start time and an interval (every x seconds starting at y second).

The , can be used to define the multiple execution points (At 10, 25, 45 seconds).

The ? is only used for the field Day of month and Day of week because they are mutually exclusive. For example, setting an execution on the first day of every month and every Monday on the same expression is not valid, so one of them will have a ? instead.

Default value is [[]]

type

array

default

items

type

string

  • sourceCode

The raw source code of the script.

This is exclusive with the sourceFile field.

type

string

  • sourceFile

The path to the script file to use when an execution is triggered. It should be a relative path to root/scripts/scripts.js.

Note: The file is included through this configuration, so it does not need to be declared as a resource in the module.resource file.

This is mutually exclusive with the sourceCode field.

type

string

  • templateId

The id of the template to use for this file

type

string

  • templateVariables

The variables and their values to be replaced from the template

type

object

additionalProperties

  • useTriggerAsId

When true, the scheduling key is composed of the script name and the trigger id instead of the script name alone. This gives each trigger its own independent queue (maxInFlightExecutions, backpressureStrategy, etc. are still shared).

Use this when the same script is triggered by several independent value sources and each source should be queued separately.

Default value is [false]

type

boolean

default

False

  • validity

Maximum age of a pending execution. If an execution has been waiting in the queue longer than this duration, it is silently dropped when the scheduler attempts to run it.

This prevents stale executions from running after a backlog has built up (e.g. after a pause or burst of triggers).

If not set, pending executions never expire and will always be executed regardless of how long they have been waiting in the queue.

DurationConfigurationEntity

  • variablesFiles

The variables files to use to replace the variables. The first file of the list will take precedence over the following one. Template variables take precedence over the contents of the files.

type

array

items

type

string

additionalProperties

False

oneOf

allOf

not

allOf

not

DurationConfigurationEntity

type

object

properties

  • unit

The unit of time expressed

type

string

enum

NANOSECONDS, MICROSECONDS, MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS

  • value

The amount of time expressed with the unit

type

integer

additionalProperties

False