Backstage
    Preparing search index...

    Interface SchedulerServiceTaskScheduleDefinition

    Options that control the scheduling of a task.

    interface SchedulerServiceTaskScheduleDefinition {
        frequency:
            | HumanDuration
            | { cron: string }
            | Duration<boolean>
            | { trigger: "manual" };
        initialDelay?: HumanDuration | Duration<boolean>;
        scope?: "global" | "local";
        timeout: HumanDuration | Duration<boolean>;
    }
    Index

    Properties

    frequency:
        | HumanDuration
        | { cron: string }
        | Duration<boolean>
        | { trigger: "manual" }

    How often you want the task to run. The system does its best to avoid overlapping invocations.

    Type Declaration

    • HumanDuration
    • { cron: string }
      • cron: string

        A crontab style string.

        Overview:

          ┌────────────── second (0-60, optional)
        │ ┌──────────── minute (0-59)
        │ │ ┌────────── hour (0-23)
        │ │ │ ┌──────── day of month (1-31)
        │ │ │ │ ┌────── month (1-12)
        │ │ │ │ │ ┌──── day of week (0-6, 0 is Sunday)
        │ │ │ │ │ │
        * * * * * *
    • Duration<boolean>
    • { trigger: "manual" }

    This is the best effort value; under some circumstances there can be deviations. For example, if the task runtime is longer than the frequency and the timeout has not been given or not been exceeded yet, the next invocation of this task will be delayed until after the previous one finishes.

    This is a required field.

    initialDelay?: HumanDuration | Duration<boolean>

    The amount of time that should pass before the first invocation happens.

    This can be useful in cold start scenarios to stagger or delay some heavy compute jobs. If no value is given for this field then the first invocation will happen as soon as possible according to the cadence.

    NOTE: This is a per-worker delay. If you have a cluster of workers all collaborating on a task that has its scope field set to 'global', then you may still see the task being processed by other long-lived workers, while any given single worker is in its initial sleep delay time e.g. after a deployment. Therefore, this parameter is not useful for "globally" pausing work; its main intended use is for individual machines to get a chance to reach some equilibrium at startup before triggering heavy batch workloads.

    scope?: "global" | "local"

    Sets the scope of concurrency control / locking to apply for invocations of this task.

    When the scope is set to the default value 'global', the scheduler will attempt to ensure that only one worker machine runs the task at a time, according to the given cadence. This means that as the number of worker hosts increases, the invocation frequency of this task will not go up. Instead, the load is spread randomly across hosts. This setting is useful for tasks that access shared resources, for example catalog ingestion tasks where you do not want many machines to repeatedly import the same data and trample over each other.

    When the scope is set to 'local', there is no concurrency control across hosts. Each host runs the task according to the given cadence similarly to setInterval, but the runtime ensures that there are no overlapping runs.

    'global'
    
    timeout: HumanDuration | Duration<boolean>

    The maximum amount of time that a single task invocation can take, before it's considered timed out and gets "released" such that a new invocation is permitted to take place (possibly, then, on a different worker).