Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
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
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
Commits
755aba8f
Commit
755aba8f
authored
1 year ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
refactor: make next ts method window aware
parent
bf2b1a08
No related branches found
No related tags found
1 merge request
!35
ORM-less scheduling
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/aura_engine/scheduling/timetable.py
+32
-7
32 additions, 7 deletions
src/aura_engine/scheduling/timetable.py
with
32 additions
and
7 deletions
src/aura_engine/scheduling/timetable.py
+
32
−
7
View file @
755aba8f
...
...
@@ -205,17 +205,30 @@ class TimetableService:
return
current_timeslot
def
get_next_timeslots
(
self
,
max_count
:
int
=
0
)
->
[
Timeslot
]:
def
get_next_timeslots
(
self
,
max_count
:
int
=
0
,
window_aware
=
False
)
->
[
Timeslot
]:
"""
Retrieve the timeslots to be played after the current one.
The method allows to return only a max count of timeslots. Also, timeslots which are
not within the scheduling window can be optionally omitted.
The scheduling window behaviour has these effects, when scheduling timeslots:
- Before the scheduling window: Timeslots can still be deleted in Steering and the
playout will respect this.
- During the scheduling window: Timeslots and it
'
s playlists are queued as timed
commands.
- After the scheduling window: Such timeslots are ignored, because it doesn
'
t make
sense anymore to schedule them before the next timeslot starts.
Args:
max_count (Integer): Maximum of timeslots to return. If `0` is passed, all existing
ones are returned.
window_aware (bool): If set to true, only timeslots within the scheduling window are
returned.
Returns:
([Timeslot]): The upcoming timeslots.
"""
now
=
Engine
.
engine_time
()
next_timeslots
=
[]
...
...
@@ -223,12 +236,24 @@ class TimetableService:
if
not
self
.
timetable
:
return
[]
for
timeslot
in
self
.
timetable
:
if
timeslot
.
get_start
()
>
now
:
if
(
len
(
next_timeslots
)
<
max_count
)
or
max_count
==
0
:
next_timeslots
.
append
(
timeslot
)
ts
:
Timeslot
for
ts
in
self
.
timetable
:
if
ts
.
get_start
()
>
now
:
in_window
=
self
.
is_timeslot_in_window
(
ts
)
if
not
window_aware
or
in_window
:
if
(
len
(
next_timeslots
)
<
max_count
)
or
max_count
==
0
:
next_timeslots
.
append
(
ts
)
else
:
break
else
:
break
start
=
SU
.
fmt_time
(
ts
.
get_start
())
end
=
SU
.
fmt_time
(
ts
.
get_end
())
t1
:
int
=
self
.
config
.
get
(
"
scheduling_window_start
"
)
t2
:
int
=
self
.
config
.
get
(
"
scheduling_window_end
"
)
msg
=
f
"
Skip timeslot #
{
ts
.
get_id
()
}
[
{
start
}
-
{
end
}
]
"
msg
+=
f
"
- not in scheduling window T¹-
{
t1
}
s to T²-
{
t2
}
s
"
self
.
logger
.
info
(
msg
)
print
(
msg
)
return
next_timeslots
...
...
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