On Friday, October 3, 2014 8:19:46 PM UTC+2, Pengfei Yu wrote: > > Thanks a lot for your detailed explanation for the difference between > Celery and scheduler! I think currently scheduler is enough for our > application, and it is easier to implement (thanks to great work of your > team). May I have one more question. If I want to allow user to delete one > of his projects, which means the task associated with the project will also > be deleted, is there a simple command in scheduler to do that. In the data > table scheduler_worker and scheduler_run I want to delete both entries. > Should I use db(db.scheduler_*.uuid==<an_id>).delete() for both of them, or > there is a single command like scheduler.delete_task(uuid) to do that. I am > not sure if scheduler.terminate(), scheduler.stop_task() or scheduler.kill > can do that. > > I think you need to make a tour on w2p_scheduler_test <https://github.com/niphlod/w2p_scheduler_tests> beforehand. It seems that some basic concept on what is the scheduler API is somehow obscure to you.
The scheduler is a way to let some task be processed outside web2py. How you (and anyone else) manage the correlation between tasks sent to the scheduler and their own app (e.g., your requirement for them to be "assigned to a project") is entirely up to your application's code. The data in scheduler_worker shouldn't matter to you: it's the table where workers coordinate among themselves and carries some statistics around. scheduler_task is the table that holds all the tasks you sent (and where you can check their statuses). scheduler_run is the table where return data (if needed) is stored. That being said, if you delete a task, its return data (if it's there), is deleted, because there is a foreign key that links the two tables (to be even more plain in explanations, there's no way you can delete a scheduler_task row without deleting ALSO the corresponding records on scheduler_run). Ultimately, the kill() and terminate() methods are to there manage worker processes (i.e. the things that are processing tasks), not tasks directly. stop_task() instead is a method to manage a possibly RUNNING task (i.e. something that you clearly can't dequeue, because it's already being processed), asking the corresponding worker to stop processing it (so it can be free to process other tasks). calling stop_task on a task that is not RUNNING will result in that task never being processed (it will be marked as STOPPED and nobody will pick that up) -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.

