Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ActEV
diva_evaluation_cli
Commits
457f0e22
Commit
457f0e22
authored
Nov 09, 2018
by
Alexandre Boyer
Browse files
Add actev status command
parent
8ac3932b
Changes
57
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
457f0e22
# Basic gitignore config
*.swp
*.pyc
*.egg-info
# Commands history
diva_evaluation_cli/bin/private_src/implementation/status/command_history.json
CHANGELOG.md
View file @
457f0e22
1.0.3 - 11.09.18
================
*
Add a new command: actev status
*
Add documentation about actev status
*
Fix a bug in actev exec when nb_videos_per_chunk was missing
*
Add actions before and after command: check video files validity in experiment-init
1.
0.2 - 10.26.18
================
...
...
diva_evaluation_cli/__init__.py
View file @
457f0e22
__version__
=
'1.0.
2
'
__version__
=
'1.0.
3
'
diva_evaluation_cli/bin/cli.py
View file @
457f0e22
...
...
@@ -21,24 +21,26 @@ import logging
import
argparse
import
sys
from
diva_evaluation_cli.bin.actev_get_system
import
ActevGetSystem
from
diva_evaluation_cli.bin.actev_system_setup
import
ActevSystemSetup
from
diva_evaluation_cli.bin.actev_validate_system
import
ActevValidateSystem
from
diva_evaluation_cli.bin.actev_design_chunks
import
ActevDesignChunks
from
diva_evaluation_cli.bin.actev_experiment_init
import
ActevExperimentInit
from
diva_evaluation_cli.bin.actev_pre_process_chunk
import
ActevPreProcessChunk
from
diva_evaluation_cli.bin.actev_process_chunk
import
ActevProcessChunk
from
diva_evaluation_cli.bin.actev_post_process_chunk
import
ActevPostProcessChunk
from
diva_evaluation_cli.bin.actev_reset_chunk
import
ActevResetChunk
from
diva_evaluation_cli.bin.actev_experiment_cleanup
import
ActevExperimentCleanup
from
diva_evaluation_cli.bin.actev_merge_chunks
import
ActevMergeChunks
from
diva_evaluation_cli.bin.actev_exec
import
ActevExec
from
diva_evaluation_cli.bin.commands.actev_get_system
import
ActevGetSystem
from
diva_evaluation_cli.bin.commands.actev_system_setup
import
ActevSystemSetup
from
diva_evaluation_cli.bin.commands.actev_validate_system
import
ActevValidateSystem
from
diva_evaluation_cli.bin.commands.actev_design_chunks
import
ActevDesignChunks
from
diva_evaluation_cli.bin.commands.actev_experiment_init
import
ActevExperimentInit
from
diva_evaluation_cli.bin.commands.actev_pre_process_chunk
import
ActevPreProcessChunk
from
diva_evaluation_cli.bin.commands.actev_process_chunk
import
ActevProcessChunk
from
diva_evaluation_cli.bin.commands.actev_post_process_chunk
import
ActevPostProcessChunk
from
diva_evaluation_cli.bin.commands.actev_reset_chunk
import
ActevResetChunk
from
diva_evaluation_cli.bin.commands.actev_experiment_cleanup
import
ActevExperimentCleanup
from
diva_evaluation_cli.bin.commands.actev_merge_chunks
import
ActevMergeChunks
from
diva_evaluation_cli.bin.commands.actev_exec
import
ActevExec
from
diva_evaluation_cli.bin.commands.actev_status
import
ActevStatus
private_subcommands
=
[
ActevGetSystem
(),
ActevValidateSystem
(),
ActevExec
()
ActevExec
(),
ActevStatus
()
]
public_subcommands
=
[
...
...
@@ -58,7 +60,7 @@ def cli_parser():
"""
logging
.
getLogger
().
setLevel
(
logging
.
INFO
)
handler
=
logging
.
StreamHandler
(
sys
.
stdout
)
handler
.
setFormatter
(
logging
.
Formatter
(
'[%(asctime)s]
%(name)s
-%(levelname)s: %(message)s'
))
handler
.
setFormatter
(
logging
.
Formatter
(
'[%(asctime)s]
diva_evaluation_cli
-%(levelname)s: %(message)s'
))
logging
.
getLogger
().
addHandler
(
handler
)
# Initialize parser
...
...
diva_evaluation_cli/bin/
private_src/private_entry_point
s/__init__.py
→
diva_evaluation_cli/bin/
command
s/__init__.py
View file @
457f0e22
File moved
diva_evaluation_cli/bin/actev_command.py
→
diva_evaluation_cli/bin/
commands/
actev_command.py
View file @
457f0e22
import
abc
import
logging
import
sys
from
diva_evaluation_cli.bin.private_src.implementation.status.status_factory
import
StatusFactory
class
ActevCommand
():
""" Abstract class that represents an actev command.
"""
__metaclass__
=
abc
.
ABCMeta
def
__init__
(
self
,
command
,
entry_point
):
def
__init__
(
self
,
command
,
entry_point
,
before_entry_point
=
None
,
after_entry_point
=
None
):
"""
@param command: string representing the name of the command
"""
self
.
command
=
command
self
.
entry_point
=
entry_point
self
.
before_entry_point
=
before_entry_point
self
.
after_entry_point
=
after_entry_point
@
abc
.
abstractmethod
def
cli_parser
(
self
,
arg_parser
):
...
...
@@ -21,6 +26,18 @@ class ActevCommand():
"""
return
def
before_command
(
self
,
args
):
""" Execute an action before executing the command
"""
if
self
.
before_entry_point
:
self
.
before_entry_point
(
**
args
.
__dict__
)
def
after_command
(
self
,
args
):
""" Execute an action after executing the command
"""
if
self
.
after_entry_point
:
self
.
after_entry_point
(
**
args
.
__dict__
)
def
command
(
self
,
args
):
""" Gets arguments and passe them to an entry point. Catch the exception occured.
...
...
@@ -28,10 +45,19 @@ class ActevCommand():
"""
del
args
.
__dict__
[
'object'
]
del
args
.
__dict__
[
'func'
]
try
:
logging
.
info
(
"Starting %s"
%
self
.
command
)
StatusFactory
.
generateStatus
(
self
,
'start'
,
args
.
__dict__
)
self
.
before_command
(
args
)
self
.
entry_point
(
**
args
.
__dict__
)
self
.
after_command
(
args
)
logging
.
info
(
"%s done"
%
self
.
command
)
StatusFactory
.
generateStatus
(
self
,
'done'
,
args
.
__dict__
)
except
:
logging
.
exception
(
"Issue during %s"
%
self
.
command
)
raise
StatusFactory
.
generateStatus
(
self
,
'issue'
,
args
.
__dict__
)
sys
.
exit
(
1
)
diva_evaluation_cli/bin/actev_design_chunks.py
→
diva_evaluation_cli/bin/
commands/
actev_design_chunks.py
View file @
457f0e22
...
...
@@ -15,7 +15,7 @@ nb_video-per-chunk or n: number of videos in the chunk
Warning: this file should not be modified: see src/entry_points to add your source code.
"""
from
diva_evaluation_cli.bin.actev_command
import
ActevCommand
from
diva_evaluation_cli.bin.
commands.
actev_command
import
ActevCommand
from
diva_evaluation_cli.src.entry_points.actev_design_chunks
import
entry_point
...
...
diva_evaluation_cli/bin/actev_exec.py
→
diva_evaluation_cli/bin/
commands/
actev_exec.py
View file @
457f0e22
...
...
@@ -22,8 +22,8 @@ Warning: this file should not be modified: see src/entry_points to add your sour
"""
import
logging
from
diva_evaluation_cli.bin.actev_command
import
ActevCommand
from
diva_evaluation_cli.bin.private_src.
private_
entry_points.actev_exec
import
entry_point
from
diva_evaluation_cli.bin.
commands.
actev_command
import
ActevCommand
from
diva_evaluation_cli.bin.private_src.entry_points.actev_exec
import
entry_point
class
ActevExec
(
ActevCommand
):
...
...
diva_evaluation_cli/bin/actev_experiment_cleanup.py
→
diva_evaluation_cli/bin/
commands/
actev_experiment_cleanup.py
View file @
457f0e22
...
...
@@ -10,7 +10,7 @@ Warning: this file should not be modified: see src/entry_points to add your sour
"""
import
logging
from
diva_evaluation_cli.bin.actev_command
import
ActevCommand
from
diva_evaluation_cli.bin.
commands.
actev_command
import
ActevCommand
from
diva_evaluation_cli.src.entry_points.actev_experiment_cleanup
import
entry_point
...
...
diva_evaluation_cli/bin/actev_experiment_init.py
→
diva_evaluation_cli/bin/
commands/
actev_experiment_init.py
View file @
457f0e22
...
...
@@ -19,13 +19,14 @@ Warning: this file should not be modified: see src/entry_points to add your sour
"""
import
logging
from
diva_evaluation_cli.bin.actev_command
import
ActevCommand
from
diva_evaluation_cli.bin.commands.actev_command
import
ActevCommand
from
diva_evaluation_cli.bin.private_src.entry_points.actev_experiment_init
import
before_entry_point
from
diva_evaluation_cli.src.entry_points.actev_experiment_init
import
entry_point
class
ActevExperimentInit
(
ActevCommand
):
def
__init__
(
self
):
super
(
ActevExperimentInit
,
self
).
__init__
(
'experiment-init'
,
entry_point
)
super
(
ActevExperimentInit
,
self
).
__init__
(
'experiment-init'
,
entry_point
,
before_entry_point
=
before_
entry_point
)
def
cli_parser
(
self
,
arg_parser
):
""" Configure the description and the arguments (positional and optional) to parse.
...
...
diva_evaluation_cli/bin/actev_get_system.py
→
diva_evaluation_cli/bin/
commands/
actev_get_system.py
View file @
457f0e22
...
...
@@ -18,9 +18,9 @@ Warning: this file should not be modified: see src/entry_points to add your sour
"""
import
logging
from
diva_evaluation_cli.bin.actev_command
import
ActevCommand
from
diva_evaluation_cli.bin.private_src.
private_
entry_points.actev_get_system
import
entry_point
from
diva_evaluation_cli.bin.private_src.system
_types
.system_types_definition
import
system_types
from
diva_evaluation_cli.bin.
commands.
actev_command
import
ActevCommand
from
diva_evaluation_cli.bin.private_src.entry_points.actev_get_system
import
entry_point
from
diva_evaluation_cli.bin.private_src.
implementation.get_
system.system_types_definition
import
system_types
class
ActevGetSystem
(
ActevCommand
):
...
...
diva_evaluation_cli/bin/
private_src/system_type
s/__init__.py
→
diva_evaluation_cli/bin/
commands/actev_get_system_subcommand
s/__init__.py
View file @
457f0e22
File moved
diva_evaluation_cli/bin/
private_src/
system_
types/
commands/docker_command.py
→
diva_evaluation_cli/bin/
commands/actev_get_
system_
sub
commands/docker_command.py
View file @
457f0e22
...
...
@@ -14,7 +14,7 @@ password or p: password to access the url
Warning: this file should not be modified.
"""
from
diva_evaluation_cli.bin.actev_command
import
ActevCommand
from
diva_evaluation_cli.bin.
commands.
actev_command
import
ActevCommand
class
ActevGetSystemDocker
(
ActevCommand
):
...
...
diva_evaluation_cli/bin/
private_src/
system_
types/
commands/git_command.py
→
diva_evaluation_cli/bin/
commands/actev_get_
system_
sub
commands/git_command.py
View file @
457f0e22
...
...
@@ -17,7 +17,7 @@ install-cli or i: install the cli to use it
Warning: this file should not be modified.
"""
from
diva_evaluation_cli.bin.actev_command
import
ActevCommand
from
diva_evaluation_cli.bin.
commands.
actev_command
import
ActevCommand
class
ActevGetSystemGit
(
ActevCommand
):
...
...
diva_evaluation_cli/bin/
private_src/
system_
types/
commands/other_command.py
→
diva_evaluation_cli/bin/
commands/actev_get_
system_
sub
commands/other_command.py
View file @
457f0e22
...
...
@@ -16,7 +16,7 @@ token or t: token to access the url
Warning: this file should not be modified.
"""
from
diva_evaluation_cli.bin.actev_command
import
ActevCommand
from
diva_evaluation_cli.bin.
commands.
actev_command
import
ActevCommand
class
ActevGetSystemOther
(
ActevCommand
):
...
...
diva_evaluation_cli/bin/actev_merge_chunks.py
→
diva_evaluation_cli/bin/
commands/
actev_merge_chunks.py
View file @
457f0e22
...
...
@@ -15,7 +15,7 @@ chunk-ids or i: list of chunk ids
Warning: this file should not be modified: see src/entry_points to add your source code.
"""
from
diva_evaluation_cli.bin.actev_command
import
ActevCommand
from
diva_evaluation_cli.bin.
commands.
actev_command
import
ActevCommand
from
diva_evaluation_cli.src.entry_points.actev_merge_chunks
import
entry_point
...
...
diva_evaluation_cli/bin/actev_post_process_chunk.py
→
diva_evaluation_cli/bin/
commands/
actev_post_process_chunk.py
View file @
457f0e22
...
...
@@ -15,7 +15,7 @@ Warning: this file should not be modified: see src/entry_points to add your sour
"""
import
logging
from
diva_evaluation_cli.bin.actev_command
import
ActevCommand
from
diva_evaluation_cli.bin.
commands.
actev_command
import
ActevCommand
from
diva_evaluation_cli.src.entry_points.actev_post_process_chunk
import
entry_point
...
...
diva_evaluation_cli/bin/actev_pre_process_chunk.py
→
diva_evaluation_cli/bin/
commands/
actev_pre_process_chunk.py
View file @
457f0e22
...
...
@@ -15,7 +15,7 @@ Warning: this file should not be modified: see src/entry_points to add your sour
"""
import
logging
from
diva_evaluation_cli.bin.actev_command
import
ActevCommand
from
diva_evaluation_cli.bin.
commands.
actev_command
import
ActevCommand
from
diva_evaluation_cli.src.entry_points.actev_pre_process_chunk
import
entry_point
class
ActevPreProcessChunk
(
ActevCommand
):
...
...
diva_evaluation_cli/bin/actev_process_chunk.py
→
diva_evaluation_cli/bin/
commands/
actev_process_chunk.py
View file @
457f0e22
...
...
@@ -15,7 +15,7 @@ Warning: this file should not be modified: see src/entry_points to add your sour
"""
import
logging
from
diva_evaluation_cli.bin.actev_command
import
ActevCommand
from
diva_evaluation_cli.bin.
commands.
actev_command
import
ActevCommand
from
diva_evaluation_cli.src.entry_points.actev_process_chunk
import
entry_point
...
...
diva_evaluation_cli/bin/actev_reset_chunk.py
→
diva_evaluation_cli/bin/
commands/
actev_reset_chunk.py
View file @
457f0e22
...
...
@@ -15,7 +15,7 @@ Warning: this file should not be modified: see src/entry_points to add your sour
"""
import
logging
from
diva_evaluation_cli.bin.actev_command
import
ActevCommand
from
diva_evaluation_cli.bin.
commands.
actev_command
import
ActevCommand
from
diva_evaluation_cli.src.entry_points.actev_reset_chunk
import
entry_point
...
...
Prev
1
2
3
Next
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