How to call a step (doing revert) if any previous step fails? - argo-workflows

I have the Argo WorkflowTemplate which has n steps.
I want to call last step only if any of the previous step fails.
Example: In a 5 steps templates, if 2nd fails, skip 3 and 4 and only call 5 since its a revert step. If all are passed, don't call 5th because there is no need to revert.

You can define a workflow exit handler to run after all the other steps.
By adding a when condition, you can make sure the exit handler runs if and only if one of the previous steps failed.

Related

Abort second job activity if first one aborts

I want abort 2nd job activity if 1st job activity aborts due env. issue or manual abortion.
I gone through the triggering option but couldn't get.
Can anyone help me ?
OK, You can't abort a job without running it. So you would need to be able to invoke Job 2 with knowledge of Job 1 status (e.g. from activity variable Job1.$JobStatus). This could be used to cause Job 2 to abort.
The cleanest solution would be a before-job subroutine, which sets its return code to 0 if Job 1's status was DSJS.RUNOK or DSJS.RUNWARN (these are DataStage constants), or to a non-zero value if Job 1's status was DSJS.RUNFATAL or any other value. This is the cleanest approach because the before-job subroutine could write a message to the job log indicating precisely why the job was being aborted.
A less clean way would be to have a parameter in Job 2 of type, say, Integer (anything other than string), and set its value in the Job Activity using an expression such as If Job1.$JobStatus = DSJS.RUNFATAL Then "" Else 1 - setting a non-string parameter to "" will cause the job to abort with DSJE.PARAMBADVALUE error.
You will need to show us exactly what you did. The use of trigger, which I explained earlier, is the correct solution. If you did it correctly, the arrow on the design canvas should be red.
Alternatively you could change your sequence to bypass Job 2 entirely, and instead simply log a message that Job 2 was being bypassed because Job 1 aborted.

How to configure workflow runtime (Informatica)?

I would like the workflow to run for 20 minutes....If the running process does not complete within 20 minutes, the workflow should be ended immediately..However, I can only find the timer, but it is used for starting the process after the indicated time which is not I'm looking for...Does anyone know how to specify the duration for the workflow?
[updated to cover complete scenario and cover issues raised by Koushik Sinharoy in comments]
You can achieve it using the timer:
Link one to the Start task and set it to run for 20 minutes in
parallel with your session.
Have a Decision task with Treat the input links as set to OR. This will trigger the decision whenever any of the preceeding task ends, so either your session will get completed or timer runs out (whatever happens first).
Set the Decision condition to $s_your_session.Status = SUCCEEDED.
Link the Decision task to Control Task.
Set Control task to Fail parent.
Add a condition $Decision.Condition = False to the link between Decision task and Control task.
This should be the result:
Start--->s_your_session--\
\ > Decision [OR] ---(False)---> Control Task [Fail parent]
\-->timer-----------/
Thanks Koushik Sinharoy for the remarks below!

How to figure out when Azure DevOps release pipeline is over using REST Api?

I have a script that triggers a Build. That build is followed by a Release pipeline. In my script I can figure out what is the url for the Release, but I do not understand how can the script decide when the release pipeline is done.
Suppose, there are no interactive approvals. Still:
The release status seems to be stuck on "active", does not matter if all the stages have already converged to some final status.
The stages can be "notStarted", "inProgress", "rejected", "cancelled" or "succeeded".
I suppose it is possible to figure things out by doing some analysis on the state of all the stages while taking into account the topology of the pipeline, but that seems to be too complicated.
Is it possible at all to wait in a script until some release gets into a final state, from which no change is possible?
EDIT 1
I am OK writing a polling loop. This is what I do to figure out when a build is over. But for releases, I have a problem with the stop condition - I just do not know what it is.
EDIT 2
Consider the following pipeline:
+---> A
/ \
Start + -[Promoted only if (*) is true]-> C ---> D
\ /
+---> B
(no manual approvals)
Now suppose the build does not satisfy the condition (*) and so the release effectively stops after running on A and B, but not C. The statuses on environments would be:
A = succeeded or rejected
B = succeeded or rejected
C = notStarted
D = notStarted
So, what is the stop condition for the waiting loop that would stop it in this situation? Is it possible to do it without discovering the topology of the release pipeline?
Unfortunately, there aren't any blocking API calls. You'll need to write a loop in (eg PowerShell) to check for changes in status.
There are two "status" fields in a Release.
The first is the overall status of a Release, for example, it was deployed into two environments before it was marked as "abandoned" and no longer a release candidate for production. You can set this status in the UI by selecting the Release and selecting "Abandon".
The second status is for each environment being deployed. Each ReleaseEnvironment has an EnvironmentStatus. Surprisingly, there isn't a "failed" state there, but you're interested in anything that isn't "notstarted" and is "succeeded". (Perhaps partiallySucceeded is an indicator that something failed without flagging the entire environment as failed?).
There is a third status that you might need to consider if you have pre-deployment or post-deployment approvals enabled. These are in the preDeployApprovals status (ApprovalStatus) and postDeployApprovals nodes.

How to call the controller task on each 1 min interval

I have created task on controller and there is loop which is loading for 100 times.
Now I want to load it for 25 times and pause that loop for 1 min and after that it will execute next 25 items same for next 25.
I have checked it with sleep but its not working.
Can you please advise me if is there any way on plugin event or any other method.
Thanks
This is actually unrelated to Joomla! Since you're creating a long running process you need to start it with something else than a browser. A CRON job is a good idea here if you want to execute this operation multiple times. Otherwise it can run via command line. Make sure the max_execution time setting of PHP does not cause any trouble.
If you still need this within Joomla please have a look at the CLI documentation.
https://docs.joomla.org/How_to_create_a_stand-alone_application_using_the_Joomla!_Platform

How to discard only the last element of CKEditor undo stack?

Is there a way to remove only the last snapshot in the CKEditor undo stack or can i replace it with another.Should i implement it on my own?
Example:
Step 1
Step 2 --should be removed and replaced with step 3 (On given situation)
Step 3 -- should become step 2
This feature should be available only if special event occurs.
If your undo snapshots are a result of user actions, following this way:
Step 1.
Step 2.
CKEDITOR.instances.editor.fire( 'lockSnapshot' )
Step 3.
CKEDITOR.instances.editor.fire( 'unlockSnapshot' )
Of course, you have to detect what's going on and fire the right event at the right time.
If changes to the content are done from code, editor#updateSnapshot event would even be better:
function() {
editor.fire( 'saveSnapshot' );
editor.document.body.append(...);
// Makes new changes following the last undo snapshot a part of it.
editor.fire( 'updateSnapshot' );
..
}