Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
zoe
main
Commits
865df6c8
Commit
865df6c8
authored
Sep 18, 2017
by
Daniele Venzano
🏇
Browse files
Merge branch 'devel/fixes' into 'master'
Various small fixes See merge request
!16
parents
bb86ce58
e1a88f0f
Pipeline
#4530
passed with stages
in 4 minutes and 53 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
zoe_api/web/templates/execution_inspect.html
View file @
865df6c8
{% extends "base_user.html" %}
{% block title %}Inspect execution {{ e.name }}{% endblock %}
{% block custom_head %}
<script
src=
"/static/moment.min.js"
type=
"application/javascript"
></script>
<script
src=
"/static/moment-timezone.min.js"
type=
"application/javascript"
></script>
<script>
function
format_timestamp
(
ts
)
{
var
m
=
moment
.
utc
(
ts
);
m
.
local
();
document
.
write
(
m
.
calendar
());
}
</script>
{% endblock %}
{% block content %}
<h1>
Zoe - Analytics on demand
</h1>
<h2>
Detailed information for execution {{ e.name }}
</h2>
...
...
zoe_cmd/entrypoint_admin.py
View file @
865df6c8
...
...
@@ -17,6 +17,7 @@
This module contains the entrypoint for the commandline Zoe client
"""
import
datetime
import
json
import
logging
import
os
...
...
@@ -30,6 +31,7 @@ from zoe_cmd import utils
from
zoe_lib.info
import
ZoeInfoAPI
from
zoe_lib.exceptions
import
ZoeAPIException
,
InvalidApplicationDescription
from
zoe_lib.executions
import
ZoeExecutionsAPI
from
zoe_lib.services
import
ZoeServiceAPI
from
zoe_lib.applications
import
app_validate
from
zoe_lib.version
import
ZOE_API_VERSION
...
...
@@ -80,6 +82,51 @@ def exec_list_cmd(auth, args):
print
(
tabulate
(
tabular_data
,
headers
))
def
exec_get_cmd
(
auth
,
args
):
"""Gather information about an execution."""
exec_api
=
ZoeExecutionsAPI
(
auth
[
'url'
],
auth
[
'user'
],
auth
[
'pass'
])
cont_api
=
ZoeServiceAPI
(
auth
[
'url'
],
auth
[
'user'
],
auth
[
'pass'
])
execution
=
exec_api
.
get
(
args
.
id
)
if
execution
is
None
:
print
(
'Execution not found'
)
else
:
print
(
'Execution {} (ID: {})'
.
format
(
execution
[
'name'
],
execution
[
'id'
]))
print
(
'Application name: {}'
.
format
(
execution
[
'description'
][
'name'
]))
print
(
'Status: {}'
.
format
(
execution
[
'status'
]))
if
execution
[
'status'
]
==
'error'
:
print
(
'Last error: {}'
.
format
(
execution
[
'error_message'
]))
print
()
print
(
'Time submit: {}'
.
format
(
datetime
.
datetime
.
fromtimestamp
(
execution
[
'time_submit'
])))
if
execution
[
'time_start'
]
is
None
:
print
(
'Time start: {}'
.
format
(
'not yet'
))
else
:
print
(
'Time start: {}'
.
format
(
datetime
.
datetime
.
fromtimestamp
(
execution
[
'time_start'
])))
if
execution
[
'time_end'
]
is
None
:
print
(
'Time end: {}'
.
format
(
'not yet'
))
else
:
print
(
'Time end: {}'
.
format
(
datetime
.
datetime
.
fromtimestamp
(
execution
[
'time_end'
])))
print
()
endpoints
=
exec_api
.
endpoints
(
execution
[
'id'
])
if
endpoints
is
not
None
and
len
(
endpoints
)
>
0
:
print
(
'Exposed endpoints:'
)
for
endpoint
in
endpoints
:
print
(
' - {}: {}'
.
format
(
endpoint
[
0
],
endpoint
[
1
]))
else
:
print
(
'This ZApp does not expose any endpoint'
)
print
()
tabular_data
=
[]
for
c_id
in
execution
[
'services'
]:
service
=
cont_api
.
get
(
c_id
)
service_data
=
[
service
[
'id'
],
service
[
'name'
],
'true'
if
service
[
'essential'
]
else
'false'
,
service
[
'status'
],
service
[
'backend_status'
],
service
[
'error_message'
]
if
service
[
'error_message'
]
is
not
None
else
''
]
tabular_data
.
append
(
service_data
)
headers
=
[
'ID'
,
'Name'
,
'Essential'
,
'Zoe status'
,
'Backend status'
,
'Error message'
]
print
(
tabulate
(
tabular_data
,
headers
))
def
exec_rm_cmd
(
auth
,
args
):
"""Delete an execution and kill it if necessary."""
exec_api
=
ZoeExecutionsAPI
(
auth
[
'url'
],
auth
[
'user'
],
auth
[
'pass'
])
...
...
@@ -127,6 +174,10 @@ def process_arguments() -> Tuple[ArgumentParser, Namespace]:
argparser_app_list
.
add_argument
(
'--later-than-end'
,
help
=
'Show only executions ended later than this timestamp (seconds since UTC epoch)'
)
argparser_app_list
.
set_defaults
(
func
=
exec_list_cmd
)
argparser_execution_get
=
subparser
.
add_parser
(
'exec-get'
,
help
=
"Get execution status"
)
argparser_execution_get
.
add_argument
(
'id'
,
type
=
int
,
help
=
"Execution id"
)
argparser_execution_get
.
set_defaults
(
func
=
exec_get_cmd
)
argparser_execution_rm
=
subparser
.
add_parser
(
'exec-rm'
,
help
=
"Deletes an execution"
)
argparser_execution_rm
.
add_argument
(
'id'
,
type
=
int
,
help
=
"Execution id"
)
argparser_execution_rm
.
set_defaults
(
func
=
exec_rm_cmd
)
...
...
zoe_master/backends/swarm/api_client.py
View file @
865df6c8
...
...
@@ -338,6 +338,8 @@ class SwarmClient:
ret
=
self
.
cli
.
containers
.
list
(
all
=
True
)
except
docker
.
errors
.
APIError
as
ex
:
raise
ZoeException
(
str
(
ex
))
except
requests
.
exceptions
.
RequestException
as
ex
:
raise
ZoeException
(
str
(
ex
))
conts
=
[]
for
cont_info
in
ret
:
match
=
True
...
...
zoe_master/scheduler/simulated_platform.py
View file @
865df6c8
"""Classes to hold the system state and simulated container/service placements"""
import
logging
from
zoe_lib.state.sql_manager
import
Execution
,
Service
from
zoe_master.stats
import
ClusterStats
,
NodeStats
log
=
logging
.
getLogger
(
__name__
)
class
SimulatedNode
:
"""A simulated node where containers can be run"""
...
...
@@ -72,6 +76,7 @@ class SimulatedPlatform:
candidate_nodes
.
append
(
node
)
if
len
(
candidate_nodes
)
==
0
:
# this service does not fit anywhere
self
.
deallocate_essential
(
execution
)
log
.
debug
(
'Cannot fit essential service {}, bailing out'
.
format
(
service
.
id
))
return
False
candidate_nodes
.
sort
(
key
=
lambda
n
:
n
.
container_count
)
# smallest first
candidate_nodes
[
0
].
service_add
(
service
)
...
...
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