Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GÉANT Service Orchestrator
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
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator
Commits
4e12f70a
Commit
4e12f70a
authored
9 months ago
by
Karel van Klink
Committed by
Neda Moeini
8 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Only run validation workflows on subscriptions that are both ACTIVE and in sync
parent
4b015e72
No related branches found
No related tags found
1 merge request
!139
Feature/add validation workflows
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gso/schedules/validate_subscriptions.py
+2
-2
2 additions, 2 deletions
gso/schedules/validate_subscriptions.py
gso/services/subscriptions.py
+9
-0
9 additions, 0 deletions
gso/services/subscriptions.py
with
11 additions
and
2 deletions
gso/schedules/validate_subscriptions.py
+
2
−
2
View file @
4e12f70a
...
...
@@ -6,7 +6,7 @@ from orchestrator.services.subscriptions import TARGET_DEFAULT_USABLE_MAP, WF_US
from
orchestrator.targets
import
Target
from
gso.schedules.scheduling
import
CronScheduleConfig
,
scheduler
from
gso.services.subscriptions
import
get_insync_subscriptions
from
gso.services.subscriptions
import
get_
active_
insync_subscriptions
from
gso.worker
import
celery
logger
=
structlog
.
get_logger
(
__name__
)
...
...
@@ -16,7 +16,7 @@ logger = structlog.get_logger(__name__)
@scheduler
(
CronScheduleConfig
(
name
=
"
Subscriptions Validator
"
,
minute
=
"
10
"
,
hour
=
"
0
"
))
def
validate_subscriptions
()
->
None
:
"""
Validate all subscriptions using their corresponding validation workflow.
"""
subscriptions
=
get_insync_subscriptions
()
subscriptions
=
get_
active_
insync_subscriptions
()
if
not
subscriptions
:
logger
.
info
(
"
No subscriptions to validate
"
)
return
...
...
This diff is collapsed.
Click to expand it.
gso/services/subscriptions.py
+
9
−
0
View file @
4e12f70a
...
...
@@ -210,6 +210,15 @@ def get_insync_subscriptions() -> list[SubscriptionTable]:
return
SubscriptionTable
.
query
.
join
(
ProductTable
).
filter
(
SubscriptionTable
.
insync
.
is_
(
True
)).
all
()
def
get_active_insync_subscriptions
()
->
list
[
SubscriptionTable
]:
"""
Retrieve all subscriptions that are currently active and in sync.
"""
return
(
SubscriptionTable
.
query
.
join
(
ProductTable
)
.
filter
(
SubscriptionTable
.
insync
.
is_
(
True
),
SubscriptionTable
.
status
.
is_
(
SubscriptionLifecycle
.
ACTIVE
))
.
all
()
)
def
get_site_by_name
(
site_name
:
str
)
->
Site
:
"""
Get a site by its name.
...
...
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