Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Scheduler
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
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
Antoine R. Dumont
Scheduler
Commits
a2771874
Verified
Commit
a2771874
authored
2 years ago
by
Antoine R. Dumont
Browse files
Options
Downloads
Patches
Plain Diff
add-forge-now: Allow scheduling of cgit task type
Refs.
swh/infra/sysadm-environment#4813
parent
c24b0c85
No related branches found
No related tags found
No related merge requests found
Pipeline
#1567
passed
2 years ago
Stage: external
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
swh/scheduler/cli/add_forge_now.py
+1
-1
1 addition, 1 deletion
swh/scheduler/cli/add_forge_now.py
swh/scheduler/cli/utils.py
+8
-3
8 additions, 3 deletions
swh/scheduler/cli/utils.py
swh/scheduler/tests/test_cli_utils.py
+20
-0
20 additions, 0 deletions
swh/scheduler/tests/test_cli_utils.py
with
29 additions
and
4 deletions
swh/scheduler/cli/add_forge_now.py
+
1
−
1
View file @
a2771874
...
...
@@ -65,7 +65,7 @@ def register_lister_cli(
# Map the associated task types for the lister
task_type_names
:
Dict
[
str
,
str
]
=
{
listing_type
:
lister_task_type
(
lister_name
,
listing_type
)
for
listing_type
in
[
"
full
"
,
"
incremental
"
]
for
listing_type
in
[
"
full
"
,
"
incremental
"
,
None
]
}
task_types
:
Dict
[
str
,
Dict
]
=
{}
...
...
This diff is collapsed.
Click to expand it.
swh/scheduler/cli/utils.py
+
8
−
3
View file @
a2771874
# Copyright (C) 2019
-2022
The Software Heritage developers
# Copyright (C) 2019 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
...
...
@@ -332,5 +332,10 @@ def task_add(
click.echo(
"
\
n
"
.join(output))
def lister_task_type(lister_name: str, lister_type: str) -> str:
return f
"
list
-
{
lister_name
}
-
{
lister_type
}
"
def lister_task_type(lister_name: str, lister_type: Optional[str] = None) -> str:
"""
Compute expected scheduler task type from the lister name and its optional
listing type (full, incremental).
"""
prefix = f
"
list
-
{
lister_name
}
"
return f
"
{
prefix
}
-
{
lister_type
}
"
if lister_type else prefix
This diff is collapsed.
Click to expand it.
swh/scheduler/tests/test_cli_utils.py
0 → 100644
+
20
−
0
View file @
a2771874
# Copyright (C) 2023 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
import
pytest
from
swh.scheduler.cli.utils
import
lister_task_type
@pytest.mark.parametrize
(
"
lister_name, lister_type, expected_task_type
"
,
[
[
"
cgit
"
,
None
,
"
list-cgit
"
],
[
"
gitlab
"
,
"
full
"
,
"
list-gitlab-full
"
],
[
"
gitea
"
,
"
incremental
"
,
"
list-gitea-incremental
"
],
],
)
def
test_lister_task_type
(
lister_name
,
lister_type
,
expected_task_type
):
assert
lister_task_type
(
lister_name
,
lister_type
)
==
expected_task_type
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