Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
engine-api
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
Container Registry
Model registry
Operate
Environments
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
AURA
engine-api
Commits
34a76cbc
Commit
34a76cbc
authored
4 years ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
Wireup active source, fixes.
parent
ab3e6ead
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/rest/controllers/internal_controller.py
+7
-3
7 additions, 3 deletions
src/rest/controllers/internal_controller.py
src/rest/controllers/public_controller.py
+2
-1
2 additions, 1 deletion
src/rest/controllers/public_controller.py
src/service.py
+5
-5
5 additions, 5 deletions
src/service.py
with
14 additions
and
9 deletions
src/rest/controllers/internal_controller.py
+
7
−
3
View file @
34a76cbc
import
connexion
import
six
from
flask
import
current_app
from
src.rest.models.clock_info
import
ClockInfo
# noqa: E501
from
src.rest.models.health_log
import
HealthLog
# noqa: E501
from
src.rest.models.inline_response400
import
InlineResponse400
# noqa: E501
...
...
@@ -21,7 +23,7 @@ def add_playlog(body): # noqa: E501
if
connexion
.
request
.
is_json
:
body
=
PlayLog
.
from_dict
(
connexion
.
request
.
get_json
())
# noqa: E501
service
=
current_app
.
config
[
'
SERVICE
'
]
service
.
store_playlog
(
body
)
return
service
.
store_playlog
(
body
)
def
clock_info
():
# noqa: E501
...
...
@@ -43,7 +45,8 @@ def get_active_source(): # noqa: E501
:rtype: int
"""
return
'
do some magic!
'
service
=
current_app
.
config
[
'
SERVICE
'
]
return
service
.
get_active_source
()
def
get_report
(
year_month
):
# noqa: E501
...
...
@@ -116,4 +119,5 @@ def set_active_source(number): # noqa: E501
:rtype: None
"""
return
'
do some magic!
'
service
=
current_app
.
config
[
'
SERVICE
'
]
return
service
.
set_active_source
(
number
)
This diff is collapsed.
Click to expand it.
src/rest/controllers/public_controller.py
+
2
−
1
View file @
34a76cbc
import
connexion
import
six
from
flask
import
current_app
from
src.rest.models.play_log
import
PlayLog
# noqa: E501
from
src.rest
import
util
from
flask
import
current_app
def
current_track
():
# noqa: E501
"""
Get current track
...
...
This diff is collapsed.
Click to expand it.
src/service.py
+
5
−
5
View file @
34a76cbc
...
...
@@ -21,7 +21,7 @@ import datetime
import
requests
from
enum
import
Enum
from
models
import
PlayLog
,
PlayLogSchema
,
TrackSchema
from
models
import
PlayLog
,
PlayLogSchema
,
TrackSchema
,
ActivityLog
class
NodeType
(
Enum
):
...
...
@@ -78,14 +78,14 @@ class ApiService():
msg
=
"
Pushing data to
'
%s
'"
%
(
self
.
sync_host
)
# Set active source
self
.
active_source
=
ActivityLog
.
get_active_source
()
self
.
active_source
=
ActivityLog
.
get_active_source
()
.
source_number
if
not
self
.
active_source
:
if
self
.
node_type
==
NodeType
.
MAIN
:
source_number
=
self
.
config
.
get
(
"
host_id
"
)
else
:
source_number
=
self
.
config
.
get
(
"
default_source
"
)
self
.
set_active_source
(
source_number
)
self
.
logger
(
"
Active source: %s
"
%
self
.
active_source
)
self
.
logger
.
info
(
"
Active source: %s
"
%
self
.
active_source
)
self
.
logger
.
info
(
"
Running in
'
%s
'
mode. %s.
"
%
(
self
.
node_type
,
msg
))
...
...
@@ -190,10 +190,10 @@ class ApiService():
Args:
source_number (Integer): Number of the engine
"""
if
s
elf
.
active_source
>
0
:
if
s
ource_number
>
0
:
if
self
.
active_source
!=
source_number
:
self
.
active_source
=
source_number
activity_log
=
ActivityLog
(
active_source
)
activity_log
=
ActivityLog
(
source_number
)
activity_log
.
save
()
...
...
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