Commit d6f04862 authored by Jerico Moeyersons's avatar Jerico Moeyersons 🏘
Browse files

Bugfixes + enable off command

parent 85a02fce
*.log
**/__pycache__/
\ No newline at end of file
INFO:root:API Service started on host 2aaafdc9e236
INFO:root:Initializing API Kernel...
INFO:root:Initializing docker client...
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:urllib3.connectionpool:http://localhost:None "GET /version HTTP/1.1" 200 None
INFO:werkzeug: * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
INFO:root:API Service started on host 60f0f5e77bff
INFO:root:Initializing API Kernel...
INFO:root:Initializing docker client...
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:urllib3.connectionpool:http://localhost:None "GET /version HTTP/1.1" 200 None
INFO:werkzeug: * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
ERROR:api:Exception on /spawn-workers/2 [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.9/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/api/./api.py", line 35, in spawn_workers
return kernel.spawn_workers(number)
File "/usr/api/kernel.py", line 38, in spawn_workers
for i in range(number):
TypeError: 'str' object cannot be interpreted as an integer
INFO:werkzeug:172.19.0.1 - - [11/Feb/2021 09:50:49] "GET /spawn-workers/2 HTTP/1.1" 500 -
INFO:root:API Service started on host d21361032be0
INFO:root:Initializing API Kernel...
INFO:root:Initializing docker client...
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:urllib3.connectionpool:http://localhost:None "GET /version HTTP/1.1" 200 None
INFO:werkzeug: * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/create?name=worker-0 HTTP/1.1" 201 None
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.41/containers/b39dafd1eaa6c50e16f833f01a76e1156fc9676830bbcefac87fecea526f6ac0/json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/b39dafd1eaa6c50e16f833f01a76e1156fc9676830bbcefac87fecea526f6ac0/start HTTP/1.1" 404 None
CRITICAL:root:Critical docker error, exiting...
INFO:root:API Service started on host 85cead497734
INFO:root:Initializing API Kernel...
INFO:root:Initializing docker client...
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:urllib3.connectionpool:http://localhost:None "GET /version HTTP/1.1" 200 None
INFO:werkzeug: * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/create?name=worker-0 HTTP/1.1" 201 None
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.41/containers/9d65bf0ce7e2addff31bdc685b1149b8306870b87f11c8e52efca9323d4eecf4/json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/9d65bf0ce7e2addff31bdc685b1149b8306870b87f11c8e52efca9323d4eecf4/start HTTP/1.1" 204 0
DEBUG:root:Container with name worker-0 - id - 9d65bf0ce7e2addff31bdc685b1149b8306870b87f11c8e52efca9323d4eecf4 started
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/create?name=worker-1 HTTP/1.1" 201 None
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.41/containers/d919fcf0c088f4ad64a6ce081695f931785a3852106a4e4c7395d00ad39c59da/json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/d919fcf0c088f4ad64a6ce081695f931785a3852106a4e4c7395d00ad39c59da/start HTTP/1.1" 204 0
DEBUG:root:Container with name worker-1 - id - d919fcf0c088f4ad64a6ce081695f931785a3852106a4e4c7395d00ad39c59da started
INFO:werkzeug:172.21.0.1 - - [11/Feb/2021 09:58:43] "GET /spawn-workers/2 HTTP/1.1" 200 -
ERROR:api:Exception on /start-worker/2 [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.9/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/api/./api.py", line 39, in start_workers
return kernel.multiple_start(number)
File "/usr/api/kernel.py", line 100, in multiple_start
if number < self.workers:
TypeError: '<' not supported between instances of 'str' and 'list'
INFO:werkzeug:172.21.0.1 - - [11/Feb/2021 09:59:14] "GET /start-worker/2 HTTP/1.1" 500 -
INFO:root:API Service started on host 1b8cb94d3d6b
INFO:root:Initializing API Kernel...
INFO:root:Initializing docker client...
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:urllib3.connectionpool:http://localhost:None "GET /version HTTP/1.1" 200 None
INFO:werkzeug: * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/create?name=worker-0 HTTP/1.1" 201 None
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.41/containers/7e4b53ca535a8235071452797ada94329e28d98c4c620eb08a8556ef91fdcbae/json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/7e4b53ca535a8235071452797ada94329e28d98c4c620eb08a8556ef91fdcbae/start HTTP/1.1" 204 0
DEBUG:root:Container with name worker-0 - id - 7e4b53ca535a8235071452797ada94329e28d98c4c620eb08a8556ef91fdcbae started
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/create?name=worker-1 HTTP/1.1" 201 None
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.41/containers/116980e646f0e6edfd574aa5ad219a0ad1b6e27914ead46e873bd318036f6d4e/json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/116980e646f0e6edfd574aa5ad219a0ad1b6e27914ead46e873bd318036f6d4e/start HTTP/1.1" 204 0
DEBUG:root:Container with name worker-1 - id - 116980e646f0e6edfd574aa5ad219a0ad1b6e27914ead46e873bd318036f6d4e started
INFO:werkzeug:172.22.0.1 - - [11/Feb/2021 10:01:15] "GET /spawn-workers/2 HTTP/1.1" 200 -
ERROR:api:Exception on /start-worker/2 [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.9/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/api/./api.py", line 39, in start_workers
return kernel.multiple_start(number)
File "/usr/api/kernel.py", line 100, in multiple_start
if number < len(self.workers):
TypeError: '<' not supported between instances of 'str' and 'int'
INFO:werkzeug:172.22.0.1 - - [11/Feb/2021 10:01:19] "GET /start-worker/2 HTTP/1.1" 500 -
INFO:root:API Service started on host 9be4658b6122
INFO:root:Initializing API Kernel...
INFO:root:Initializing docker client...
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:urllib3.connectionpool:http://localhost:None "GET /version HTTP/1.1" 200 None
INFO:werkzeug: * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
ERROR:api:Exception on /start-worker/2 [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.9/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/api/./api.py", line 39, in start_workers
return kernel.multiple_start(number)
File "/usr/api/kernel.py", line 112, in multiple_start
with concurrent.futures.ThreadPoolExecutor(max_workers=len(self.workers)) as executor:
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 138, in __init__
raise ValueError("max_workers must be greater than 0")
ValueError: max_workers must be greater than 0
INFO:werkzeug:172.23.0.1 - - [11/Feb/2021 10:02:37] "GET /start-worker/2 HTTP/1.1" 500 -
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/create?name=worker-0 HTTP/1.1" 201 None
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.41/containers/0108d6b4aa8e22c41f53093ea480a3c50be2fc68a2556927119fd65a1a65a920/json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/0108d6b4aa8e22c41f53093ea480a3c50be2fc68a2556927119fd65a1a65a920/start HTTP/1.1" 204 0
DEBUG:root:Container with name worker-0 - id - 0108d6b4aa8e22c41f53093ea480a3c50be2fc68a2556927119fd65a1a65a920 started
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/create?name=worker-1 HTTP/1.1" 201 None
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.41/containers/de9d44413735a6dd0cdac3b5e6fc1627b5d548cbcdef9dc87de4b793cc44761f/json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/de9d44413735a6dd0cdac3b5e6fc1627b5d548cbcdef9dc87de4b793cc44761f/start HTTP/1.1" 204 0
DEBUG:root:Container with name worker-1 - id - de9d44413735a6dd0cdac3b5e6fc1627b5d548cbcdef9dc87de4b793cc44761f started
INFO:werkzeug:172.23.0.1 - - [11/Feb/2021 10:02:48] "GET /spawn-workers/2 HTTP/1.1" 200 -
INFO:werkzeug:172.23.0.1 - - [11/Feb/2021 10:02:59] "GET /start-worker/2 HTTP/1.1" 200 -
INFO:werkzeug:172.23.0.1 - - [11/Feb/2021 10:05:02] "GET /start-worker/2 HTTP/1.1" 200 -
INFO:root:API Service started on host 6d6da0ff1a72
INFO:root:Initializing API Kernel...
INFO:root:Initializing docker client...
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:urllib3.connectionpool:http://localhost:None "GET /version HTTP/1.1" 200 None
INFO:werkzeug: * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/create?name=worker-0 HTTP/1.1" 201 None
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.41/containers/29750c319c953bfd9bf7f3659af00c93c7ba421eba59c58159a358d6fbf83643/json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/29750c319c953bfd9bf7f3659af00c93c7ba421eba59c58159a358d6fbf83643/start HTTP/1.1" 204 0
DEBUG:root:Container with name worker-0 - id - 29750c319c953bfd9bf7f3659af00c93c7ba421eba59c58159a358d6fbf83643 started
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/create?name=worker-1 HTTP/1.1" 201 None
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.41/containers/ec7d8e926bc270ec13a406e5eb9110bb1f204a068b2c41a7158aec166832a07b/json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/ec7d8e926bc270ec13a406e5eb9110bb1f204a068b2c41a7158aec166832a07b/start HTTP/1.1" 204 0
DEBUG:root:Container with name worker-1 - id - ec7d8e926bc270ec13a406e5eb9110bb1f204a068b2c41a7158aec166832a07b started
INFO:werkzeug:172.24.0.1 - - [11/Feb/2021 10:10:13] "GET /spawn-workers/2 HTTP/1.1" 200 -
INFO:werkzeug:172.24.0.1 - - [11/Feb/2021 10:10:18] "GET /start-worker/2 HTTP/1.1" 200 -
INFO:root:API Service started on host d3225ae23c6d
INFO:root:Initializing API Kernel...
INFO:root:Initializing docker client...
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:urllib3.connectionpool:http://localhost:None "GET /version HTTP/1.1" 200 None
INFO:werkzeug: * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/create?name=worker-0 HTTP/1.1" 201 None
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.41/containers/319602bae5c1eacc49b8251b98a6e98b22a1c6378fc33e3be7824add2a80d855/json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/319602bae5c1eacc49b8251b98a6e98b22a1c6378fc33e3be7824add2a80d855/start HTTP/1.1" 204 0
DEBUG:root:Container with name worker-0 - id - 319602bae5c1eacc49b8251b98a6e98b22a1c6378fc33e3be7824add2a80d855 started
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/create?name=worker-1 HTTP/1.1" 201 None
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.41/containers/2c844f1e31272c35f00490c13ba0ba687e4f96bf66aa02ff7fb61d0d17f2e5db/json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/2c844f1e31272c35f00490c13ba0ba687e4f96bf66aa02ff7fb61d0d17f2e5db/start HTTP/1.1" 204 0
DEBUG:root:Container with name worker-1 - id - 2c844f1e31272c35f00490c13ba0ba687e4f96bf66aa02ff7fb61d0d17f2e5db started
INFO:werkzeug:172.25.0.1 - - [11/Feb/2021 10:13:22] "GET /spawn-workers/2 HTTP/1.1" 200 -
INFO:werkzeug:172.25.0.1 - - [11/Feb/2021 10:13:28] "GET /start-worker/2 HTTP/1.1" 200 -
INFO:root:API Service started on host 32528c0cf8ff
INFO:root:Initializing API Kernel...
INFO:root:Initializing docker client...
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:urllib3.connectionpool:http://localhost:None "GET /version HTTP/1.1" 200 None
INFO:werkzeug: * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/create?name=worker-0 HTTP/1.1" 201 None
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.41/containers/6593b6eec207eb9a1a8d492a6088a12bfa3300d20f308c8f2df44c58ebdf2513/json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/6593b6eec207eb9a1a8d492a6088a12bfa3300d20f308c8f2df44c58ebdf2513/start HTTP/1.1" 204 0
DEBUG:root:Container with name worker-0 - id - 6593b6eec207eb9a1a8d492a6088a12bfa3300d20f308c8f2df44c58ebdf2513 started
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/create?name=worker-1 HTTP/1.1" 201 None
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.41/containers/5f825bfcdbd5d6fcde27c1065d57a0b86103f274008745b4c73b18d413d9cd3a/json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/5f825bfcdbd5d6fcde27c1065d57a0b86103f274008745b4c73b18d413d9cd3a/start HTTP/1.1" 204 0
DEBUG:root:Container with name worker-1 - id - 5f825bfcdbd5d6fcde27c1065d57a0b86103f274008745b4c73b18d413d9cd3a started
INFO:werkzeug:172.26.0.1 - - [11/Feb/2021 10:17:18] "GET /spawn-workers/2 HTTP/1.1" 200 -
INFO:werkzeug:172.26.0.1 - - [11/Feb/2021 10:17:25] "GET /start-worker/2 HTTP/1.1" 200 -
INFO:root:API Service started on host d3b416fcda14
INFO:root:Initializing API Kernel...
INFO:root:Initializing docker client...
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:urllib3.connectionpool:http://localhost:None "GET /version HTTP/1.1" 200 None
INFO:werkzeug: * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/create?name=worker-0 HTTP/1.1" 201 None
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.41/containers/da2353e79c6582bc2650c4a9db06b93047997d3f3a2fd0a4adc50d15a3d9e126/json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/da2353e79c6582bc2650c4a9db06b93047997d3f3a2fd0a4adc50d15a3d9e126/start HTTP/1.1" 204 0
DEBUG:root:Container with name worker-0 - id - da2353e79c6582bc2650c4a9db06b93047997d3f3a2fd0a4adc50d15a3d9e126 started
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/create?name=worker-1 HTTP/1.1" 201 None
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.41/containers/92cfb9a930212cb8813627d61dd55170024d3a1a5510dafeb5c6122a4b4373a0/json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/92cfb9a930212cb8813627d61dd55170024d3a1a5510dafeb5c6122a4b4373a0/start HTTP/1.1" 204 0
DEBUG:root:Container with name worker-1 - id - 92cfb9a930212cb8813627d61dd55170024d3a1a5510dafeb5c6122a4b4373a0 started
INFO:werkzeug:172.27.0.1 - - [11/Feb/2021 10:29:29] "GET /spawn-workers/2 HTTP/1.1" 200 -
INFO:werkzeug:172.27.0.1 - - [11/Feb/2021 10:29:33] "GET /start-worker/2 HTTP/1.1" 500 -
INFO:root:API Service started on host dfcfc36480f5
INFO:root:Initializing API Kernel...
INFO:root:Initializing docker client...
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:urllib3.connectionpool:http://localhost:None "GET /version HTTP/1.1" 200 None
INFO:werkzeug: * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
INFO:root:API Service started on host d149f582935d
INFO:root:Initializing API Kernel...
INFO:root:Initializing docker client...
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:urllib3.connectionpool:http://localhost:None "GET /version HTTP/1.1" 200 None
INFO:werkzeug: * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
INFO:root:API Service started on host 183d0cae2b8f
INFO:root:Initializing API Kernel...
INFO:root:Initializing docker client...
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:docker.utils.config:Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
DEBUG:docker.utils.config:No config file found
DEBUG:urllib3.connectionpool:http://localhost:None "GET /version HTTP/1.1" 200 None
INFO:werkzeug: * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/create?name=worker-0 HTTP/1.1" 201 None
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.41/containers/ba5228db3d3d01c24db6803781f4060d69bce67c5288a1c56d2bd9836b4a4f86/json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/ba5228db3d3d01c24db6803781f4060d69bce67c5288a1c56d2bd9836b4a4f86/start HTTP/1.1" 204 0
DEBUG:root:Container with name worker-0 - id - ba5228db3d3d01c24db6803781f4060d69bce67c5288a1c56d2bd9836b4a4f86 started
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/create?name=worker-1 HTTP/1.1" 201 None
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.41/containers/2ff72fe60f0d394757668420faa66a339ed9ed40b826ddd0699e00498517fdaf/json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.41/containers/2ff72fe60f0d394757668420faa66a339ed9ed40b826ddd0699e00498517fdaf/start HTTP/1.1" 204 0
DEBUG:root:Container with name worker-1 - id - 2ff72fe60f0d394757668420faa66a339ed9ed40b826ddd0699e00498517fdaf started
INFO:werkzeug:172.30.0.1 - - [11/Feb/2021 10:44:26] "GET /spawn-workers/2 HTTP/1.1" 200 -
INFO:root:Starting working 1
INFO:root:Starting working 0
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): worker-0:80
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): worker-1:80
......@@ -61,8 +61,9 @@ def shutdown():
Returns:
string -- notify that server is shutting down.
"""
shut_down_server()
return 'Server shutting down...'
return kernel.shutdown_workers()
# shut_down_server()
# return 'Server shutting down...'
def main():
app.run(host='0.0.0.0', port=80)
......
......@@ -12,7 +12,7 @@ import exceptions
WORKER_URL = 'http://worker-'
DEFAULT_NETWORK = 'mandelbrot-creator_mandelbrot'
WORKER_IMAGE_NAME = 'worker'
WORKER_IMAGE_NAME = 'gitlab.ilabt.imec.be:4567/jfmoeyer/mandelbrot-creator:worker'
class Kernel(object):
......@@ -39,7 +39,7 @@ class Kernel(object):
# Try to start a container with the process
try:
# Start a new container with the plugin process.
container_name = WORKER_IMAGE_NAME + "-" + str(i)
container_name = "worker-" + str(i)
container = self.docker_client.containers.run(
image=WORKER_IMAGE_NAME,
detach=True,
......@@ -122,6 +122,14 @@ class Kernel(object):
message = "Another job is running, please try again later..."
return (message, code)
def shutdown_workers(self):
for worker in self.workers:
worker.stop()
worker.remove()
message = "All workers stopped successfully..."
code = http.HTTPStatus.OK.value
return (message, code)
def __set_next_worker(self):
if self.next_worker == len(self.workers)-1:
self.next_worker = 0
......
......@@ -57,7 +57,7 @@ def off():
click.echo('Mandelbrot-creator shut down')
###################
# Plugins command #
# Workers command #
###################
@cli.command()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment