Commit 85a02fce authored by Jerico Moeyersons's avatar Jerico Moeyersons 🏘
Browse files

major bugfixes - application is now working

parent a477aef4
File added
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
......@@ -11,7 +11,7 @@ import exceptions
WORKER_URL = 'http://worker-'
DEFAULT_NETWORK = 'mandelbrot'
DEFAULT_NETWORK = 'mandelbrot-creator_mandelbrot'
WORKER_IMAGE_NAME = 'worker'
class Kernel(object):
......@@ -35,7 +35,7 @@ class Kernel(object):
# TODO: delete previous workers
for i in range(number):
for i in range(int(number)):
# Try to start a container with the process
try:
# Start a new container with the plugin process.
......@@ -71,7 +71,7 @@ class Kernel(object):
def start_worker(self, worker=None):
if worker is None:
url = "http://" + str(self.workers[self.next_worker].name)
url = "http://" + str(self.workers[self.next_worker].name) + "/start"
self.__set_next_worker()
else:
# TODO: check if worker exists
......@@ -96,23 +96,26 @@ class Kernel(object):
return True
def multiple_start(self, number):
if not self.active:
if number < self.workers:
with concurrent.futures.ThreadPoolExecutor(max_workers=number) as executor:
executor.submit(self.start_worker, self)
'''for i in range(1, number+1):
thread = Thread(target = start_worker, args = (i, ))
threads.append(thread)
thread.start()
for index, thread in enumerate(threads):
logging.info("Main : before joining thread %d.", index)
thread.join()
logging.info("Main : thread %d done", index)'''
else:
with concurrent.futures.ThreadPoolExecutor(max_workers=self.workers) as executor:
executor.submit(self.start_worker, self)
message = "All workers started and finished..."
if not self.active:
code = http.HTTPStatus.OK.value
message = "All workers started and finished..."
print("Before the with statement)")
with concurrent.futures.ThreadPoolExecutor(max_workers=len(self.workers)) as executor:
task = {executor.submit(self.start_worker): i for i in range(int(number))}
print("tasks set")
print(task)
for future in concurrent.futures.as_completed(task):
url = task[future]
print(url)
try:
print("before getting data")
data = future.result()
print(data)
except Exception as exc:
message = ('%r generated an exception: %s' % (url, exc))
code = http.HTTPStatus.INTERNAL_SERVER_ERROR.value
else:
print('OK')
return (message, code)
else:
code = http.HTTPStatus.IM_A_TEAPOT.value
......@@ -120,7 +123,7 @@ class Kernel(object):
return (message, code)
def __set_next_worker(self):
if self.next_worker == length(self.workers)-1:
self.next_worker = 1
if self.next_worker == len(self.workers)-1:
self.next_worker = 0
else:
self.next_worker += 1
Metadata-Version: 1.0
Name: mandelbrot-creator
Version: 1.0
Summary: UNKNOWN
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN
setup.py
mandelbrot_creator.egg-info/PKG-INFO
mandelbrot_creator.egg-info/SOURCES.txt
mandelbrot_creator.egg-info/dependency_links.txt
mandelbrot_creator.egg-info/entry_points.txt
mandelbrot_creator.egg-info/requires.txt
mandelbrot_creator.egg-info/top_level.txt
\ No newline at end of file
[console_scripts]
mandelbrot-creator=mandelbrot_creator:cli
\ No newline at end of file
Click
requests
docker
docker-compose
......@@ -4,12 +4,12 @@ services:
api:
container_name: api
build:
context: ./API
context: ./api
dockerfile: Dockerfile
ports:
- "8080:80"
- "8000:80"
volumes:
- "./API/:/usr/api/"
- "./api/:/usr/api/"
- "/var/run/docker.sock:/var/run/docker.sock"
networks:
- mandelbrot
......
......@@ -34,9 +34,13 @@ kernel = Kernel()
def info():
return 'This is the worker service'
@app.route('/start', methods=['POST'])
@app.route('/start', methods=['GET', 'POST'])
def start_worker():
# GET handler
if request.method == "GET":
return kernel.start()
# POST handler
if request.method == "POST":
# Parse payload
......
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