fixed issue 889, scheduler on missing app, thanks Niphlod
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.00.0 (2012-07-16 22:36:26) dev
|
Version 2.00.0 (2012-07-16 22:48:56) dev
|
||||||
|
|||||||
+9
-3
@@ -838,6 +838,10 @@ def console():
|
|||||||
|
|
||||||
return (options, args)
|
return (options, args)
|
||||||
|
|
||||||
|
def check_existent_app(options,appname):
|
||||||
|
if os.path.isdir(os.path.join(options.folder, 'applications', appname)):
|
||||||
|
return True
|
||||||
|
|
||||||
def start_schedulers(options):
|
def start_schedulers(options):
|
||||||
apps = [app.strip() for app in options.scheduler.split(',')]
|
apps = [app.strip() for app in options.scheduler.split(',')]
|
||||||
try:
|
try:
|
||||||
@@ -848,9 +852,12 @@ def start_schedulers(options):
|
|||||||
processes = []
|
processes = []
|
||||||
code = "from gluon import current;current._scheduler.loop()"
|
code = "from gluon import current;current._scheduler.loop()"
|
||||||
for app in apps:
|
for app in apps:
|
||||||
|
if not check_existent_app(options, app):
|
||||||
|
print "Application '%s' doesn't exist, skipping" % (app)
|
||||||
|
continue
|
||||||
print 'starting scheduler for "%s"...' % app
|
print 'starting scheduler for "%s"...' % app
|
||||||
args = (app,True,True,None,False,code)
|
args = (app,True,True,None,False,code)
|
||||||
logging.getLogger().setLevel(logging.DEBUG)
|
logging.getLogger().setLevel(options.debuglevel)
|
||||||
p = Process(target=run, args=args)
|
p = Process(target=run, args=args)
|
||||||
processes.append(p)
|
processes.append(p)
|
||||||
print "Currently running %s scheduler processes" % (len(processes))
|
print "Currently running %s scheduler processes" % (len(processes))
|
||||||
@@ -861,7 +868,6 @@ def start_schedulers(options):
|
|||||||
p.join()
|
p.join()
|
||||||
except (KeyboardInterrupt, SystemExit):
|
except (KeyboardInterrupt, SystemExit):
|
||||||
print "Processes stopped"
|
print "Processes stopped"
|
||||||
raise
|
|
||||||
except:
|
except:
|
||||||
p.terminate()
|
p.terminate()
|
||||||
p.join()
|
p.join()
|
||||||
@@ -925,7 +931,7 @@ def start(cron=True):
|
|||||||
logger.debug('Starting extcron...')
|
logger.debug('Starting extcron...')
|
||||||
global_settings.web2py_crontype = 'external'
|
global_settings.web2py_crontype = 'external'
|
||||||
if options.scheduler: # -K
|
if options.scheduler: # -K
|
||||||
apps = [app.strip() for app in options.scheduler.split(',')]
|
apps = [app.strip() for app in options.scheduler.split(',') if check_existent_app(options, app.strip())]
|
||||||
else:
|
else:
|
||||||
apps = None
|
apps = None
|
||||||
extcron = newcron.extcron(options.folder, apps=apps)
|
extcron = newcron.extcron(options.folder, apps=apps)
|
||||||
|
|||||||
Reference in New Issue
Block a user