Commit c2363d8a8bd7074c101300e409d4dfa7c7d53a88
1 parent
d29a6fb3
Exists in
master
and in
4 other branches
Change Dockerfile entrypoint to run processManager
Showing
2 changed files
with
15 additions
and
2 deletions
Show diff stats
Dockerfile
| ... | ... | @@ -88,4 +88,4 @@ WORKDIR /root/translate-api/ |
| 88 | 88 | RUN npm i |
| 89 | 89 | |
| 90 | 90 | #Comando de entrada quando inicializado |
| 91 | -ENTRYPOINT (rabbitmq-server start & sleep 1m) ; npm start & python /root/translator.py & python /root/renderer.py | |
| 91 | +ENTRYPOINT (rabbitmq-server start & sleep 1m) ; npm start & python /root/processManager.py | ... | ... |
core/processManager.py
| ... | ... | @@ -14,9 +14,19 @@ def signalHandler(signal, frame): |
| 14 | 14 | print("Closing") |
| 15 | 15 | sys.exit(0) |
| 16 | 16 | |
| 17 | +def spawnRenderer(): | |
| 18 | + while KEEP_RUNNING: | |
| 19 | + proc = subprocess.Popen(["/root/renderer.py"], shell=True, stdout=subprocess.PIPE) | |
| 20 | + print("Process RENDERER PID: " + str(proc.pid)) | |
| 21 | + try: | |
| 22 | + stdoutdata, stderrdata = proc.communicate() | |
| 23 | + except: | |
| 24 | + print "An error occured, running again..." | |
| 25 | + return None | |
| 26 | + | |
| 17 | 27 | def spawnTranslator(): |
| 18 | 28 | while KEEP_RUNNING: |
| 19 | - proc = subprocess.Popen(["./translator.py"], shell=True, stdout=subprocess.PIPE) | |
| 29 | + proc = subprocess.Popen(["/root/translator.py"], shell=True, stdout=subprocess.PIPE) | |
| 20 | 30 | print("Process TRANSLATOR PID: " + str(proc.pid)) |
| 21 | 31 | try: |
| 22 | 32 | stdoutdata, stderrdata = proc.communicate() |
| ... | ... | @@ -29,3 +39,6 @@ if __name__ == "__main__": |
| 29 | 39 | |
| 30 | 40 | t = Thread(target=spawnTranslator, args=()) |
| 31 | 41 | t.start() |
| 42 | + | |
| 43 | + t2 = Thread(target=spawnRenderer, args=()) | |
| 44 | + t2.start() | ... | ... |