Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.devtools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
bob
bob.devtools
Commits
f997dde8
Commit
f997dde8
authored
6 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[scripts][gitlab][jobs] Add program to list running jobs
parent
a23eec60
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!26
New functionality for enabling/disabling and inspecting runners
Pipeline
#27409
passed
6 years ago
Stage: build
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
bob/devtools/scripts/jobs.py
+53
-0
53 additions, 0 deletions
bob/devtools/scripts/jobs.py
bob/devtools/scripts/runners.py
+1
-2
1 addition, 2 deletions
bob/devtools/scripts/runners.py
conda/meta.yaml
+1
-0
1 addition, 0 deletions
conda/meta.yaml
setup.py
+1
-0
1 addition, 0 deletions
setup.py
with
56 additions
and
2 deletions
bob/devtools/scripts/jobs.py
0 → 100644
+
53
−
0
View file @
f997dde8
#!/usr/bin/env python
import
os
import
click
from
.
import
bdt
from
..release
import
get_gitlab_instance
from
..log
import
verbosity_option
,
get_logger
,
echo_normal
logger
=
get_logger
(
__name__
)
@click.command
(
epilog
=
'''
Examples:
1. List running jobs on a runner defined by its description (macmini):
$ bdt gitlab jobs -vv macmini
'''
)
@click.argument
(
'
name
'
)
@click.option
(
'
-s
'
,
'
--status
'
,
type
=
click
.
Choice
([
'
running
'
,
'
success
'
,
'
failed
'
,
'
canceled
'
]),
default
=
'
running
'
,
show_default
=
True
,
help
=
'
The status of jobs we are searching for - one of
"
running
"
,
'
\
'"
success
"
,
"
failed
"
or
"
canceled
"'
)
@verbosity_option
()
@bdt.raise_on_error
def
jobs
(
name
,
status
):
"""
Lists jobs on a given runner
"""
gl
=
get_gitlab_instance
()
gl
.
auth
()
user_id
=
gl
.
user
.
attributes
[
'
id
'
]
# search for the runner to affect
the_runner
=
[
k
for
k
in
gl
.
runners
.
list
(
all
=
True
)
if
\
k
.
attributes
[
'
description
'
]
==
name
]
if
not
the_runner
:
raise
RuntimeError
(
'
Cannot find runner with description = %s
'
,
name
)
the_runner
=
the_runner
[
0
]
logger
.
info
(
'
Found runner %s (id=%d)
'
,
the_runner
.
attributes
[
'
description
'
],
the_runner
.
attributes
[
'
id
'
])
jobs
=
the_runner
.
jobs
.
list
(
all
=
True
,
status
=
status
)
logger
.
info
(
'
There are %d jobs running on %s
'
,
len
(
jobs
),
name
)
for
k
in
jobs
:
echo_normal
(
'
** job %d: %s (%s), since %s, by %s [%s]
'
%
\
(
k
.
id
,
k
.
attributes
[
'
project
'
][
'
path_with_namespace
'
],
k
.
attributes
[
'
name
'
],
k
.
attributes
[
'
started_at
'
],
k
.
attributes
[
'
user
'
][
'
username
'
],
k
.
attributes
[
'
web_url
'
]))
This diff is collapsed.
Click to expand it.
bob/devtools/scripts/runners.py
+
1
−
2
View file @
f997dde8
...
@@ -5,8 +5,7 @@ import os
...
@@ -5,8 +5,7 @@ import os
import
click
import
click
from
.
import
bdt
from
.
import
bdt
from
..release
import
get_gitlab_instance
,
update_files_with_mr
,
\
from
..release
import
get_gitlab_instance
update_files_at_master
from
..log
import
verbosity_option
,
get_logger
from
..log
import
verbosity_option
,
get_logger
logger
=
get_logger
(
__name__
)
logger
=
get_logger
(
__name__
)
...
...
This diff is collapsed.
Click to expand it.
conda/meta.yaml
+
1
−
0
View file @
f997dde8
...
@@ -78,6 +78,7 @@ test:
...
@@ -78,6 +78,7 @@ test:
-
bdt gitlab getpath --help
-
bdt gitlab getpath --help
#- bdt gitlab getpath -vv bob/bob.devtools .gitignore
#- bdt gitlab getpath -vv bob/bob.devtools .gitignore
-
bdt gitlab runners --help
-
bdt gitlab runners --help
-
bdt gitlab jobs --help
-
bdt ci --help
-
bdt ci --help
-
bdt ci base-build --help
-
bdt ci base-build --help
-
bdt ci build --help
-
bdt ci build --help
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
0
View file @
f997dde8
...
@@ -62,6 +62,7 @@ setup(
...
@@ -62,6 +62,7 @@ setup(
'
changelog = bob.devtools.scripts.changelog:changelog
'
,
'
changelog = bob.devtools.scripts.changelog:changelog
'
,
'
lasttag = bob.devtools.scripts.lasttag:lasttag
'
,
'
lasttag = bob.devtools.scripts.lasttag:lasttag
'
,
'
runners = bob.devtools.scripts.runners:runners
'
,
'
runners = bob.devtools.scripts.runners:runners
'
,
'
jobs = bob.devtools.scripts.jobs:jobs
'
,
'
visibility = bob.devtools.scripts.visibility:visibility
'
,
'
visibility = bob.devtools.scripts.visibility:visibility
'
,
'
getpath = bob.devtools.scripts.getpath:getpath
'
,
'
getpath = bob.devtools.scripts.getpath:getpath
'
,
],
],
...
...
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