Quantcast
Channel: WORKLOAD AUTOMATION COMMUNITY - Blogs
Viewing all articles
Browse latest Browse all 201

How to drive your workload by business logic

$
0
0
When designing a workflow into job streams using the HCL Workload Automation solution it may happen that the entire process is not modeled as a simple pipeline and the implementation of the projected flowchart requires some branching and decision logic (IF… THEN.. ELSE…).
Using HCL Workload Automation conditional dependencies feature it’s very easy to solve this design problem, by reading this blog you will learn how to create and use conditional dependencies in many use cases.
What is a conditional dependency?
 
It’s a job dependency that will be released in case a particular status is reached or a specific output condition is verified on the parent job. If the condition is not satisfied, the dependent job will be suppressed.
Thinking about conditional dependency on job status we can affirm that is a generalization of the standard dependency that is released if the parent job ends in success or it’s canceled while, on conditional dependency, you can map any status as requirement even an ABEND or RUNNING state and, if not satisfied upon parent job’s completion, the child job will go into SUPPRESS state instead of remaining in HOLD status like in standard dependencies.
Let’s see our first use case.

In this use case the scheduler wants to differentiate the job stream processing in case the PRINT_ANSWER job is ending in error. To achieve this goal is sufficient to create a dependency for the job PROCESS_DATA from PRINT_ANSWER and flag it as conditional dependency and select the status as SUCC, on the other side, the conditional dependency for MANAGE_ERROR job is associated to the ABEND status.
As you can see in the figure if PRINT_ANSWER job is successful the MANAGE_ERROR job will be suppressed and the regular PROCESS_DATA job will run.
 
Sometimes it’s required to manage the job stream flow differently depending on a job’s return code instead of its status. Let’s see this use case in details.
 
Use case 2: branching by return code
​As shown in the figure above the job stream is branching to manage two different successful return codes for job START.
Job START has two different successful output conditions labeled as “zero” and “four” and jobs CHILD_0 and CHILD_4 are dependent from it with a conditional dependency based on the respective output conditions.
In the example the exit code of START is 4 and condition “four” is true while condition “zero” is false causing job CHILD_0 suppressing and job CHILD_4 executing.
 
Let’s make the processing requirement more complex like branching the workflow basing on the content of the job log or the result of a database query or a particular value of a JSON received as answer in a RESTful job and not on the status mapped for the job…
​In this example conditions that are not affecting the job status (“other output conditions” field) is created for job MESSAGE to evaluate the presence of the strings “KO” or “OK” in the job log using the variable ${this.stdlist} to branch the processing. Notice that successor jobs need to have the “variable resolution at runtime” flag set. Possible alternatives to the job log variable use can be the use of the JSONresult variable (${this.JSONResult}) in restful jobs that, contains the JSON file received in answer by the service or the value filtered for a specific tag indicated in the advanced section of the RESTful job definition; a variable named after the column label in your SQL query for the database job type can be used as another example.
 
Imagine now that two different branches are not enough for your requirements, but you need to implement multiple branches like in the next use case…
​We created seven different output conditions not affecting the job status for the parent job and then set seven different conditional dependencies, one for each output condition, to implement the multiple branching flow.
 
Ok, we learnt how to branch the flow in a job stream, is it possible to join the branches? Yes, it is explained in the next use case.
The job on the bottom of the figure is depending on a special dependency type: the join dependency. It’s possible to add into the join dependency one or more jobs and set the resolution criteria to “all completed successfully” or “one completed successfully” or in general some of them in the number you desire. If your branches are mutually exclusive and you put 1 out of 7 like in the figure it’s sufficient that one branch only completes successfully to release the last job (the other branches are suppressed).
 
We are at the end of our journey into logical branching for job streams but before leaving remember that if you need to add a sequence of more than one job in each branch you need to concatenate the parent-child jobs with a conditional dependency activated by the SUCC state of the parent job. You really need this trick because the first job of a chain in a branch that is not pursued will be suppressed and the default behavior in classical dependency definition is to release the child job for execution so, the second step of the chain will start to execute while your desired result is to have the entire branch pipeline suppressed! Forcing the dependency to be released only in presence of a SUCC state of the parent job will cause a cascade suppression of the jobs in your branch as desired.
 
Happy conditional logic designing!

Author

Riccardo Pizzutilo is a Presales Technical Specialist for Workload Automation at HCL Riccardo has joined the Workload Automation family since 2005 at the IBM Rome Tivoli lab as QA engineer when the version 8.3 was under development. After thousands of defects found (and fixed) he joined the L3 team and then moved to HCL in a presale’s role, guiding customers from all over the world into their continuous transformation. This is not Riccardo’s first ASAP conference; he enjoyed the ASAP atmosphere even in 2014.
Riccardo is a talkative person and he’s available to have a conversation around IBM/HCL Workload Automation with you. He is also travel addicted, he has been on all continents of the world, loves tasting food and baking cakes: be prepared to learn about tech & food secret recipes!  


Viewing all articles
Browse latest Browse all 201

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>