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!
Related
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.
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.
I'm trying to create an agent statechart where a transition should happen every day at 4 pm (except weekends).
I have already tried:
1. a conditional transition (condition: getHourOfDay() == 16)
2: A timeout transition that will "reinsert" my agent into the chart every 1 s and check if time = 16.
My code is still not running, does anyone have any idea how to solve it?
This is my statechart view. Customer is a single resource that is supposed to "get" the products out of my stock everyday at 4pm. It is supposed to happen in the "Active" state.
I have set a timeout transition (from Active-Active) that runs every 1s.
Inside my "Active" state in the "entrance action" i wrote my code to check if it is 4 pm and run my action if so.
I thought since i set a timeout transition it would check my condition every 1s, but apparently it is not working.
Your agent does not enter the Active state via an internal transition.
Redraw the transition to actually go out of the Active state and then enter it again as below:
Don't use condition-based transitions, for performance reasons. In your case, it also never triggers because it is only evaluated when something happens in the model. Incidentally, that is not the case at 4pm.
re your timeout approach: Why would you "reinsert" your agent into its own statechart? Not sure I understand...
Why not set up a schedule or event with your recurrence requirement and make it send a message to the statechart: stateChart.fireEvent("trigger!");. In your statechart, add a message-based transition that waits for this message. This will work.
Be careful to understand the difference between the Statechart.fireEvent() and the Statechart.receiveMessage() functions, though.
PS: and agree with Felipe: please start using SOF the way it is meant, i.e. also mark replies as solved. It helps us but also future users to quickly find solutions :-) cheers
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
I have a few jobs setup in Quartz to run at set intervals. The problem is though that when the service starts it tries to start all the jobs at once... is there a way to add a delay to each job using the .xml config?
Here are 2 job trigger examples:
<simple>
<name>ProductSaleInTrigger</name>
<group>Jobs</group>
<description>Triggers the ProductSaleIn job</description>
<misfire-instruction>SmartPolicy</misfire-instruction>
<volatile>false</volatile>
<job-name>ProductSaleIn</job-name>
<job-group>Jobs</job-group>
<repeat-count>RepeatIndefinitely</repeat-count>
<repeat-interval>86400000</repeat-interval>
</simple>
<simple>
<name>CustomersOutTrigger</name>
<group>Jobs</group>
<description>Triggers the CustomersOut job</description>
<misfire-instruction>SmartPolicy</misfire-instruction>
<volatile>false</volatile>
<job-name>CustomersOut</job-name>
<job-group>Jobs</job-group>
<repeat-count>RepeatIndefinitely</repeat-count>
<repeat-interval>43200000</repeat-interval>
</simple>
As you see there are 2 triggers, the first repeats every day, the next repeats twice a day.
My issue is that I want either the first or second job to start a few minutes after the other... (because they are both in the end, accessing the same API and I don't want to overload the request)
Is there a repeat-delay or priority property? I can't find any documentation saying so..
I know you are doing this via XML but in code you can set the StartTimeUtc to delay say 30 seconds like this...
trigger.StartTimeUtc = DateTime.UtcNow.AddSeconds(30);
This isn't exactly a perfect answer for your XML file - but via code you can use the StartAt extension method when building your trigger.
/* calculate the next time you want your job to run - in this case top of the next hour */
var hourFromNow = DateTime.UtcNow.AddHours(1);
var topOfNextHour = new DateTime(hourFromNow.Year, hourFromNow.Month, hourFromNow.Day, hourFromNow.Hour, 0, 0);
/* build your trigger and call 'StartAt' */
TriggerBuilder.Create().WithIdentity("Delayed Job").WithSimpleSchedule(x => x.WithIntervalInSeconds(60).RepeatForever()).StartAt(new DateTimeOffset(topOfNextHour))
You've probably already seen this by now, but it's possible to chain jobs, though it's not supported out of the box.
http://quartznet.sourceforge.net/faq.html#howtochainjobs