I can't answer your question specifically (someone else may have to do that), 
but I will say this: cron is the natural "scheduler" on a system and if you're 
doing anything that's supposed to be in the background or "scheduled" it's nice 
to put it on cron. Easier to find for other programmers, universal scheduling 
system, etc…

Additionally, you could use Celery to do work. Schedule a start script as a 
cronjob and put whatever kind of job you want work to be done for into Celery.

That's how I do it at least.

On Jun 16, 2012, at 3:52 AM, Stéphane Klein wrote:

> The way you 
> Writing separate script running as a 
> daemon won't impact performance of the web app itself in case if you are 
> up to some resource intensive tasks (which I assume you do).
> 
> In this source code, do you think daemon can impact performance of the web 
> app ?
> It's is a bad idea to start scheduler in my webapp ?
> 
> Is there an issue with Global Internal Lock of Python ?
> 
> from apscheduler.scheduler import Scheduler
> import requests
> 
> sched = Scheduler()
> 
> @sched.interval_schedule(seconds=10)
> def some_job():
>     print('start')
>     for a in range(1, 10):
>         r = requests.get('http://www.google.fr')
>         print(r.status_code)
> 
>     print('fin')
> 
> sched.configure()
> sched.start()
> 
> from wsgiref.util import setup_testing_defaults
> from wsgiref.simple_server import make_server
> 
> def simple_app(environ, start_response):
>     setup_testing_defaults(environ)
> 
>     status = '200 OK'
>     headers = [('Content-type', 'text/plain')]
> 
>     start_response(status, headers)
> 
>     ret = ["%s: %s\n" % (key, value)
>            for key, value in environ.iteritems()]
>     return ret
> 
> httpd = make_server('', 8000, simple_app)
> print "Serving on port 8000..."
> httpd.serve_forever()
>  
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "pylons-discuss" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/pylons-discuss/-/tU8Te4-cm5EJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/pylons-discuss?hl=en.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to