Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SOaAS
psot.repository
Commits
67704550
Commit
67704550
authored
Jan 31, 2018
by
Lukas Jelonek
Browse files
Add user interface integration for psot repositories via cli and environment variable
parent
660a0d11
Changes
2
Hide whitespace changes
Inline
Side-by-side
psot/config.py
View file @
67704550
...
...
@@ -123,8 +123,20 @@ class Config:
config
[
'repository_paths'
]
=
self
.
repo_paths
return
config
def
load_config
():
return
Config
([
pkg_resources
.
resource_filename
(
'psot'
,
''
)]).
load_config
()
def
load_config
(
repositories
=
None
):
# always use the installed repository as the first repo
all_repositories
=
[
pkg_resources
.
resource_filename
(
'psot'
,
''
)]
# check for repositories via environment variable
if
'PSOT_REPOSITORIES'
in
os
.
environ
:
variable
=
os
.
environ
[
'PSOT_REPOSITORIES'
]
env_repos
=
variable
.
split
(
':'
)
all_repositories
.
extend
(
env_repos
)
if
repositories
:
all_repositories
.
extend
(
repositories
)
return
Config
(
all_repositories
).
load_config
()
if
__name__
==
"__main__"
:
"""prints the configuration"""
...
...
psot/main.py
View file @
67704550
...
...
@@ -15,6 +15,7 @@ def main():
subparsers
=
parser
.
add_subparsers
()
info_parser
=
subparsers
.
add_parser
(
'info'
)
info_parser
.
add_argument
(
'--listanalyses'
,
'-l'
,
action
=
'store_true'
,
help
=
'Show available analysis steps'
)
info_parser
.
add_argument
(
'--repository'
,
'-r'
,
action
=
'append'
,
help
=
'Include the given repository'
)
info_parser
.
set_defaults
(
func
=
info
)
analyze_parser
=
subparsers
.
add_parser
(
'analyze'
)
...
...
@@ -28,10 +29,11 @@ def main():
analyze_parser
.
add_argument
(
'--debug'
,
'-d'
,
action
=
'store_true'
,
help
=
'Debug mode, computation directory will not be removed after computation'
)
analyze_parser
.
add_argument
(
'--execution_dir'
,
'-e'
,
help
=
'Use the specified execution directory and do not delete it after the computation'
)
analyze_parser
.
add_argument
(
'--use_cluster'
,
'-C'
,
action
=
'store_true'
,
help
=
'Use compute cluster for execution'
)
analyze_parser
.
add_argument
(
'--repository'
,
'-r'
,
action
=
'append'
,
help
=
'Include the given repository'
)
analyze_parser
.
set_defaults
(
func
=
analyze
)
args
=
parser
.
parse_args
()
config
=
load_config
()
config
=
load_config
(
repositories
=
args
.
repository
)
args
.
parser
=
parser
args
.
func
(
args
,
config
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment