Until flag not working with Until activity of ADF and loop keep going - azure-data-factory

I'm trying to execute Azure Durable Function in ADF.
I have "Get Current Function Status" Activity inside Until activity. Possible value are pending, completed, running and exception. I have variable until_flag which do get value "true" if runTimeStatus get value Completed.
My problem is that even runTimeStatus is completed Until loop never stop. It keeps going. What is wrong?
I'm following tutorial https://www.youtube.com/watch?v=aD3k8k5sdao
I have tried:
#equals(bool(variables('until_flag')), 'true')
and
#bool(variables('until_flag'))

If you look into the official MS docs on UntilActivity
Enter an expression that will be evaluated after all child activities
defined in the Until activity are executed. If the expression
evaluates to false, the Until activity will execute all its child
activities again. When it evaluates to true, the Until activity will
complete. The expression can be a literal string expression, or any
combination of dynamic expressions, functions, system variables, or
outputs from other activities.
So try with this expression to evaluate condition
#equals(variables('until_flag'), 'false')

Related

How to build OR-behavior into Azure Synapse pipelines?

I have a pipeline in Synapse that reloads data from a number of REST-endpoints. It looks as follows:
What I want to achieve is that the 'CheckAccessTokenValidity' activity checks whether my API-token is still valid. If yes, all is fine, proceed to ForEachDivision activity. If no, refresh tokens, Proceed to ForEachDivision activity.
I thought I had implemented this logic in the screenshot provided. However, this is not the case. My pipeline is now deadlocked because the ForEachDivision apparently expects all three preceding activities to be succesful before running (Which is impossible by design).
How do I implement the logic described above in Azure Synapse?
You can modify your pipeline and accommodate following changes:
Create a variable 'var1' , by default set it to 'False'
After 'CheckAccessTokenValidity' , add set variable activity 'set variable1' pointing to 'var1' and set its value as 'True'
After SetRefreshToken , add another set variable activity 'set variable2' pointing to same 'var1' and set its value as 'True' , so that either of the step 2 or 3 can turn the value of variable to 'True'.
Remove all activities starting ForEach block from this pipeline and cut paste those activities and keep in another new pipeline 'pipeline2'
After 'set variable2' activity, attach an If activity with 'success' and 'Skipped' conditional path . If step 2 gets successful, 'set variable2' would be skipped and it will call the next activity that is 'Step6' . If step 2 fails, and step 3 is called, it will call 'set variable2' and after its success, Step6 will be completed.
In this if activity, write the condition to check the value of var1 . If var1=='True' , then execute the 'pipeline2'

How to set expression for Until activity in Azure Data Factory? - String does not match

I'm trying to execute Azure Durable Function in ADF.
I have "Get Current Function Status" Activity inside Until activity.
Possible value are pending, completed, running and exception.
I wish to execute Until runtimeStatus Completed or Exception is reached.
It this possible to do following way or should I create flag variable?
I try to set expression, but getting warning "String does not match" :
or(equals(activity('Get Current Function Status').output.runtimeStatus,'Pending'),
equals(activity('Get Current Function Status').output.runtimeStatus,'Running'))
Can you try the below expression, there are few tweaks.
#or(equals(activity('Azure Function').output.runtimeStatus,'Pending'),equals(activity('Azure Function').output.runtimeStatus,'Running'))

How to add custom pipeline in azureDevops

i have create CI/CD pipeline in azureDevops.
i need to add custom condition for when only previous task succeeded then it will execute.
so please help me
what i have to write in Custom condition ?
I have attached below screen short where i need to add some custom condition.
i need to add custom condition for when only previous task succeeded then it will execute.
There is directly option Only when all previous tasks have succeeded, which is used to determine if all the previous tasks have succeeded.
If you want to give the condition that just when only the one previous task succeeded, there is no such out of box option to use. We could use the workaround that Napoleon answered:
write the result of the previous task to a variable and then check that variable in your condition
In addition, I posted this answer to emphasize the choice of conditions, we need use always() not succeeded() or failed(). That because the syntax of condition is for all previous steps/jobs:
Check the document Conditions for some more details.
For example:
I add three tasks in my pipeline:
Command line-Intentionally let it run failed
Run Inline Powershell-create a variable, assign it a value.
Write-Host "##vso[task.setvariable variable=TaskStatus;]Succeeded"
Command line-Custom Condition checking that variable.
and(always(), eq(variables['TaskStatus'], 'Succeeded'))
If we use the condition succeeded() or failed(), whether its execution is still affected by all previous task execution results (First command line task.)
Hope this helps.
You could write the result of the previous task to a variable and then check that variable in your condition.
i have found some custom condition which has fulfill my desire task.
in(variables['Agent.JobStatus'], 'Failed', 'Succeeded', 'SucceededWithIssues')
in above custom condition for if the prev task will 'failed' or 'succeeded' next task will executed.

Azure Data factory: How to update the pipeline parameter (flag) inside the pipeline

I have initialized a pipeline parameter, lets say a flag, with a value ('true'). Now inside the pipeline I want to update the flag value based on some condition.
So lets say I have a web activity inside the pipeline, I want to update the value of that flag to 'false' if i dont get the response from the web activity.
Any idea how to do that?
You could try #empty(body('web1'))
So if I understand correctly you want to call a Web activity from your pipeline and if there is no response then set a variable?
In this case, could you not just set a low timeout and use a "Set Variable" activity on the Fail condition? So if there was no response it would fail and set the variable

How to perform a conditional test within a Talend job?

I am looking to trigger a series of processes, and I want to tell if each one succeeds or fails before starting the subsequent ones.
I am using tSSH (on Talend 6.4.1) to trigger a process and I only want the job to continue if it is a success. The tSSH "component" doesn't appear to fail if it receives a non-zero return code, so I have tried using an assert. However, even if the assert fails, it doesn't appear to prevent the component and subjob being "OK" which is a bit odd, so I can't use on-(component|subjob)-ok to link to the next job.
I don't seem to be able to find any conditional evaluation components which will allow me to stop the continuation of the job or subjob based on the evaluation result.
The only way I can find is to have
tSSH1 --IF globalMap.get("tSSH_1_EXIT_CODE").equals(0)--> tSSH2...
--IF !globalMap.get("tSSH_1_EXIT_CODE").equals(0)--> (failure logging subjob)
which means coding the test twice with negation.
Am I missing something, or are there no such conditional components?
you can put a if condition on tSSH component for success /failure using global variable of tSSH component i.e.
((String)globalMap.get("tSSH_1_STDERR")) and ((String)globalMap.get("tSSH_1_STDOUT")).
if condition you can check is :
if(((String)globalMap.get("tSSH_1_STDERR")) != null) than call error log
else call tSSH2.
Hope this helps...