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
beat
beat.cmdline
Commits
62596fc4
Commit
62596fc4
authored
May 17, 2018
by
Samuel GAIST
Browse files
Merge branch 'add_showpath_option' into '1.4.x'
Add path options to all packages to list local files See merge request
!29
parents
aaaff754
73356dc6
Pipeline
#20275
passed with stages
in 50 minutes and 7 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
beat/cmdline/algorithms.py
View file @
62596fc4
...
...
@@ -29,6 +29,7 @@
"""Usage:
%(prog)s algorithms list [--remote]
%(prog)s algorithms check [<name>]...
%(prog)s algorithms path [<name>]...
%(prog)s algorithms pull [--force] [<name>]...
%(prog)s algorithms push [--force] [--dry-run] [<name>]...
%(prog)s algorithms diff <name>
...
...
@@ -44,6 +45,7 @@
Commands:
list Lists all the algorithms available on the platform
path Displays local path of algorithm files
check Checks a local algorithm for validity
pull Downloads the specified algorithms from the server
push Uploads algorithms to the server
...
...
@@ -351,6 +353,9 @@ def process(args):
else
:
return
common
.
display_local_list
(
args
[
'config'
].
path
,
'algorithm'
)
elif
args
[
'path'
]:
return
common
.
display_local_path
(
args
[
'config'
].
path
,
'algorithm'
,
args
[
'<name>'
])
elif
args
[
'check'
]:
return
common
.
check
(
args
[
'config'
].
path
,
'algorithm'
,
args
[
'<name>'
])
...
...
beat/cmdline/common.py
View file @
62596fc4
...
...
@@ -464,6 +464,53 @@ def display_local_list(prefix, type):
return
0
def
display_local_path
(
prefix
,
type
,
names
):
'''Implements the local "path" command
Parameters:
prefix (str): A string representing the root of the path in which the user
objects are stored
type (str): One of ``database``, ``dataformat``, ``algorithm``,
``toolchain`` or ``experiment``.
Returns:
int: Indicating the exit status of the command, to be reported back to the
calling process. This value should be zero if everything works OK,
otherwise, different than zero (POSIX compliance).
'''
selected_type
=
None
if
type
not
in
NOSTORAGE
:
try
:
selected_type
=
TYPE_PLURAL
[
type
]
except
:
logger
.
error
(
"Selected type is not valid: %s"
%
type
)
return
1
else
:
selected_type
=
TYPE_NOSTORAGE
[
type
]
for
name
in
names
:
root
=
os
.
path
.
join
(
prefix
,
selected_type
)
object_path
=
os
.
path
.
join
(
root
,
name
.
rsplit
(
'/'
,
1
)[
0
])
object_files
=
[
filename
for
filename
in
os
.
listdir
(
object_path
)
if
filename
.
startswith
(
name
.
rsplit
(
'/'
,
1
)[
1
])]
if
len
(
object_files
)
>
0
:
logger
.
info
(
"Available local file(s) for type '%s' and name '%s':"
,
selected_type
,
name
)
for
filename
in
object_files
:
full_name
=
os
.
path
.
join
(
object_path
,
filename
)
logger
.
info
(
full_name
)
else
:
logger
.
info
(
"No local file(s) found for type '%s' and name '%s':"
,
selected_type
,
name
)
return
0
def
make_webapi
(
c
):
'''Instantiates an usable web-api proxy using the command-line configuration
...
...
beat/cmdline/databases.py
View file @
62596fc4
...
...
@@ -28,6 +28,7 @@
"""Usage:
%(prog)s databases list [--remote]
%(prog)s databases path [<name>]...
%(prog)s databases check [<name>]...
%(prog)s databases pull [--force] [<name>]...
%(prog)s databases push [--force] [--dry-run] [<name>]...
...
...
@@ -46,6 +47,7 @@ Arguments:
Commands:
list Lists all the databases available on the platform
path Displays local path of databases files
check Checks a local database for validity
pull Downloads the specified databases from the server
push Uploads databases to the server (must provide a valid admin token)
...
...
@@ -640,6 +642,9 @@ def process(args):
else
:
return
common
.
display_local_list
(
configuration
.
path
,
'database'
)
elif
args
[
'path'
]:
return
common
.
display_local_path
(
configuration
.
path
,
'database'
,
db_names
)
elif
args
[
'check'
]:
return
common
.
check
(
configuration
.
path
,
'database'
,
db_names
)
...
...
beat/cmdline/dataformats.py
View file @
62596fc4
...
...
@@ -28,6 +28,7 @@
"""Usage:
%(prog)s dataformats list [--remote]
%(prog)s dataformats path [<name>]...
%(prog)s dataformats check [<name>]...
%(prog)s dataformats pull [--force] [<name>]...
%(prog)s dataformats push [--force] [--dry-run] [<name>]...
...
...
@@ -42,6 +43,7 @@
Commands:
list Lists all the dataformats available on the platform
path Displays local path of dataformats files
check Checks a local dataformat for validity
pull Downloads the specified dataformats from the server
push Uploads dataformats to the server
...
...
@@ -151,6 +153,9 @@ def process(args):
else
:
return
common
.
display_local_list
(
args
[
'config'
].
path
,
'dataformat'
)
elif
args
[
'path'
]:
return
common
.
display_local_path
(
args
[
'config'
].
path
,
'dataformat'
,
args
[
'<name>'
])
elif
args
[
'check'
]:
return
common
.
check
(
args
[
'config'
].
path
,
'dataformat'
,
args
[
'<name>'
])
...
...
beat/cmdline/experiments.py
View file @
62596fc4
...
...
@@ -31,6 +31,7 @@
%(prog)s experiments caches [--list | --delete | --checksum] <name>
%(prog)s experiments list [--remote]
%(prog)s experiments check [<name>]...
%(prog)s experiments path [<name>]...
%(prog)s experiments pull [--force] [<name>]...
%(prog)s experiments push [--force] [--dry-run] [<name>]...
%(prog)s experiments diff <name>
...
...
@@ -46,6 +47,7 @@ Commands:
run Runs an experiment locally
caches Lists all cache files used by this experiment
list Lists all the experiments available on the platform
path Displays local path of experiments files
check Checks a local experiment for validity
pull Downloads the specified experiments from the server
push Uploads experiments to the server
...
...
@@ -598,6 +600,9 @@ def process(args):
else
:
return
common
.
display_local_list
(
config
.
path
,
'experiment'
)
elif
args
[
'path'
]:
return
common
.
display_local_path
(
config
.
path
,
'experiment'
,
names
)
elif
args
[
'check'
]:
return
common
.
check
(
config
.
path
,
'experiment'
,
names
)
...
...
beat/cmdline/libraries.py
View file @
62596fc4
...
...
@@ -28,6 +28,7 @@
"""Usage:
%(prog)s libraries list [--remote]
%(prog)s libraries path [<name>]...
%(prog)s libraries check [<name>]...
%(prog)s libraries pull [--force] [<name>]...
%(prog)s libraries push [--force] [--dry-run] [<name>]...
...
...
@@ -42,6 +43,7 @@
Commands:
list Lists all the libraries available on the platform
path Displays local path of libraries files
check Checks a local library for validity
pull Downloads the specified libraries from the server
push Uploads libraries to the server
...
...
@@ -146,6 +148,9 @@ def process(args):
else
:
return
common
.
display_local_list
(
args
[
'config'
].
path
,
'library'
)
elif
args
[
'path'
]:
return
common
.
display_local_path
(
args
[
'config'
].
path
,
'library'
,
args
[
'<name>'
])
elif
args
[
'check'
]:
return
common
.
check
(
args
[
'config'
].
path
,
'library'
,
args
[
'<name>'
])
...
...
beat/cmdline/plotterparameters.py
View file @
62596fc4
...
...
@@ -28,6 +28,7 @@
"""Usage:
%(prog)s plotterparameters list [--remote]
%(prog)s plotterparameters path [<name>]...
%(prog)s plotterparameters check [<name>]...
%(prog)s plotterparameters pull [--force] [<name>]...
%(prog)s plotterparameters create <name>...
...
...
@@ -39,6 +40,7 @@
Commands:
list Lists all the plotterparameters available locally
path Displays local path of plotterparameters files
check Checks a local plotterparameter for validity
pull Downloads the specified plotterparameters from the server
create Creates a new local plotterparameter
...
...
@@ -113,6 +115,9 @@ def process(args):
else
:
return
common
.
display_local_list
(
args
[
'config'
].
path
,
'plotterparameter'
)
elif
args
[
'path'
]:
return
common
.
display_local_path
(
args
[
'config'
].
path
,
'plotterparameter'
,
args
[
'<name>'
])
elif
args
[
'check'
]:
return
common
.
check
(
args
[
'config'
].
path
,
'plotterparameter'
,
args
[
'<name>'
])
...
...
beat/cmdline/plotters.py
View file @
62596fc4
...
...
@@ -28,6 +28,7 @@
"""Usage:
%(prog)s plotters list [--remote]
%(prog)s plotters path [<name>]...
%(prog)s plotters check [<name>]...
%(prog)s plotters pull [--force] [<name>]...
%(prog)s plotters plot [--show] [--force] [--sample_data] [--inputdata=<filename.json>] [--outputimage=<filename.png>] [--plotterparameter=<plotterparameter>] [<name>]...
...
...
@@ -40,6 +41,7 @@
Commands:
list Lists all the plotters available locally
path Displays local path of plotters files
check Checks a local plotter for validity
pull Downloads the specified plotters from the server
plot Plots an image
...
...
@@ -278,6 +280,9 @@ def process(args):
else
:
return
common
.
display_local_list
(
args
[
'config'
].
path
,
'plotter'
)
elif
args
[
'path'
]:
return
common
.
display_local_path
(
args
[
'config'
].
path
,
'plotter'
,
args
[
'<name>'
])
elif
args
[
'check'
]:
return
common
.
check
(
args
[
'config'
].
path
,
'plotter'
,
args
[
'<name>'
])
...
...
beat/cmdline/toolchains.py
View file @
62596fc4
...
...
@@ -28,6 +28,7 @@
"""Usage:
%(prog)s toolchains list [--remote]
%(prog)s toolchains path [<name>]...
%(prog)s toolchains check [<name>]...
%(prog)s toolchains pull [--force] [<name>]...
%(prog)s toolchains push [--force] [--dry-run] [<name>]...
...
...
@@ -43,6 +44,7 @@
Commands:
list Lists all the toolchains available on the platform
path Displays local path of toolchains files
check Checks a local toolchain for validity
pull Downloads the specified toolchains from the server
push Uploads toolchains to the server
...
...
@@ -76,6 +78,9 @@ def process(args):
else
:
return
common
.
display_local_list
(
args
[
'config'
].
path
,
'toolchain'
)
elif
args
[
'path'
]:
return
common
.
display_local_path
(
args
[
'config'
].
path
,
'toolchain'
,
args
[
'<name>'
])
elif
args
[
'check'
]:
return
common
.
check
(
args
[
'config'
].
path
,
'toolchain'
,
args
[
'<name>'
])
...
...
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