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


Gary_W
2017-05-17T15:09:22Z
I am looking for some guidance please on how to set up a process. I need to launch 4 queries at the same time. Each query will create an excel file.
When they are all done I'll need to send an e-mail that files are ready.

Do I set each "query to file" process up as a separate job, with a master job that calls all 4?
Or do I create 1 job that loops, launching a "query to file" task asynchronously somehow?

Whatever method, I'll need to wait at the end until all are complete in order to send an e-mail that files are ready.

I'm running version 8.2.6 and am maybe advanced beginner to intermediate experience level so type slow as I can't read fast. :-/

Thank you for any guidance you can give me.
Sponsor
Forum information
al355
2017-05-18T06:10:32Z
By query you mean SQL database queries?
ErikC
2017-05-18T06:23:53Z
Hi Gary,

I think the best way to go here is to make one main job kicking of one other job having the 4 query tasks in there. You can remove the 'Run tasks in order' to run the four queries at the same time. You will get four Excel files after the queries are done.
In main job, you have a 2nd task with a condition. This condition checks if the query job isn't running anymore. Let it wait a few min/sec before checkin again, so the action is retry.
If the query job isn't started in a blitz, you could add a wait task in the main job for a second or so before having the task wit the condition on it.

Good luck setting it up!

Regards,
Erik
Uses Visualcron since 2006.
thomas
2017-05-18T08:57:12Z
Eric, why do you need a condition in the second task of the main job? The main job has two tasks that run synchronously. The second task will wait until the first task is done, even if the first task is a job that does a lot of async stuff.

I just tested it with a job that has three sleep tasks that run async. The popup is displayed when all is done. Or am I missing something?

Capture.PNG
ErikC
2017-05-18T09:09:33Z
Originally Posted by: thomas 

Eric, why do you need a condition in the second task of the main job? The main job has two tasks that run synchronously. The second task will wait until the first task is done, even if the first task is a job that does a lot of async stuff.


You are right. The 'Job/Task control' task has an option 'Run synchronous (wait for completion)'.

Easier to setup, thanks.
#Hard ToRemeberAllSettings

Regards
Erik

Uses Visualcron since 2006.
Gary_W
2017-05-18T14:30:55Z
Thanks for the info. Here's where I'm at since I posted my original question. I have a job for each extract that performs a query from the database and writes data to an Excel file. That works fine and I want to keep the jobs separate in case they need to be run separate. I then created a main job that runs the extract jobs asynchronously and that part runs fine. The part I'm now stuck on is the e-mail at the end which should be sent only when all extracts are done.

I'm not sure if I should make that conditional on all extracts being done, or set up a third job that calls the "run all extracts" job, followed by the e-mail (popup for testing) job.

In the screenshot below, the extract jobs all have "run synchronous" unchecked and thus the popup displays right away even though an extract is still running. I'm having a hard time getting my head around setting up the conditional rules on the e-mail task for multiple previous tasks to be complete before running the e-mail task. I would think it's possible, but maybe it's easier as I mentioned to set up a third job that runs the "run all extracts" as a task, followed by the e-mail task?

Thanks for sticking with me here.

UserPostedImage

EDIT: Thanks for your help, I left it configured as in the screenshot, and figured out the proper condition set and actions for the e-mail task. All works as expected now. I had to point the conditions at the extract jobs, not at the tasks in the "run all extracts" job as those return right away since they are asynchronous. The condition set has 4 checks for all jobs running to be false (done) and the actions look like this:
UserPostedImage
Gary_W
2021-12-08T23:47:03Z
You know you've been at it way too long when you beat your head against the wall all day trying to figure something out, then give up and search, only to find your own answer from 5 years ago that fixes the problem! BWAAHAHAHAAAA!

Support
2022-01-11T14:28:35Z
Originally Posted by: Gary_W 

You know you've been at it way too long when you beat your head against the wall all day trying to figure something out, then give up and search, only to find your own answer from 5 years ago that fixes the problem! BWAAHAHAHAAAA!



:D

Michael
Support
http://www.visualcron.com 

Please like  VisualCron on facebook!
Scroll to Top