Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The JITL OrderStateTransitionJob template can be used to move orders from a source state to a target state, perform a transition on orders  for example

...

  • From the list of available job templates select the CheckHistoryJob OrderStateTransitionJob.

Then hit the Next button to make the job wizard display available arguments:

...

Explanation:

  • Required Arguments
    • query states : Specifies the expression that is used to query the execution history, for example isCompleted, isCompletedSuccessful, for the full list see Queries.
    • One or both of the following arguments are specified:
      • workflow: Specifies the name of a workflow for which the execution history is looked up. 
      • job: Specifies the name of a job for which the execution history is looked up.
      • If both arguments are specified then the job name is looked up in matching workflow names only.
      • Search for workflows and jobs is case-insensitive.
      • Wildcards can be used for both arguments, for example, accounting*, *account*.
        • * : matches zero or more characters
        • ? : matches any single character
    Optional Arguments
    • liste of states on which the transition is to be applied for example failed,scheduled
    • transition: Specifies the transition to be performed. Possible values are cancel, suspend, continue
    • Optional Arguments
      • workflow_folders:  Optionally the identifier of a Controller can be specified to limit results to workflows and jobs executed with the indicated Controller.
      • workflow_search_patterns:  Optionally the identifier of a Controller can be specified to limit results to workflows and jobs executed with the indicated Controller.
      • order_search_patterns:  Optionally the identifier of a Controller can be specified to limit results to workflows and jobs executed with the indicated Controller.
      • persist_duration:  Optionally the identifier of a Controller can be specified to limit results to workflows and jobs executed with the indicated Controller.
      • controller_id:  Optionally the identifier of a Controller can be specified to limit results to workflows and jobs executed with the indicated Controller.
      • batch_size
  • Note that the the check box provided with each argument has to be selected the argument is to be added to the arguments of the CheckHistoryJob OrderStateTransitionJob template.

When hitting the Submit button the wizard adds the required arguments to the job which should look like this:

...

...

Queries determine

  • the history status of orders or jobs:
    • completed: the order or job completed successfully or failed.
    • completed successful
    • completed failed
  • the period for which the execution history is looked up for orders and jobs that
    • started between two dates
    • completed between two dates
    • with periods being specified as absolute or relative dates

Syntax

Queries are specified from a function and optional arguments.

...

Documentation

The Job Documentation including the full list of arguments can be found from: https://www.sos-berlin.com/doc/JS7-JITL/OrderStateTransitionJob.xml

Anchor
arguments
arguments
Arguments

The OrderStateTransitionJob template accepts the following arguments:

NameRequiredDefault ValuePurpose
statesyesn/a

Possible values: pending,failed, suspended,waiting,inprogress,scheduled,prompting.

The values can be a comma seperated list. Each state in the list is handled seperatly as e.g. the continue action for "prompting" is not the same as for "suspended"

transition

yesn/a

Possible values: cancel, suspend, continue.

  • cancel: Execute cancel for the orders
  • continue: Execute resume for failed and suspended orders. Execute confirm for prompting orders.
  • suspend: Execute suspend for the orders that are not failed and not finished
workflow_foldersno/*A list of workflow folders that contains the orders. 

Items sepearated by semicolon. When ending with /* the folder will be searched recursivly.

Example: /folder/sub1;/another_folder/sub2/*

workflow_search_patternsnon/a

A list of search patterns for workflow folders that contains the orders.

Example: *myWorkflow*, my?orkflow

order_search_patternsno/n/a

A list of search patterns for order names. May contain a folder. Items sepearated by semicolon.

Example: *myWorkflow*; /folder/sub1/my?orkflow

persist_durationnon/a

The duration the order persists in the failed state.

Available for FAILED orders.

Example: 2d

an ISO 8601 date format with the time offset and milliseconds being optional, e.g.

  • YYYY-MM-DDThh:mm:ss[.s][Z (Z means +00)]
  • YYYY-MM-DDThh:mm:ss[.s][+01:00]
  • YYYY-MM-DDThh:mm:ss[.s][+0100]
  • YYYY-MM-DDThh:mm:ss[.s][+01]
  • a format for a period relative to the current time, e.g. 6h, 12h, 1d, 1w that specifies the quantity followed by a qualifier:
  • s (seconds)
  • m (minutes)
  • h (hours)
  • d (days)
  • w (weeks)
  • M (months)
  • y (years)

A time offset is optional (e.g. 2d+02:00)

It can also be specified with the parameter timeZone

If timeZone is undefined then UTC is used

The value 0 indicates the current time

controller_idnoActual Controller-id

Functions

...

  • Scope: specifies that the workflow or job started without consideration if it completed or is still running.
  • Default Period: start on the same day.

...

  • Scope: specifies that the workflow or job completed without consideration of success of failure.
  • Arguments: if the argument startedFrom is specified, then the default value of the startedTo argument is 0d.
  • Default Period: start and completion on the same day.

...

  • Scope: specifies that the workflow or job completed successfully.
  • Arguments: if the argument startedFrom is specified, then the default value of the startedTo argument is 0d.
  • Default Period: start and completion on the same day.

...

  • Scope: specifies that the workflow or job failed.
  • Arguments: if the argument startedFrom is specified, then the default value of the startedTo argument is 0d.
  • Default Period: start and completion on the same day.

...

  • Scope: specifies that the last run of the job completed successfully.
  • Arguments: if the argument startedFrom is specified, then the default value of the startedTo argument is 0d.
  • Default Period: start and completion on the same day.

...

  • Scope: specifies that the last run of the workflow or job failed.
  • Arguments: if the argument startedFrom is specified, then the default value of the startedTo argument is 0d.
  • Default Period: start and completion on the same day.

Arguments

...

Absolute Dates

Absolute date can be specified as values to the startedFrom, startedTo, completedFrom and completedTo arguments.

Dates are specified in ISO-8601 format like this:

  • 2021-12-05
    • The date is specified as yyyy-MM-dd
    • The time is assumed to be midnight UTC time.
  • 2021-12-05T01:30:15
    • The date and time are separated by the T character.
    • The time is specified as hh:mm:ss.
    • The time zone is assumed to be UTC.
  • 2021-12-05T01:00:00+02:00
    • In addition to date and time the time zone offset is specified. A + character specifies a positive offset to UTC time, a - character specifies a negative offset.

Relative Dates

Relative dates can be specified as values to the startedFrom, startedTo, completedFrom and completedTo arguments.

Relative dates are specified like this:

  • -1s, -2s
    • one second ago, two seconds ago
  • -1m, -2m
    • one minute ago, two minutes ago
  • -1h, -2h
    • one hour ago, two hours ago
  • -1d, -2d
    • one day ago, two days ago
  • -1w, -2w
    • one week ago, two weeks ago
  • -1M, -2M
    • one month ago, two months ago
  • -1y, -2y
    • one year ago, two years ago

Examples

...

Documentation

The Job Documentation including the full list of arguments can be found from: https://www.sos-berlin.com/doc/JS7-JITL/CheckHistoryJob.xml

...

n/a results and jobs executed
NameRequiredDefault ValuePurpose
queryyesn/a

Specifies the expression that is used to look up the execution history, for example isCompleted, isCompletedSuccessful etc., for the full list see Queries.

workflow

non/a

Specifies the name of a workflow for which the execution history is looked up. A workflow name or job name has to be specified.

jobnon/aSpecifies the name of a job for which the execution history is looked up. A workflow name or job name has to be specified.
controller_idnoThe identifier of a Controller can be specified to limit the order resultset to workflows with the indicated Controller.

...

batch_

...

size

...

Returns the Boolean result of the query.
Note: The query result is similarly returned with the returnCode return variable and the values 0=true, 1=false.

...

js7CheckHistoryResultControllerId

...

Returns the Controller ID of the resulting history entry.

The value of the return variable is empty if the query returns no result. If the query returns a result then the return variable holds the Controller ID of the youngest resulting history entry.

...

Returns the workflow name of the resulting history entry.

The value of the return variable is empty if the query returns no result.
If the query returns a result then the return variable holds the workflow name of the youngest resulting history entry.

...

Returns the job name of the resulting history entry.

The value of the return variable is empty if the query returns no result.
If the query returns a result then the return variable holds the job name of the youngest resulting history entry.

...

Returns the start date and time of the resulting history entry.

The value of the return variable is empty if the query returns no result. If the query returns a result then the return variable holds the start date and time of the youngest resulting history entry in ISO-8601 format.

...

Returns the completion date and time of the resulting history entry.

The value of the return variable is empty if the query returns no result. If the query returns a result then the return variable contains the completion date and time of the youngest resulting history entry in ISO-8601 format.

...

Returns the value of the query argument.

Returns a copy of the value of the query argument that was used with the query.

...

js7CheckHistoryQueryControllerId

...

Returns the value of the controller_id argument.

Returns a copy of the value of the controller_id argument that was used with the query.

...

Returns the value of the workflow argument.

Returns a copy of the value of the workflow argument that was used with the query.

...

Returns the value of the job argument.

Returns a copy of the value of the job argument that was used with the query.

...

Job Dependencies

The CheckHistoryJob template can be used to implement backward job dependencies:

  • Jobs based on the CheckHistoryJob template do not fail if the underlying query does not return results.
  • Instead, the CheckHistoryJob template provides Return Variables that can be inspected to determine further execution of jobs in a workflow.
  • JS7 offers the JS7 - If Instruction to check the values of Return Variables and to decide what instructions to execute next.

...

Image Removed

Explanation:

...

no10000

The maximum number of orders for one request.

The number of orders that are transitioned in a single transaction. This includes that either all orders in a transaction are transitioned or none. If the number of orders exceeds the batch size then a further transaction is executed.

If the value batch_size = 1 is used then each order is transitioned individually with a successful or failed result.

The batch size should not exceed a value of approx. 15000 in order to limit the size of requests to the Controller to approx. 4 MB which is a frequently applied limit of Proxy Servers that might be in place between the Agent running the job and JOC Cockpit.

Return Variables

The OrderStateTransitionJob template does not return variables:

 

...

Image Removed

Explanation:

...

  • the value 0 if the query of the CheckHistoryJob template returns one or more hits.
  • the value 1 if the query of the CheckHistoryJob template returns no hits.
  • Alternative solutions include to check the value of the $js7CheckHistoryResult return variable for a Boolean value that indicates if the query did return any hits:
    • $js7CheckHistoryResult == true
    • $js7CheckHistoryResult == false

...

Further Resources

...