Introduction

  • The Cycle Instruction allows repetition of all or some of the jobs and additional instructions in a workflow.
  • The Cycle Instruction can be used:
    • to spawn the complete workflow,
    • to spawn a number of instructions and jobs in a workflow,
    • in a sequential way by using a number of Cycle Instructions within the same workflow,
    • in a nested way by embedding Cycle Instructions within the same workflow.
  • The Cycle Instruction offers versatile options for repeated execution and specification of how often this should happen.
    • The JS7 - Break Instruction can be used to make an order prematurely leave a cycle.
      FEATURE AVAILABILITY STARTING FROM RELEASE 2.5.3
  • Cyclic workflows are an alternative to use of JS7 - Schedules for cyclic orders.

Elements of the Cycle Instruction

The Cycle Instruction allows the specification of any number of cycles that define rule sets describing when job nodes and other instructions are to be repeated.

Each cycle allows the use of one the following cycle types:

  • periodical execution: allows the specification at periodic points in time, as e.g. for the 10th, 15th, 40th minute of each hour.
  • continuous execution: allows the specification of a fixed-length pause between repeated executions of the cycle.
  • ticking execution: allows the specification of fixed-length interval for repeated starts of the cycle.

In addition to any cycles included in a Cycle Instruction the rule set specifies:

  • The period for execution of the cycle:
    • The period begin of the cycle considering the Daily Plan's time zone,
    • The maximum duration for which the cycle is repeated, for example for 8 hours.
  • More than one period can be specified.
    • The order will leave the Cycle Instruction having completed the cycles of the period at which it entered the Cycle Instruction.
    • Example:
      • Period 1: start time at 18:00 for 1 hour with a ticking cycle of 2 minutes.
      • Period 2: start time at 20:00 for 1 hour with a ticking cycle of 2 minutes
    • Behavior:
      • The cycle starts when the start time of Period 1 is reached . The order runs in cycles as configured by the Cycle Instruction.
      • The order performs its last cycle at the end of Period 1 and leaves the Cycle Instruction. The order does not wait and enter Period 2 or any later periods.
      • Similar behavior applies to any number of periods of a Cycle Instruction.
    • Users who wish orders to pass all periods of a Cycle Instruction should add one order per period that is scheduled for a start time after the previous period and before the desired period.

Cycles take account of the weekday which an order is scheduled for:

  • if the Cycle Instruction includes a rule set for the weekday of the order's scheduled date then this is considered by the Cycle Instruction and the order is made to wait for the first cycle to start.
  • if the Cycle Instruction does not include a rule set for the weekday of the order's scheduled date then the order skips the cycle.

Periodical Execution

This cycle type allows specification of both:

  • the period by which the cycle repeats: this can be for example 1 hour, 4 hours, 1 day etc.
  • the point in time for each repeat period when cycles start.

Download Workflow Example (.json upload)pdwCyclicSimpleWorkflowPeriodical.json


Explanation:

  • The property editor displays the summary information of the period.
  • The period is configured:
    • using a frequency, for example every day:
      • if an order's scheduled date (Daily Plan date) is not matched by a frequency then the order skips the Cycle Instruction,
      • otherwise the order considers the Cycle Instruction and, for example, waits for the start of the first cycle,
    • using period details to specify the start and duration of the period, e.g. at the start of the day for 23 hours,
    • using repeat details to specify, for example:
      • the repeat period of 1 hour,
      • the minutes for which the cycle is started in each repeat period.

When creating/modifying a periodical cycle then the properties can look like:


Explanation:

  • The cycle is of the periodical type, i.e. the cycle repeats within the given period at fixed points in time.
  • The period duration is 1h. 
  • The offsets when to start the cycle within the given period are specified by minutes: at each full hour, at each 15th, 30th and 45th minute of each hour.
  • The first cycle is specified to start at 00:00:00, i.e. at the start of the day in the Daily Plan's time zone, with the last cycle being started 23 hours later.
  • If the execution time of cycle takes exceeds the next period then the next cycle will be started immediately once the orders arrives at the Cycle Instruction.

Continuous Execution

This cycle type allows specification of:

  • a fixed-length pause between the end of a cycle execution and the begin of the next cycle execution - consider that the execution time of jobs spawned by a Cycle Instruction might vary between cycles,
  • a limit defining the max. number of cycles to be executed.

Download Workflow Example (.json upload)pdwCyclicSimpleWorkflowContinuous.json


Explanation:

  • The property editor displays the summary information of the period.
  • The period is configured:
    • using a frequency, for example every day:
      • if an order's scheduled date (Daily Plan date) is not matched by a frequency then the order skips the Cycle Instruction,
      • otherwise the order considers the Cycle Instruction and , for example, waits for the begin of the first cycle,
    • using period details to specify the start and duration of the period, for example, the start of the day in the Daily Plan's time zone duration for 23 hours,
    • using repeat details to specify, for example:
      • a 15 minutes break between cycles,
      • a limit of 10 repeated executions of the cycle.

When creating/updating a continuous cycle, then the properties can look like:


Explanation:

  • The cycle is of the continuous type, i.e. the cycle repeats after a fixed-length pause between executions.
  • The pause between execution of cycles within the given period is specified to be 15 minutes.
  • The cycle is repeated for a maximum of 10 times.
  • The first cycle is specified to start at 00:00:00, i.e. begin of day in the Daily Plan's time zone, with the last cycle being started 23 hours later or when hitting the limit specified.

Ticking Execution

This cycle type allows specification of:

  • a fixed-length interval between cycle executions - consider that the execution time of jobs spawned by a Cycle Instruction might vary between cycles,

Download Workflow Example (.json upload)pdwCyclicSimpleWorkflowTicking.json


Explanation:

  • The property editor displays the summary information of the period.
  • The period is configured:
    • using a frequency, for example every day:
      • if an order's scheduled date (Daily Plan date) is not matched by a frequency then the order skips the Cycle Instruction,
      • otherwise the order considers the Cycle Instruction and, for example, waits for the start of the first cycle,
    • using period details to specify the start and duration of the period, for example, at the start of the day in the Daily Plan's time zone for a duration of 23 hours,
    • using repeat details to specify, for example, a 2 minute fixed-length interval between cycles.

When creating/modifying a ticking cycle then properties can look like:


Explanation:

  • The cycle is of the ticking type, i.e. the cycle repeats after a fixed-length interval between executions.
  • The interval between execution of cycles is specified to be 2 minutes.
  • The first cycle is specified to start at 00:00:00, i.e. at the start of the day in the Daily Plan's time zone, with the last cycle being started 23 hours later or when hitting the limit specified.
  • if a cycle takes longer than specified by the ticking interval then the next cycle starts immediately after the order will arrive at the Cycle Instruction.

Use of Cycles with Daylight Saving Changes

The Daily Plan's time zone determines if and when daylight saving changes occur.

Basically any cycles are configured by the begin and duration of a period.

If the start time of a period matches a daylight saving change:

  • in which the clock is forwarded by one hour then the cycle will start immediately. Assuming the clock to be forwarded from 2am to 3am then the cycle starts at 2am with the order history indicating 3am as the start time. The duration of the cycle's period is unaffected by daylight saving changes. For example, if the duration is specified to be 3 hours, then on a day for which the clock is moved forward at 2am to 3am the cycle will be executed until 6am.
  • in which the clock is set back by one hour then the cycle will start according to its repeat interval. Assume the clock to be set back from 3am to 2am then the cycle starts at 2am with the order history indicating 2am as the start time. The duration of the cycle's period is unaffected by daylight saving changes. For example, if the duration is specified to be 3 hours, then on a day for which the clock is set back at 3am to 2am the cycle will be executed until 4am.

Cyclic Workflows vs. Cyclic Orders

Note that the Cycle Instruction allows creation of cyclic workflows as an alternative to the use of JS7 - Schedules for cyclic orders.

  • Execution
    • A Cycle Instruction spawning a complete workflow is an equivalent to a cyclic order from a Schedule.
    • In addition, a Cycle Instruction can be used to execute parts of a workflow in cycles.
  • Efficiency
    • Schedules create a number of order instances for each period in a cycle, Running a single workflow every 30s counts to 2880 orders per day.
    • Cycle Instructions cause cyclic execution of a workflow from a single order.
    • Processing of cyclic workflows is by far more efficient than the use of cyclic orders.
  • Error Handling
    • Failure
      • If a job in a workflow fails then this will occur for each individual order instance of a cyclic order.
      • If a job within a Cycle Instruction fails then, depending on the error handling in place, any cycles that would occur while an order is in a failed state will be skipped.
    • Notification
      • For each failed order instance of a cyclic order a JS7 - Notification is created.
      • For the single order of a cyclic workflow a single Notification is created.
    •  Intervention
      • Any operations on cyclic orders are applied to all order instances including, for example, resuming execution after failure. This results in parallel execution of orders previously scheduled for execution in intervals.
      • For cyclic workflows there is a single order that waits for user intervention.
  • Logging
    • For each order instance of a cyclic order a separate entry is created in the JS7 - Order History and in the JS7 - Task History.
    • For a cyclic workflow there is a single entry in the Order History. The log output of each cycle is appended to this entry. Individual entries per job execution are added to the Task History.

Further Resources



  • No labels