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
49ec05dd
Commit
49ec05dd
authored
4 years ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
Skip schedules in the past when deleting.
parent
383a074d
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/scheduling/calendar.py
+19
-19
19 additions, 19 deletions
modules/scheduling/calendar.py
with
19 additions
and
19 deletions
modules/scheduling/calendar.py
+
19
−
19
View file @
49ec05dd
...
@@ -108,29 +108,29 @@ class AuraCalendarService(threading.Thread):
...
@@ -108,29 +108,29 @@ class AuraCalendarService(threading.Thread):
local_schedules
=
Schedule
.
select_programme
(
datetime
.
now
())
local_schedules
=
Schedule
.
select_programme
(
datetime
.
now
())
for
local_schedule
in
local_schedules
:
for
local_schedule
in
local_schedules
:
# Only allow deletion of schedules which are before the start of the scheduling window
# Only allow deletion of schedules which are deleted before the start of the scheduling window
if
local_schedule
.
start_unix
>
now_unix
and
(
local_schedule
.
start_unix
-
scheduling_window_start
)
>
now_unix
:
if
local_schedule
.
start_unix
>
now_unix
:
if
(
local_schedule
.
start_unix
-
scheduling_window_start
)
>
now_unix
:
# Filter the local schedule from the fetched ones
existing_schedule
=
list
(
filter
(
lambda
new_schedule
:
\
# Filter the local schedule from the fetched ones
new_schedule
[
"
schedule_id
"
]
==
local_schedule
.
schedule_id
,
fetched_schedule_data
))
existing_schedule
=
list
(
filter
(
lambda
new_schedule
:
\
new_schedule
[
"
schedule_id
"
]
==
local_schedule
.
schedule_id
,
fetched_schedule_data
))
if
existing_schedule
:
# self.logger.debug("Schedule #%s is still existing remotely!" % (local_schedule.schedule_id))
if
existing_schedule
:
pass
# self.logger.debug("Schedule #%s is still existing remotely!" % (local_schedule.schedule_id))
else
:
pass
self
.
logger
.
info
(
"
Schedule #%s has been deleted remotely, hence also delete it locally [%s]
"
%
\
else
:
(
local_schedule
.
schedule_id
,
str
(
local_schedule
)))
self
.
logger
.
info
(
"
Schedule #%s has been deleted remotely, hence also delete it locally [%s]
"
%
\
local_schedule
.
delete
(
commit
=
True
)
(
local_schedule
.
schedule_id
,
str
(
local_schedule
)))
self
.
logger
.
info
(
"
Deleted local schedule #%s from database
"
%
local_schedule
.
schedule_id
)
local_schedule
.
delete
(
commit
=
True
)
self
.
logger
.
info
(
"
Deleted local schedule #%s from database
"
%
local_schedule
.
schedule_id
)
else
:
else
:
msg
=
"
Schedule #%s has been deleted remotely. Since the scheduling window already started, it won
'
t be deleted locally.
"
%
local_schedule
.
schedule_id
msg
=
"
Schedule #%s has been deleted remotely. Since the scheduling window
has
already started, it won
'
t be deleted locally.
"
%
local_schedule
.
schedule_id
self
.
logger
.
warn
(
SimpleUtil
.
red
(
msg
))
self
.
logger
.
warn
(
SimpleUtil
.
red
(
msg
))
# Process fetched schedules
# Process fetched schedules
for
schedule
in
fetched_schedule_data
:
for
schedule
in
fetched_schedule_data
:
...
...
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