Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


sbandy
2013-12-05T22:38:38Z
In the absence of a Task Trigger, I was trying to work around it by employing a Job/Task Control. But I'm getting unexpected results.

This is my configuration:

JobA -> TaskA
JobB - > TaskB
JobC -> TaskC
JobD -> TaskD

Job1 -> Task1
Job2 - > Task2
Job3 -> Task3
Job4 -> Task4

Now, Jobs A,B,C,D need to be fired in a sequence.

So I created a Job Job1Group with following Job/Task Control Tasks:
RunJobA (runs JobA)
RunJobB (runs JobB)
RunJobC (runs JobC)
RunJobD (runs JobD)

Similarly, Jobs 1,2,3,4 need to be fired in sequence

So I created a Job Job2Group with following Job/Task Control Tasks:
RunJob1 (runs Job1)
RunJob2 (runs Job2)
RunJob3 (runs Job3)
RunJob4 (runs Job4)

The contraint is - JobB is dependent on successful completion of Job2.

To enable this, I added a Event Trigger for JobB with a VisualCron setting of "Job completed successfully" for Job2.

I kicked off Job1Group and Job2Group at the same time.

I was hoping that JobA will fire in Job1Group and will be waiting on JobB till Job2 in Job2Group finishes.

But I'm getting unexpected results.

All the tasks use a powershell script to write the active Job, Task and the current datetime to a file.

Task2 in Job2 has a wait of 10 secs before it writes its content to a file.


Job1Group tasks write to a file called Job1Group.txt and Job2Group tasks write to another file Job2Group.txt.

Both Job1Group and Job2Group were scheduled for 2013-12-05T14:43:00.

These is the content of Job1Group.txt

JobA , TaskA, 2013-12-05T14:43:00
JobB , TaskB, 2013-12-05T14:43:00 // This should not have bee written at 14:43:00
JobC , TaskC, 2013-12-05T14:43:00
JobD , TaskD, 2013-12-05T14:43:01
JobB , TaskB, 2013-12-05T14:43:10 // additional entry for JobB ??

Content of Job2Group.txt

Job1 , Task1, 2013-12-05T14:43:00
Job2 , Task2, 2013-12-05T14:43:00 // this is the task with 10 secs delay
Job3 , Task3, 2013-12-05T14:43:10
Job4 , Task4, 2013-12-05T14:43:11

Can you explain why I'm getting these results?

Also, I noticed that JobB was not waiting at all.
File Attachment(s):
vc_jobcontrol_sujay.zip (7kb) downloaded 53 time(s).
Sponsor
Forum information
Support
2013-12-06T09:00:40Z
I do not see how Job A and B should be waiting for each other. There are no such setting that enables waiting like that. Event triggers fire off at completion.

I think you are making it hard for yourself. You really have to have a good reason to split up Tasks that way instead of having a single Job with all dependent Tasks.

Why do you need to split up Task like this if they are dependent?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
sbandy
2013-12-06T14:06:28Z
Hi Henrik,

JobB from Job1Group has a trigger on completion of Job2 in Job2group.

So I was expecting that JobB will wait for completion of Job2, which had a 10 sec delay in its powershell script. But instead, JobB fired immediately.

That's what I was reporting.

The reason why tasks are in separate jobs is because they follow their own respective sequence. Adding tasks from one job to another to accomplish the dependency may not work for my client, because no parallelism is achieved (some of the tasks are long-running)

Support
2013-12-06T15:24:01Z
Originally Posted by: sbandy 

Hi Henrik,

JobB from Job1Group has a trigger on completion of Job2 in Job2group.

So I was expecting that JobB will wait for completion of Job2, which had a 10 sec delay in its powershell script. But instead, JobB fired immediately.

That's what I was reporting.

The reason why tasks are in separate jobs is because they follow their own respective sequence. Adding tasks from one job to another to accomplish the dependency may not work for my client, because no parallelism is achieved (some of the tasks are long-running)



But you wrote:

Quote:


I kicked off Job1Group and Job2Group at the same time.



It sounded like you started both manually instead of letting the Trigger on Job B start when needed.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
sbandy
2013-12-06T16:23:06Z
Sorry for the confusion Henrik.

By saying "I kicked off Job1Group and Job2Group at the same time", I meant I put a time trigger to start both Job1Group and Job2Group at the same time, in my example, I set a time trigger for both these at 14:43:00.

Feel free to look at my job settings in the export I've attached to my initial post.
Support
2013-12-06T19:27:54Z
I do not think you will get what you need with both a Time Trigger and event Trigger. Because they will not wait on each other. The event Trigger will be ignored if the the Job is already running unless you tell it too. You have to choose. This is why I recommend to merging these Jobs. You really have to good reason to split these up. Let me now why you want to split these up - this will help me understand what you are trying to achieve.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
bweston
2013-12-06T20:26:49Z
Originally Posted by: sbandy 

Sorry for the confusion Henrik.

By saying "I kicked off Job1Group and Job2Group at the same time", I meant I put a time trigger to start both Job1Group and Job2Group at the same time, in my example, I set a time trigger for both these at 14:43:00.

Feel free to look at my job settings in the export I've attached to my initial post.



The trigger to run Job B upon completion of Job 2 creates a circumstance that will cause Job 2 to run (in addition to being run by the RunJob2 task when it is reached by Job2Group), not an additional circumstance that must be true before the RunJob2 task will execute the job.

I have a couple of ideas of how to accomplish what you seem to want to have happen. Please be aware that I am still on version 6.2.2, so this is from a context of not having worked with Flows yet.

If I understand correctly, essentially what you need is for:

Task 1, 2, 3, 4 to run in sequence
Task A, B, C, D to run in sequence, but task B to be delayed until task 2 has completed if task 2 has not completed since task A was last started
Other than that restriction, because some of these are long-running tasks, they two sequences should run concurrently; this is why they are not all in the same job

...If I have that condition wrong, I apologize. I am in the process of trying to eliminate dependencies on timing between jobs myself, let alone between tasks (it's fun finding out that a job that runs in the middle of the night is written on the assumption that another job ran earlier in the night, but doesn't enforce it, when you try to reschedule one of them...)

Anyhow. This is the idea I like best (the other one involves Job Control tasks in a way I don't really care for)

Create a condition set, which you will use on Task 2. Add a Variable condition that
{TASK(<Task B's ID>,LastExited,yyyyMMddHHmmss)}
is (Int64) greater than
{JOB(Active|LastRun|yyyyMMddHHmmss)}

and configure the condition set so that if the condition is false, it waits for a bit and retries, and if it's true, it continues.

You might want to have some king of escape letting you know that something seems to have gone wrong in certain cases instead of letting that retry spin forever, though.
sbandy
2013-12-06T21:10:10Z
Thanks bweston. I think I understand why the event trigger isn't working in JobB. You're saying It's independently firing from the Time trigger set in Job1Group.

I was able to use conditions at the task level to accomplish this use case, but my client found it very complicated to configure using conditions and instead wants to ONLY use triggers. Hence, I was trying to use Job/Task Control and job level trigger to achieve this use case.

Thanks for your solution.

I guess Task level trigger will alleviate some of the config pain we have to go through for achieving Task level dependencies.
Support
2013-12-06T21:57:06Z
Yes, they are dependent by default. In version 7 you can create Trigger dependencies but then again I am not sure this is the best solution for you. I think the only reason to split up Tasks like that is that if any Task is taking very long time to complete.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
sbandy
2013-12-06T23:06:33Z
Henrik,

From bweston's post, I'm interpreting that the Event Trigger in JobB is INdependently firing from Job1Group's Time Trigger, even when JobB is part of the RunJobB Job/Task Control within Job1Group. Is this correct?

Yes. Tasks in different jobs because some of the tasks are long-running and client needs parallel execution between such jobs.
Support
2013-12-09T08:52:41Z
Originally Posted by: sbandy 

Henrik,

From bweston's post, I'm interpreting that the Event Trigger in JobB is INdependently firing from Job1Group's Time Trigger, even when JobB is part of the RunJobB Job/Task Control within Job1Group. Is this correct?

Yes. Tasks in different jobs because some of the tasks are long-running and client needs parallel execution between such jobs.



Yes, if you have two Triggers they will be independtly by fired (by default).

I think you should test the Trigger dependency option. The risk with that usage is that it is more error prone as you give a time window when it is possible for trigger the Jobs based on the two time triggers. When out of that time window the dependency will be reset and then wait for next time window.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
sbandy
2013-12-09T15:16:15Z
Henrik,

I'm not sure how I can use Trigger Dependency for my case.

I have a Time Trigger (starting at same time) in both Job1Group and Job2Group and a Event Trigger in JobB (via Job/Task Control) inside Job1Group.

I guess Trigger dependencies can ONLY be setup between trigger defined for a specific Job.
Support
2013-12-09T19:30:01Z
Originally Posted by: sbandy 

Henrik,

I'm not sure how I can use Trigger Dependency for my case.

I have a Time Trigger (starting at same time) in both Job1Group and Job2Group and a Event Trigger in JobB (via Job/Task Control) inside Job1Group.

I guess Trigger dependencies can ONLY be setup between trigger defined for a specific Job.



Maybe not then. I think, in your case, Conditions is the only way to accomplish this. To create a Condition that waits for something, before continuing. Could be a Variable that you set with Set Variable Task when something is complete.

I looked at your sample. I hope it is only a test because it makes no sense to put one Task in each Job and then call them with Job/Task control Task.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
sbandy
2013-12-09T20:13:49Z
Henrik,

In the sample I attached, I was testing the Event Trigger for a job containing a task (since task-level trigger is not possible). Hence the configuration.

At the time of config I didn't know that Time Trigger set in Job1Group and the Event Trigger set in JobB referenced in RunJobB job/task control within Job1Group, will fire independently.

Based on your advice and bweston's input it does seem like Conditions will solve this use case. I'll bring this to my client's attention and go from there.

Any timeline for the task-level trigger enhancement?
Support
2013-12-10T22:23:48Z
Originally Posted by: sbandy 

Henrik,

In the sample I attached, I was testing the Event Trigger for a job containing a task (since task-level trigger is not possible). Hence the configuration.

At the time of config I didn't know that Time Trigger set in Job1Group and the Event Trigger set in JobB referenced in RunJobB job/task control within Job1Group, will fire independently.

Based on your advice and bweston's input it does seem like Conditions will solve this use case. I'll bring this to my client's attention and go from there.

Any timeline for the task-level trigger enhancement?



Personally I do not see the point in "Task level trigger enhancement". You achieve the same thing by putting one Task in one Job. Please explain the technical difference it would give you?

I would be happy if bweston or someone else gave his feedback because I do not think I get this request.

As I see it, what you want will not be solved through just a Trigger on Task level - I think it is a misunderstanding on how the product works.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
sbandy
2013-12-11T01:55:51Z
I'm thinking the same use case could be setup as follows:

Job1Group
|--TaskA
|--TaskB (dependent on successful completion of Job2Group Task2)
|--TaskC
|--TaskD

Job2Group
|--Task1
|--Task2
|--Task3
|--Task4

Both Job1Group and Job2Group are scheduled to start at same time.

When Task level trigger is available, I'll create an Event Trigger on Task B for Job2Group Task2 being successfully completed.

Is this interpretation not correct?
Support
2013-12-12T14:27:59Z
Originally Posted by: sbandy 

I'm thinking the same use case could be setup as follows:

Job1Group
|--TaskA
|--TaskB (dependent on successful completion of Job2Group Task2)
|--TaskC
|--TaskD

Job2Group
|--Task1
|--Task2
|--Task3
|--Task4

Both Job1Group and Job2Group are scheduled to start at same time.

When Task level trigger is available, I'll create an Event Trigger on Task B for Job2Group Task2 being successfully completed.

Is this interpretation not correct?



Yes, but then it is better to create Job3Group with Task B,C,D what uses a VisualCron Trigger on Job2Group (with Task1 and 2).
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
bweston
2013-12-13T15:41:28Z
Even with Task-level triggers (whether that means triggers that are specific to tasks instead of to jobs or a trigger for "Task Completed Successfully" like the existing one for "Job Completed successfully"), I can't see a way to do this without either using conditions or breaking up the tasks among jobs in a different way...

That said, I THINK this might have the desired result without using conditions - I have not tried a test case though:

Job: Number Series Start (NO TRIGGER)
|--Task1
|--Task2

Job: Letter Series Start (NO TRIGGER)
|--TaskA

Job: Letter and Number Series Scheduler (TIME TRIGGER) - UNCHECK "Run tasks in order" in Main Settings
|--Job Control: Run Number Series Start (make sure "Run synchronous" is checked)
|--Job Control: Run Letter Series Start (make sure "Run synchronous" is checked)

Job: Number Series Finish (TRIGGER: Job Completed Successfully - Number Series Start)
|--Task3
|--Task4

Job: Letter Series Finish (TRIGGER: Job Completed Successfully - Letter and Number Series Scheduler)
|--TaskB (dependent on successful completion of Job2Group Task2)
|--TaskC
|--TaskD

Does that make sense? To me, it isn't really easier to understand than using conditions, but it's the most concise approach I can come up with that doesn't.
Scroll to Top