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
b76f78c7
Commit
b76f78c7
authored
4 years ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
From and to date filter for track service.
#12
parent
9799652a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/rest/controllers/internal_controller.py
+2
-2
2 additions, 2 deletions
src/rest/controllers/internal_controller.py
src/rest/controllers/public_controller.py
+15
-2
15 additions, 2 deletions
src/rest/controllers/public_controller.py
src/service.py
+5
-4
5 additions, 4 deletions
src/service.py
with
22 additions
and
8 deletions
src/rest/controllers/internal_controller.py
+
2
−
2
View file @
b76f78c7
...
...
@@ -101,8 +101,8 @@ def list_playlog(from_date=None, to_date=None, page=None, limit=None, skip_synce
td
=
None
try
:
fd
=
pars
e
(
from_date
)
td
=
pars
e
(
to_date
)
fd
=
util
.
deserialize_datetim
e
(
from_date
)
td
=
util
.
deserialize_datetim
e
(
to_date
)
except
Exception
:
service
.
logger
.
info
(
"
Invalid
'
from_date
'
(%s) or
'
to_date
'
(%s) for
'
list_playlog
'"
%
(
str
(
from_date
),
str
(
to_date
)))
...
...
This diff is collapsed.
Click to expand it.
src/rest/controllers/public_controller.py
+
15
−
2
View file @
b76f78c7
...
...
@@ -18,11 +18,15 @@ def current_track(): # noqa: E501
return
service
.
current_track
()
def
list_tracks
(
page
=
None
,
limit
=
None
):
# noqa: E501
def
list_tracks
(
from_date
=
None
,
to_date
=
None
,
page
=
None
,
limit
=
None
):
# noqa: E501
"""
List recent tracks in the play-log
Lists the track-service entries for a given page. # noqa: E501
:param from_date: Get entries after this timestamp
:type from_date: str
:param to_date: Get entries before this timestamp
:type to_date: str
:param page: The number of items to skip before starting to collect the result set
:type page: int
:param limit: The numbers of items to return per page
...
...
@@ -31,4 +35,13 @@ def list_tracks(page=None, limit=None): # noqa: E501
:rtype: List[Track]
"""
service
=
current_app
.
config
[
'
SERVICE
'
]
return
service
.
list_tracks
(
page
,
limit
)
fd
=
None
td
=
None
try
:
fd
=
util
.
deserialize_datetime
(
from_date
)
td
=
util
.
deserialize_datetime
(
to_date
)
except
Exception
:
service
.
logger
.
info
(
"
Invalid
'
from_date
'
(%s) or
'
to_date
'
(%s) for
'
list_tracks
'"
%
(
str
(
from_date
),
str
(
to_date
)))
return
service
.
list_tracks
(
page
,
limit
,
fd
,
td
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/service.py
+
5
−
4
View file @
b76f78c7
...
...
@@ -104,19 +104,20 @@ class ApiService():
return
track_schema
.
dump
(
track
)
def
list_tracks
(
self
,
page
=
None
,
size
=
None
):
def
list_tracks
(
self
,
page
=
None
,
size
=
None
,
from_time
=
None
,
to_time
=
None
):
"""
Lists track-service entries with pagination.
Args:
page (Integer): The number of the page to return
size (Integer): The numbers of items to return
from_time (datetime): Optionally, get entries after this timestamp (e.g.
"
2020-08-29T09:12:33.001Z
"
)
to_time (datetime): Optionally, get entries before this timestamp (e.g.
"
2020-08-29T09:12:33.001Z
"
)
Returns:
(JSON)
"""
if
not
size
or
size
>
50
or
size
<
1
:
size
=
20
tracklist
=
PlayLog
.
paginate
(
page
,
size
,
None
,
Non
e
,
False
)
tracklist
=
PlayLog
.
paginate
(
page
,
size
,
from_time
,
to_tim
e
,
False
)
tracklist_schema
=
TrackSchema
(
many
=
True
)
return
tracklist_schema
.
dump
(
tracklist
)
...
...
@@ -129,7 +130,7 @@ class ApiService():
page (Integer): The number of items to skip before starting to collect the result set
size (Integer): The numbers of items to return per page
from_time (datetime): Optionally, get entries after this timestamp (e.g.
"
2020-08-29T09:12:33.001Z
"
)
from
_time (datetime): Optionally, get entries before this timestamp (e.g.
"
2020-08-29T09:12:33.001Z
"
)
to
_time (datetime): Optionally, get entries before this timestamp (e.g.
"
2020-08-29T09:12:33.001Z
"
)
skip_synced (Boolean): Optionally, don
'
t return entries which have been posted directly before (sync node only)
Returns:
...
...
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