Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aura-engine
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Kruse
aura-engine
Commits
edeb8902
Commit
edeb8902
authored
4 years ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
Added tank healthz info.
parent
51bcd73e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/core/monitor.py
+31
-3
31 additions, 3 deletions
modules/core/monitor.py
with
31 additions
and
3 deletions
modules/core/monitor.py
+
31
−
3
View file @
edeb8902
...
...
@@ -45,6 +45,9 @@ class Monitoring:
self
.
status
=
dict
()
self
.
status
[
"
soundsystem
"
]
=
dict
()
self
.
status
[
"
api
"
]
=
dict
()
self
.
status
[
"
api
"
][
"
steering
"
]
=
dict
()
self
.
status
[
"
api
"
][
"
tank
"
]
=
dict
()
def
update_status
(
self
):
...
...
@@ -60,8 +63,9 @@ class Monitoring:
#self.status["soundsystem"]["recorder"] = self.soundsystem.get_recorder_status()
self
.
soundsystem
.
disable_transaction
(
self
.
soundsystem
.
client
)
self
.
status
[
"
api
"
][
"
steering_ready
"
]
=
self
.
validate_url_connection
(
self
.
config
.
get
(
"
api_steering_status
"
))
self
.
status
[
"
api
"
][
"
tank_ready
"
]
=
self
.
validate_url_connection
(
self
.
config
.
get
(
"
api_tank_status
"
))
self
.
status
[
"
api
"
][
"
steering
"
][
"
available
"
]
=
self
.
validate_url_connection
(
self
.
config
.
get
(
"
api_steering_status
"
))
self
.
status
[
"
api
"
][
"
tank
"
][
"
available
"
]
=
self
.
validate_url_connection
(
self
.
config
.
get
(
"
api_tank_status
"
))
self
.
status
[
"
api
"
][
"
tank
"
][
"
status
"
]
=
self
.
get_url_response
(
self
.
config
.
get
(
"
api_tank_status
"
))
self
.
status
[
"
redis_ready
"
]
=
self
.
validate_redis_connection
()
self
.
status
[
"
audio_store
"
]
=
self
.
validate_directory
(
self
.
config
.
get
(
"
audiofolder
"
))
...
...
@@ -73,6 +77,7 @@ class Monitoring:
self
.
status
[
"
engine_status
"
]
=
"
INVALID
"
def
get_io_state
(
self
):
"""
Retrieves all input and outputs provided by the engine.
...
...
@@ -155,4 +160,27 @@ class Monitoring:
if
status
[
"
exists
"
]:
status
[
"
has_content
"
]
=
any
([
True
for
_
in
os
.
scandir
(
dir_path
)])
return
status
\ No newline at end of file
return
status
def
get_url_response
(
self
,
url
):
"""
Fetches JSON data from the given URL.
Args:
url (String): The API endpoint to call
Returns:
(dict[]): A Python object representing the JSON structure
"""
data
=
None
try
:
request
=
urllib
.
request
.
Request
(
url
)
response
=
urllib
.
request
.
urlopen
(
request
)
data
=
response
.
read
()
except
(
urllib
.
error
.
URLError
,
IOError
,
ValueError
)
as
e
:
self
.
logger
.
error
(
"
Error while connecting to URL
'
%s
'
- %s
"
%
(
url
,
e
))
return
json
.
loads
(
data
,
strict
=
False
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment