Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.base
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
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
bob
bob.bio.base
Commits
9b8bac52
Commit
9b8bac52
authored
8 years ago
by
Manuel Günther
Browse files
Options
Downloads
Patches
Plain Diff
Implemented
#25
by adding a '--packages' option to ./bin/resources.py
parent
f19871c0
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bob/bio/base/script/resources.py
+3
-1
3 additions, 1 deletion
bob/bio/base/script/resources.py
bob/bio/base/test/test_scripts.py
+1
-1
1 addition, 1 deletion
bob/bio/base/test/test_scripts.py
bob/bio/base/utils/resources.py
+6
-3
6 additions, 3 deletions
bob/bio/base/utils/resources.py
with
10 additions
and
5 deletions
bob/bio/base/script/resources.py
+
3
−
1
View file @
9b8bac52
...
...
@@ -15,12 +15,14 @@ def resources(command_line_parameters = None):
parser
.
add_argument
(
"
--details
"
,
'
-d
'
,
action
=
'
store_true
'
,
help
=
"
Prints the complete configuration for all resources
"
)
parser
.
add_argument
(
"
--packages
"
,
'
-p
'
,
nargs
=
'
+
'
,
help
=
"
If given, shows only resources defined in the given package(s)
"
)
parser
.
add_argument
(
"
--no-strip-dummy
"
,
'
-s
'
,
action
=
'
store_true
'
,
help
=
"
If given, the dummy elements (usually used for testing purposes only) are **not** removed from the list.
"
)
args
=
parser
.
parse_args
(
command_line_parameters
)
kwargs
=
{
'
verbose
'
:
args
.
details
}
kwargs
=
{
'
verbose
'
:
args
.
details
,
"
packages
"
:
args
.
packages
}
if
args
.
no_strip_dummy
:
kwargs
[
'
strip
'
]
=
[]
...
...
This diff is collapsed.
Click to expand it.
bob/bio/base/test/test_scripts.py
+
1
−
1
View file @
9b8bac52
...
...
@@ -369,7 +369,7 @@ def test_resources():
# simply test that the collect_results script works
from
bob.bio.base.script.resources
import
resources
,
databases
with
utils
.
Quiet
():
resources
([
'
--types
'
,
'
database
'
,
'
preprocessor
'
,
'
extractor
'
,
'
algorithm
'
,
'
grid
'
,
'
--details
'
])
resources
([
'
--types
'
,
'
database
'
,
'
preprocessor
'
,
'
extractor
'
,
'
algorithm
'
,
'
grid
'
,
'
--details
'
,
'
--packages
'
,
'
bob.bio.base
'
])
databases
([])
...
...
This diff is collapsed.
Click to expand it.
bob/bio/base/utils/resources.py
+
6
−
3
View file @
9b8bac52
...
...
@@ -194,7 +194,7 @@ def resource_keys(keyword, exclude_packages=[], package_prefix='bob.bio.', strip
if
entry_point
.
dist
.
project_name
not
in
exclude_packages
])
def
list_resources
(
keyword
,
strip
=
[
'
dummy
'
],
package_prefix
=
'
bob.bio.
'
,
verbose
=
False
):
def
list_resources
(
keyword
,
strip
=
[
'
dummy
'
],
package_prefix
=
'
bob.bio.
'
,
verbose
=
False
,
packages
=
None
):
"""
Returns a string containing a detailed list of resources that are registered with the given keyword.
"""
if
keyword
not
in
valid_keywords
:
raise
ValueError
(
"
The given keyword
'
%s
'
is not valid. Please use one of %s!
"
%
(
str
(
keyword
),
str
(
valid_keywords
)))
...
...
@@ -204,7 +204,10 @@ def list_resources(keyword, strip=['dummy'], package_prefix='bob.bio.', verbose=
retval
=
""
length
=
max
(
len
(
entry_point
.
name
)
for
entry_point
in
entry_points
)
if
entry_points
else
1
for
entry_point
in
sorted
(
entry_points
,
key
=
lambda
p
:
p
.
dist
.
project_name
):
if
packages
is
not
None
:
entry_points
=
[
entry_point
for
entry_point
in
entry_points
if
entry_point
.
dist
.
project_name
in
packages
]
for
entry_point
in
sorted
(
entry_points
,
key
=
lambda
p
:
(
p
.
dist
.
project_name
,
p
.
name
)):
if
last_dist
!=
str
(
entry_point
.
dist
):
retval
+=
"
\n
- %s @ %s:
\n
"
%
(
str
(
entry_point
.
dist
),
str
(
entry_point
.
dist
.
location
))
last_dist
=
str
(
entry_point
.
dist
)
...
...
@@ -224,7 +227,7 @@ def database_directories(strip=['dummy'], replacements = None, package_prefix='b
entry_points
=
_get_entry_points
(
'
database
'
,
strip
,
package_prefix
=
package_prefix
)
dirs
=
{}
for
entry_point
in
sorted
(
entry_points
,
key
=
lambda
entry_point
:
entry_point
.
name
):
for
entry_point
in
sorted
(
entry_points
,
key
=
lambda
entry_point
:
entry_point
.
name
):
try
:
db
=
load_resource
(
entry_point
.
name
,
'
database
'
)
db
.
replace_directories
(
replacements
)
...
...
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