I've finally done a scheduled task (and not for the project I thought I was going to). In the current context, the plan is to use the scheduler to check for POSTs that have come in since the last run, and using the list as the body of a email notification to the steward/responsible-party who is supposed to monitor the list. And for that, I need a "since" time.
For various reasons, in this project I have an artifact in the file system that's easy to fstat, but I'd like to know a more general solution for the next time (or maybe even this time, if I'm impressed enough). Would that be to take the last row in scheduler_run that matched the function and had status COMPLETED? If you don't have a return value, is there something else than scheduler_run entries that would be considered a good practice? Sidebar: I almost outsmarted myself on my scheduler task. I put the real work into a module, and then did just a wrapper in the model code. And I didn't think about return values, but once I got to where I wasn't getting a traceback but needed more debugging information, not having an entry left in scheduler_run was a handicap. So I added print statements to the module. Nada. I added a return statement to the module. Nada. Went out to the car to drive home, and realized ... the function in the model needed to return the return value. Went back in added that, and voila! Sidebar 2: For future readers, one further little detail was needed to get to voila ... restarting web2py for changes in either the model or module (I was using -K -X), because of when the "check for changes" code is applied by the scheduler, which is at startup. So what do the fine folk here recommend for tracking the last time run? /dps -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.