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
Jira
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
1a277beb
Verified
Commit
1a277beb
authored
1 month ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
Add CLI for running scheduled tasks
parent
d42cdfa0
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!420
Improve logging in the subscription validation task
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gso/__init__.py
+2
-1
2 additions, 1 deletion
gso/__init__.py
gso/cli/schedule.py
+47
-0
47 additions, 0 deletions
gso/cli/schedule.py
with
49 additions
and
1 deletion
gso/__init__.py
+
2
−
1
View file @
1a277beb
...
...
@@ -65,10 +65,11 @@ def init_gso_app() -> OrchestratorCore:
def
init_cli_app
()
->
typer
.
Typer
:
"""
Initialise GSO as a CLI application.
"""
from
gso.cli
import
imports
,
netbox
# noqa: PLC0415
from
gso.cli
import
imports
,
netbox
,
schedule
# noqa: PLC0415
cli_app
.
add_typer
(
imports
.
app
,
name
=
"
import-cli
"
)
cli_app
.
add_typer
(
netbox
.
app
,
name
=
"
netbox-cli
"
)
cli_app
.
add_typer
(
schedule
.
app
,
name
=
"
schedule-cli
"
)
return
cli_app
()
...
...
This diff is collapsed.
Click to expand it.
gso/cli/schedule.py
0 → 100644
+
47
−
0
View file @
1a277beb
"""
CLI for interacting with the task scheduler. Only supports running a single task.
"""
# <!-- vale off -->
# Copyright 2019-2020 SURF.
# Copyright 2025 GÉANT Vereniging.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# <!-- vale on -->
import
logging
from
collections.abc
import
Callable
import
typer
from
gso.schedules.clean_old_tasks
import
clean_old_tasks
from
gso.schedules.send_email_notifications
import
send_email_notifications
from
gso.schedules.validate_products
import
validate_products
from
gso.schedules.validate_subscriptions
import
validate_subscriptions
logger
=
logging
.
getLogger
(
__name__
)
app
:
typer
.
Typer
=
typer
.
Typer
()
ALL_SCHEDULES
:
list
[
Callable
]
=
[
clean_old_tasks
,
send_email_notifications
,
validate_products
,
validate_subscriptions
,
]
@app.command
()
def
run_task
(
task_name
:
str
)
->
None
:
"""
Force the execution of a task by name.
"""
for
s
in
ALL_SCHEDULES
:
if
task_name
==
s
.
__name__
:
s
()
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