What is a good way to define and declare job dependencies on rundeck? - jobs

On rundeck workflow scheduling, I want to configure a workflow like this.
Job Step 1 : returns status "success" Job Step 2 : checks return
status of {Job Step 1} (as "success") and proceeds
Am not sure if adding a flow control attribute like this solves the problem
Question 1:
At Job Step 1, I can return the job status as follows, but how do I check this status at another job step?
(some shell cmd)
if [ $? -eq 0 ]; then
exit_code="success"
else
exit_code="failure"
fi
echo $exit_code
Question 2: Is there a way to do this across jobs/workflows in the same/different project?

Flow Control and Job State Conditional allow you to use a custom exit status in one job, and have another job test the exit status of a job. However, these work across independent Jobs, not within a workflow.
If you want Step 2 to depend on Step 1 of a workflow being successful, right now you would have to set the workflow to "keepgoing on failure=false", which will exit the workflow as soon as Step 1 fails.

Related

How to utilize the batch function with multiple inputs to receive one agent from each input to meet the batch?

I have 8 inputs that I would like to combine to one agent using the batch block. All the inputs have the same flow rate (1 per minute) and I would like them all to deliver one and only one agent to the batch so all inputs deliver one agent for the batch to be complete.
I have tried to use a delay and queue to manually restrict flow but that has not worked. I got an error saying cannot restrict flow but I have the inputs set "agents that cant exist are destroyed".
I also looked into trying to use a function but have not come across one that makes sense in my problem. Any help would be appreciated!
In a very primitive way you can build the following model:
You will define the HOLD block as follows:
The function will check that each queue has at least one agent ready and then release agents from each HOLD block:
if (queue.size() > 0 &&
queue1.size() > 0 &&
queue2.size() > 0 &&
queue3.size() > 0 &&
queue4.size() > 0 &&
queue5.size() > 0 &&
queue6.size() > 0 &&
queue7.size() > 0 )
{
hold.unblock();
hold1.unblock();
hold2.unblock();
hold3.unblock();
hold4.unblock();
hold5.unblock();
hold6.unblock();
hold7.unblock();
}
Every time an agent arrives you call the function() under the onAtExit event of your sources.

How to give a slave/node as a dynamic parameter in hudson?

I have a list of jobs(say 20) in hudson, which are run in sequence(Job1,2,3,....20) and which are parameterized(parameters given for job1 are passed to other jobs) .
All the jobs run on a node, say 'A'.Now if i wan't to run the same 20 jobs next time on server 'B', I have to go to each job's configuration matrix and change the node from 'A' to 'B'. Since I have 20 jobs, I've to do this tedious job of changing the node 20 times. Is there a way to give the node as a parameter when starting job1, so that i don't have to do put in a lot of effort everytime?
We have one plugin Link : https://wiki.jenkins-ci.org/display/JENKINS/NodeLabel+Parameter+Plugin which allow to use NODE as Parameter
And in First job you can use the option in post-build action "Trigger Parameterized build on other projects" and then try to pass the node parameter to next job.

Autosys: Concept of Kick Start Attribute and how to use

i have a daily( 09:00am) box containing 10 jobs inside it. All child jobs are sequentially scheduled to run.
On Monday, jobs 1,2 &3 completed and job4 failed. And coz of this, the downstream is stalled and the box is running infinetly( until some actions taken manually)
But the requirement is to run this box again on Tue 09:00am. I heard of Kickstart attribute to kick off the box on next scheduled time irrespective of last run status.
Can someone tell about this kick_start attribute? Also suggest me any other way to schedule this box daily.
TIA
Never heard of the kick_start attribute and could not find it in the R11.3.5 reference guide.
I would look at the box_terminator: y that will fail the box if a job in it fails and the job_terminator: y that will terminate and fail a job if the box it is in fails.
box_criteria is another attribute that may help as you can define what success or failure looks like. For example if you don't care if job4 fails, define box_criteria: s(job3).
Course that only sets your box to FA where it will run the next time it's starting conditions are met. It does nothing to run the downstream for the current run.
Have fun and test, test, test.

How to prevent execution of a waf task if nothing changes from the last successful execution?

I have a waf task that is running a msbuild in order to build a project but I do want to run this only if last execution was not successful.
How should I do this?
Store in your build.env.MS_SUCC = 1 and retrieve the value from the previous build (for the first time you naturally have to check if the dict item MS_SUCC exists)

SSIS execute package task - retry on failure on child package

I have a SSIS package which calls a number of execute package tasks which perform ETL operations
Is there a way to configure the Execute package tasks so that they retry a defined number of times (currently, on the failure of one of the tasks in the child package, the execute package task fails. When this happens, I would like the task to be retried before giving up and failing the parent package)
One solution I know of is to set a flag for each package in the database, set it to a defined value on success and call each package in a for loop container till the flag is successful or the count exceeds a predefined retry count.
Is there a cleaner or more generic way to do this?
Yes, put Execute Package Task in a For Loop Container. Define a variable, which will do the count, one for a successrun indicator and a MAX_COUNT Constance. In properties of the Package Task - Expressions, define
FailPackageOnFailure - False
After Execute Task put a Script Task Read/Write Vars: SuccessfulRun, script:
Dts.Variables["SuccessfulRun"].Value = 1
In properties of the For Loop:
InitExpression - #Val_Counter = 0
EvalExpression - #Counter < #MAX_COUNT && #SuccessfulRun == 0
AssingExpression - #Val_Counter = #Val_Counter + 1
Connect PackageTask with ScriptTask using Success line.
OR
In For Loop Container define expression
MaximumErrorCount - Const_MAX_COUNT
But this one hasn't been tested by me yet...