Merge pull request #364 from puneet-mehta/feat/multiple-cron-support

feat(cron): added support for multiple crons
pull/367/head
Rui Carmo 2024-06-20 18:28:45 +01:00 zatwierdzone przez GitHub
commit 26659479e5
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
2 zmienionych plików z 5 dodań i 4 usunięć

Wyświetl plik

@ -2,6 +2,7 @@
# web: node server.js
# release: make PROD=1
# static: /:public,/somepath:somedir
# cron: */5 * * * * python batch.py
# cron1: */5 * * * * python batch.py
# cron2: */5 * * * * python batch.py
# somepyworker: python somescript.py
# somenodeworker: node somescript.js

Wyświetl plik

@ -288,7 +288,7 @@ def parse_procfile(filename):
try:
kind, command = map(lambda x: x.strip(), line.split(":", 1))
# Check for cron patterns
if kind == "cron":
if kind.startswith("cron"):
limits = [59, 24, 31, 12, 7]
res = match(CRON_REGEXP, command)
if res:
@ -1077,7 +1077,7 @@ def spawn_worker(app, kind, command, env, ordinal=1):
echo("Error: malformed setting 'UWSGI_IDLE', ignoring it.".format(), fg='red')
pass
if kind == 'cron':
if kind.startswith("cron"):
settings.extend([
['cron', command.replace("*/", "-").replace("*", "-1")],
])
@ -1163,7 +1163,7 @@ def spawn_worker(app, kind, command, env, ordinal=1):
settings.append(('attach-daemon', command))
elif kind == 'static':
echo("-----> nginx serving static files only".format(**env), fg='yellow')
elif kind == 'cron':
elif kind.startswith("cron"):
echo("-----> uwsgi scheduled cron for {command}".format(**locals()), fg='yellow')
else:
settings.append(('attach-daemon', command))