Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jerico Moeyersons
Mandelbrot-creator
Commits
d6f04862
Commit
d6f04862
authored
Feb 12, 2021
by
Jerico Moeyersons
🏘
Browse files
Bugfixes + enable off command
parent
85a02fce
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
.gitignore
0 → 100644
View file @
d6f04862
*.log
**/__pycache__/
\ No newline at end of file
API/api.log
deleted
100644 → 0
View file @
85a02fce
This diff is collapsed.
Click to expand it.
API/api.py
View file @
d6f04862
...
...
@@ -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
)
...
...
API/kernel.py
View file @
d6f04862
...
...
@@ -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
...
...
CLI/mandelbrot_creator.py
View file @
d6f04862
...
...
@@ -57,7 +57,7 @@ def off():
click
.
echo
(
'Mandelbrot-creator shut down'
)
###################
#
Plugin
s command #
#
Worker
s command #
###################
@
cli
.
command
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment