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
25b2bf79
Commit
25b2bf79
authored
4 years ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
Model for activity and health log.
parent
4f12d39d
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
src/models.py
+61
-0
61 additions, 0 deletions
src/models.py
with
61 additions
and
0 deletions
src/models.py
+
61
−
0
View file @
25b2bf79
...
...
@@ -147,6 +147,7 @@ class PlayLog(db.Model):
return
"
Track [track_start: %s, track_title: %s]
"
%
(
str
(
self
.
track_start
),
str
(
self
.
track_title
))
class
PlayLogSchema
(
ma
.
SQLAlchemyAutoSchema
):
"""
Schema for playlog entries.
...
...
@@ -156,6 +157,7 @@ class PlayLogSchema(ma.SQLAlchemyAutoSchema):
sqla_session
=
db
.
session
class
TrackSchema
(
ma
.
SQLAlchemySchema
):
"""
Schema for trackservice entries.
...
...
@@ -170,3 +172,62 @@ class TrackSchema(ma.SQLAlchemySchema):
"
track_title
"
)
class
ActivityLog
(
db
.
Model
):
"""
Table holding a log of play-out source active and sync states.
"""
__tablename__
=
'
activity_log
'
# Primary Key
log_time
=
Column
(
DateTime
,
primary_key
=
True
)
# Columns
source_number
=
Column
(
Integer
)
is_synced
=
Column
(
Boolean
)
def
__init__
(
self
,
source_number
):
"""
Initializes a activity entry
"""
self
.
log_time
=
datetime
.
datetime
.
now
()
self
.
source_number
=
source_number
self
.
is_synced
=
False
def
save
(
self
):
db
.
session
.
add
(
self
)
db
.
session
.
commit
()
class
HealthHistory
(
db
.
Model
):
"""
Table holding an history of health information for sources.
"""
__tablename__
=
'
health_history
'
# Primary Key
log_time
=
Column
(
DateTime
,
primary_key
=
True
)
# Columns
source_number
=
Column
(
Integer
)
is_healthy
=
Column
(
Boolean
)
health_info
=
Column
(
String
(
2048
))
def
__init__
(
self
,
data
):
"""
Initializes an health entry.
"""
self
.
log_time
=
datetime
.
datetime
.
now
()
self
.
source_number
=
source_number
def
save
(
self
):
db
.
session
.
add
(
self
)
db
.
session
.
commit
()
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