Skip to content
Snippets Groups Projects
Commit f668d9d4 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[backend] Allow settings to be defined for worker subprocesses

parent dfbc4f22
No related branches found
No related tags found
1 merge request!194Scheduler
...@@ -405,7 +405,7 @@ def worker_update(): ...@@ -405,7 +405,7 @@ def worker_update():
@transaction.atomic @transaction.atomic
def work(environments, cpulimit, process): def work(environments, cpulimit, process, settings):
'''Launches user code on isolated processes '''Launches user code on isolated processes
This function is supposed to be called asynchronously, by a scheduling This function is supposed to be called asynchronously, by a scheduling
...@@ -429,6 +429,9 @@ def work(environments, cpulimit, process): ...@@ -429,6 +429,9 @@ def work(environments, cpulimit, process):
process (str): The path to the ``process.py`` program to use for running process (str): The path to the ``process.py`` program to use for running
the user code on isolated processes. the user code on isolated processes.
settings (str): The name of the module containing the Django settings for
use with the process program
''' '''
# myself, raises if I cannot find me # myself, raises if I cannot find me
...@@ -441,7 +444,7 @@ def work(environments, cpulimit, process): ...@@ -441,7 +444,7 @@ def work(environments, cpulimit, process):
j.end(None, Job.CANCELLED) j.end(None, Job.CANCELLED)
# cmdline base argument # cmdline base argument
cmdline = [process] cmdline = [process, '--settings=%s' % settings]
if cpulimit is not None: cmdline += ['--cpulimit=%s' % cpulimit] if cpulimit is not None: cmdline += ['--cpulimit=%s' % cpulimit]
if settings.DEBUG: cmdline += ['-vv'] if settings.DEBUG: cmdline += ['-vv']
......
...@@ -124,7 +124,7 @@ def main(user_input=None): ...@@ -124,7 +124,7 @@ def main(user_input=None):
while not stop: while not stop:
start = time.time() start = time.time()
work(environments, cpulimit, process) work(environments, cpulimit, process, arguments['--settings'])
currtime = time.time() currtime = time.time()
duration = currtime - start duration = currtime - start
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment