|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Best way to cause scheduled tasks to run consecutively?
Author: Rick Faircloth
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56515#306036
Thanks for the info, Dana!
Definitely something to keep in mind...
Rick
> One thing to note about manually calling files that you wanted to be
scheduled tasks.... If you do
> things this way then the admin logging of scheduled tasks will no longer
record the information
you may
> have wanted it to. Just a consideration to keep in mind. If the task itself
does any kind of
logging I
> suppose this would be redundant, however I point it out as I didn't see it
mentioned.
>
Author: Dana Kowalski
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56515#306034
One thing to note about manually calling files that you wanted to be scheduled
tasks.... If you do things this way then the admin logging of scheduled tasks
will no longer record the information you may have wanted it to. Just a
consideration to keep in mind. If the task itself does any kind of logging I
suppose this would be redundant, however I point it out as I didn't see it
mentioned.
Author: Rick Faircloth
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56515#306028
> Have each task schedule the next one at the end of its precess.
That's a good approach to look into... (and much simpler than
trying to understand and implement stored procedures when I'm under
and extremely tight deadline! :o)
I like the idea of rolling a specific query back if it fails part
way through. These queries are simply transferring data from temp
tables to production tables each day. If a query should only transfer
part of the data, I'd like to remove all data that that particular query
was handling from the table and run it later, or perhaps just restart
the query.
Would cftransaction be advisable for this?
Thanks, Claude...
Rick
> >>What's the best approach for that?
>
> Have each task schedule the next one at the end of its precess.
>
>
Author: Claude Schneegans
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56515#306027
>>What's the best approach for that?
Have each task schedule the next one at the end of its precess.
Author: Rick Faircloth
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56515#306026
Thanks, Rex and Mary Jo...
I figured the call would be something rather obvious, but didn't
want to make any assumptions without getting input.
This will be my *first* opportunity to work with a stored procedure.
Well, not opportunity, but situation where it's really called for.
I'll do some digging in the MySQL 5 docs on that and see what I can do.
Thanks, again!
Rick
----- Excess quoted text cut - see Original Post for more -----
Author: rex
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56515#306022
Since a CF Scheduled task is basically just a call to a webpage, just
put a <CFLOCATION> in your code.
So, your scheduled task will be calling task1.cfm, and the last part of
your code would be a <CFLOCATION URL=" task2.cfm" />
If you are only doing queries, the best way to do it would be on the SQL
side. A stored procedure as a SQL job would be the way to go. That
way, you can wrap everything around a transaction and rollback when it
breaks. It'll be faster, plus if you use a CF Scheduled Task, you will
be breaking out your queries and you cannot do CFTRANSACTIONs.
And, yes, even though you can still do regular transactions, bear in
mind that if your CF errors out with open transactions you will run into
locking issues. Doing this on the database side is the best way to
approach this.
Rick Faircloth wrote:
----- Excess quoted text cut - see Original Post for more -----
Author: Mary Jo Sminkey
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56515#306021
> The processes aren't dependent upon one another, they are just
> long-running
> and rather processor intensive so I don't want any concurrent tasks
> running.
Ah, well in that case B would probably work fine. I was assuming they were
dependent. You certainly wouldn't want to put a bunch of independent queries into
a cftransaction. I was thinking more along the lines of if Task A has run and
then Task B gets interrupted for whatever reason (let's say the server locked up
during the task, ran out of memory, whatever) when it was rebooted do you have to
keep track of the fact that you were on Task B, i.e. is it important that you
start where you left off? If that isn't an issue, and it doesn't sound like it
is, you are probably fine just setting up the tasks to run at specific intervals.
What you might want to do is just grab the tickcount when they run and monitor
how long they are taking, especially if the data will be growing over time.
--- Mary Jo
Author: Rick Faircloth
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56515#306020
Thanks, Mike and Mary Jo...
Questions:
I'm not able to think of how to code a task to "call"
another... nothing's coming to mind. How would I accomplish that?
Also, the logic to insure a previous task completed... such as
a variable that is set to "true" or something like that?
And, Mary Jo, concerning rollback...would cftransaction be appropriate?
The processes aren't dependent upon one another, they are just long-running
and rather processor intensive so I don't want any concurrent tasks running.
If I were to put all tasks into one long file and put them into a single
named thread, would that be a good approach? Problems with that?
Thanks for the suggestions!
Rick
----- Excess quoted text cut - see Original Post for more -----
something
> happens to halt processing in the middle, like a server reboot, and whether
you need some kind of
> rollback or running counter for which tasks have been completed in the event
of something like
that
> happening.
>
> MJS
>
>
Author: Mary Jo Sminkey
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56515#306017
>[A] make one task, that in turn calls all the others, one after the
>other. Perhaps with some logic in each to ensure the previous task
>completed successfully, if that's appropriate.
I would go with A as well. Be sure to also consider what needs to happen if for
any reason something happens to halt processing in the middle, like a server
reboot, and whether you need some kind of rollback or running counter for which
tasks have been completed in the event of something like that happening.
MJS
Author: Mike Kear
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56515#306016
G'day Rick,
There are two ways I could think of to do it
[A] make one task, that in turn calls all the others, one after the
other. Perhaps with some logic in each to ensure the previous task
completed successfully, if that's appropriate.
[B] give each task an identical interval, but long enough to allow all
teh others to run with a space for safety's sake, and starting at
staggered times. e.g.:
task 1, every 5 minutes, starting at 10am
task 2, every 5 minutes starting at 10:02am
task 3, every 5 minutes, starting at 10:03am
task 4, every 5 minutes, starting at 10:06am etc.
The start time would be based on teh average length of time the
previous task runs, plus a margin to ensure the task starts after the
previous one is finished.
Of the two, I prefer [A]. The other method relies on everything
happening properly and if something goes wrong, your sequence will go
haywire.
Cheers
Mike Kear
Windsor, NSW, Australia
Adobe Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month
----- Excess quoted text cut - see Original Post for more -----
Author: Rick Faircloth
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:56515#306015
Hi, all...
Yes, I'm having to work this Memorial Day weekend to meet
some deadlines.
I need to set up a series of scheduled tasks and insure that
they run consecutively. In other words, I need to make sure that
each one completes before the next one starts.
What's the best approach for that?
I hesitate to put all the tasks (a series of queries, actually) in
one large file, preferring to let the server run separate tasks...but
perhaps with a pause routine in between the queries it wouldn't matter?
Thanks for any advice.
Rick
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||