Author |
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: October 10 2009 at 17:00 | IP Logged
|
|
|
So - once in a really long while (a few times a year), PH hangs up. A reinit usually fixes it, but i saw one time that the re-init hung and I needed a reboot. So now when PH accumulates a few failures (which is as rare as a few times a year), it triggers a reboot of the PC.
It would be really nice to have a way to go back and automatically retry the failed tasks after the reboot. I essentially want to run the part of powerhome that "catches up" if it notices that PH was off-line, but I want it to go back to the time of the first failure.
Now - if there was a function to do this, like "ph_catchup(time)", it wouldn't be hard to code to capture the time of the first failure to global variable.
But I don't think this feature is user accessible, and I can't even begin to think of how to code it using the macro language (essentially "replay all scheduled tasks after time X, but don't bother with ones that are subsequently negated".
Anyone have any thoughts?
/j
Edited by jeffw_00 - October 10 2009 at 17:02
|
Back to Top |
|
|
device Newbie
Joined: May 26 2009
Online Status: Offline Posts: 33
|
Posted: October 18 2009 at 03:22 | IP Logged
|
|
|
I don't know if you mean general system events or events you created. Also I only write in VBScript so I do not know the difficulty of my suggestion in the macro language. I would find this straight forward in VBScript. The only way I can see to do this is to read the eventlog via SQL and look through it. If these events are yours then you can place a user message in the log saying the event has started. When the event completes then you could place another message in the log. These messages could give you more information about your events to make it easier to retry. You would exercise this at a reinitialization. You said you could mark the beginning of the errors so you would search through some number of log entries looking for this marker (you could bound it by some maximum number or finding the next reinitialization log entry). You may have to play a bit with parsing the entries as they just have a datetime, an event type, the event description and a sequence number
I wrote a VBScript back in May which read all the system table information and displayed all the tables and columns which could help in setting up your SQL. If interested, you can find that in a thread from May 28 about a VBScript example.
D
|
Back to Top |
|
|
device Newbie
Joined: May 26 2009
Online Status: Offline Posts: 33
|
Posted: October 18 2009 at 03:29 | IP Logged
|
|
|
Oops, should have said the referenced thread was in programming not general.
D
Edited by device - October 18 2009 at 03:30
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: October 18 2009 at 11:27 | IP Logged
|
|
|
Thanks device. My point was that PH already knows how to do this. There's an option that says "when I boot, I know the last timed event I executed, and I will catch-up on all events since that time". What I want to do is access that built-in function, but with my own "time".
This may be a "Dave" question. Dave? 8-}
/j
Edited by jeffw_00 - October 18 2009 at 11:27
|
Back to Top |
|
|
device Newbie
Joined: May 26 2009
Online Status: Offline Posts: 33
|
Posted: October 18 2009 at 22:28 | IP Logged
|
|
|
Always better to use someone else's code if you can.
In the spirit of the original request for "any thoughts". Since you are talking about timed events rather than what I discussed before you could read the timedevents table via SQL. The table columns convert fairly directly to what you see under timed events in Powerhome Explorer. Then you'd figure out which events happened during the time interval of interest and execute them. Again (without actually writing it) this seems like it would be reasonably straight forward for me in VBSsript but I do not know about the macro language. This is almost certainly what Dave's code does at boot up. Since I can't grant access to his code - I can only suggest how you could code it yourself if you chose to.
D
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: October 22 2009 at 21:02 | IP Logged
|
|
|
Thanks - but again not what I'm looking for. I hope Dave doesn't count the # of replies on this and think it was answered 8-}
/j
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: November 16 2009 at 15:46 | IP Logged
|
|
|
Jeff,
Just to clarify what I think you're asking is that you want PowerHome to have the ability to re-run past Timed Events. If this is the case, Im not sure if it would be doable in the current environment. When PowerHome has been "off" for some time, the Timed Events table stores the list of timed events with the next time the event is supposed to run. This of course is all in the database so is well retained. When PowerHome launches (assuming Timed Events is set to autostart), it looks to see if any Past Due Timed Events exist. If so, they are executed (in order, 1 at a time) and as they are executed, the Timed Event time is updated based upon the frequency (its important to note here that the time is NOT updated based upon the current time). So, if you have a Timed Event that runs every minute and PowerHome has been "off" for an hour, then when PowerHome restarts, you'll essentially get that Timed Event executed 60 times. Im assuming this is the "catch up" that you are referring to.
If so, then the problem is that as PowerHome is executing the past due events, its also updating the database in real time and effectively losing the past due information. Now what may be possible (in a future version) would be to write a routine that could intelligently attempt to roll back the Timed Events table by a certain Time amount. Something like a ph_timedeventrollback function where the user specifies the number of seconds to roll back entries. Once this rollback was done, then PowerHome would resume its Timed Event processing in the same manner that it does at startup and essentially playback the timed events as if they were past due events (including playing back the events multiple times if they would have fired that many times). For simple timed events, this shouldnt be too difficult but for ones with random offset times as well as Sunrise/Sunset types of events, it will be a little trickier.
Let me know if Im on the right track or if you were referring to something else entirely.
Dave.
|
Back to Top |
|
|
jeffw_00 Super User
Joined: June 30 2007
Online Status: Offline Posts: 929
|
Posted: November 16 2009 at 15:59 | IP Logged
|
|
|
Hi Dave - you're on the right track. I had mis-guessed how PH worked. I had thought that PH kept a record of the time of the last event it had processed, and then when it restarted, it sort of set it's internal clock to the recorded time, and then kept incrementing it until it "caught up", quickly processing any timed events that came in-between.
If that was how it worked, then it seemed like you could call this process with an arbitrary time and get a quick "rerun" of the intervening time period.
However, it sounds like you're saying that, even if PH is not running, somehow as time moves forward past each scheduled event, it gets added to a list that is then processed when PH is then active. If that's the case, this is not an easy feature add because you'd need the code to pretend to go back in time and build the list.
So - never mind 8-}. It's far from a crucial feature, I just thought it might be an easy tweak.
Best Regards
/j
|
Back to Top |
|
|