From Obsidian Scheduler
Jump to navigationJump to search

Obsidian supports dynamic job chaining between two jobs. All chaining configuration is managed in the job chains portion of the admin web application.

Chaining can be triggered simply by the state of the queued job, or as of version 1.4, conditionally, based on the saved results of a successfully completed job.

A job can be chained to any other job. By default, chaining between two jobs will trigger when the source job either completes or fails, but any source termination state can be selected to trigger the chain. Chain configurations can be disabled and re-enabled at any time. Chaining can also be constrained to a schedule, using a standard cron schedule.

Chaining will only trigger for a target job if the job has the state Enabled or Chain Active at the trigger time. A job that is Disabled or Ad Hoc Active will not be chained.

Conditional Chaining

Release 1.4 introduced conditional chaining. This feature allows for jobs to be triggered when a successfully completed source job saves job results which match a set of defined conditions. When setting up the conditional evaluations, you specify one or more variable evaluations that must be matched to cause the chain to fire. A condition is comprised of the variable name, an operator, and one or more values

For numeric operators, your conditions are coerced to the numeric value types that your source job saves (e.g. integer, etc.).

Note: All conditions must be met for the chain to be successfully triggered (i.e. they are ANDed together). Additionally, operators match if any saved value matches the operator. This is important to remember if a job saves more than one value under the same variable name.

The supported operators are:

  • Equals/Not Equals - A direct equality comparison (case-sensitive). If no value is saved, Not Equals evaluates to true.
  • Exists/Not Exists - Uses presence of a saved variable to match.
  • In/Not In - Triggered if any saved job result value under the name matches a defined value (case-sensitive). If no value is saved, Not In evaluates to true.
  • Contains - String contains (case-sensitive).
  • Starts With/Ends With - String starts with/ends with match (case-sensitive). An equal string will also trigger either of these operators.
  • Regexp - Regular expression match based on Java's Pattern class.
  • Less Than/Less Than Or Equal/Greater Than/Greater Than Or Equal - Numeric only: values are coerced to an integer or decimal value.

Chaining Results

All chaining evaluations are stored. If chaining is triggered, or if it fails based on a conditional evaluation, the job activity view shows which jobs a source job triggered and also which job triggered a chained job. When chaining misses because the source state didn't match any of those configured, target job is in an unchainable state, chaining configuration is disabled or source completion time was outside the constraints of a provided chaining schedule, a detail record with state Chain Skipped will still be available for review with the detail of why chaining was not triggered.