From ebe12203233b6d8d134ccf30ae42635f51b8413f Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Sat, 25 Mar 2017 21:37:07 -0700 Subject: [PATCH] Extract commands to a separate module --- dvc/command/__init__.py | 0 dvc/{ => command}/cmd_base.py | 0 dvc/{ => command}/cmd_data_import.py | 2 +- dvc/{ => command}/cmd_data_remove.py | 2 +- dvc/{ => command}/cmd_data_sync.py | 0 dvc/{ => command}/cmd_init.py | 0 dvc/{ => command}/cmd_repro.py | 10 +++++----- dvc/{ => command}/cmd_run.py | 8 ++++---- 8 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 dvc/command/__init__.py rename dvc/{ => command}/cmd_base.py (100%) rename dvc/{ => command}/cmd_data_import.py (97%) rename dvc/{ => command}/cmd_data_remove.py (97%) rename dvc/{ => command}/cmd_data_sync.py (100%) rename dvc/{ => command}/cmd_init.py (100%) rename dvc/{ => command}/cmd_repro.py (93%) rename dvc/{ => command}/cmd_run.py (97%) diff --git a/dvc/command/__init__.py b/dvc/command/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/dvc/cmd_base.py b/dvc/command/cmd_base.py similarity index 100% rename from dvc/cmd_base.py rename to dvc/command/cmd_base.py diff --git a/dvc/cmd_data_import.py b/dvc/command/cmd_data_import.py similarity index 97% rename from dvc/cmd_data_import.py rename to dvc/command/cmd_data_import.py index 7bcc57673..3ace95bed 100644 --- a/dvc/cmd_data_import.py +++ b/dvc/command/cmd_data_import.py @@ -40,7 +40,7 @@ class CmdDataImport(CmdBase): lock = fasteners.InterProcessLock(self.git.lock_file) gotten = lock.acquire(timeout=5) if not gotten: - Logger.printing('Cannot perform the command since DVC is busy and locked. Please retry the command later.') + Logger.printing('Cannot perform the cmd since DVC is busy and locked. Please retry the cmd later.') return 1 try: diff --git a/dvc/cmd_data_remove.py b/dvc/command/cmd_data_remove.py similarity index 97% rename from dvc/cmd_data_remove.py rename to dvc/command/cmd_data_remove.py index a348ebf63..babd02d5e 100644 --- a/dvc/cmd_data_remove.py +++ b/dvc/command/cmd_data_remove.py @@ -34,7 +34,7 @@ class CmdDataRemove(CmdBase): lock = fasteners.InterProcessLock(self.git.lock_file) gotten = lock.acquire(timeout=5) if not gotten: - Logger.info('Cannot perform the command since DVC is busy and locked. Please retry the command later.') + Logger.info('Cannot perform the cmd since DVC is busy and locked. Please retry the cmd later.') return 1 try: diff --git a/dvc/cmd_data_sync.py b/dvc/command/cmd_data_sync.py similarity index 100% rename from dvc/cmd_data_sync.py rename to dvc/command/cmd_data_sync.py diff --git a/dvc/cmd_init.py b/dvc/command/cmd_init.py similarity index 100% rename from dvc/cmd_init.py rename to dvc/command/cmd_init.py diff --git a/dvc/cmd_repro.py b/dvc/command/cmd_repro.py similarity index 93% rename from dvc/cmd_repro.py rename to dvc/command/cmd_repro.py index 96326e8e3..58a3b043e 100644 --- a/dvc/cmd_repro.py +++ b/dvc/command/cmd_repro.py @@ -48,7 +48,7 @@ class CmdRepro(CmdRun): lock = fasteners.InterProcessLock(self.git.lock_file) gotten = lock.acquire(timeout=5) if not gotten: - Logger.printing('Cannot perform the command since DVC is busy and locked. Please retry the command later.') + Logger.printing('Cannot perform the cmd since DVC is busy and locked. Please retry the cmd later.') return 1 try: @@ -83,7 +83,7 @@ class CmdRepro(CmdRun): break if error and not self.skip_git_actions: - Logger.error('Errors occurred. One or more repro command was not successful.') + Logger.error('Errors occurred. One or more repro cmd was not successful.') self.not_committed_changes_warning() return 1 @@ -114,11 +114,11 @@ class ReproChange(object): raise ReproError('Error: parameter {} is nor defined in state file "{}"'. format(StateFile.PARAM_NORM_ARGV, data_item.state.relative)) if len(argv) < 2: - raise ReproError('Error: reproducible command in state file "{}" is too short'. + raise ReproError('Error: reproducible cmd in state file "{}" is too short'. format(self._state.file)) # if argv[0][-3:] != '.py': - # raise ReproError('Error: reproducible command format error in state file "{}"'. + # raise ReproError('Error: reproducible cmd format error in state file "{}"'. # format(self._state.file)) self._repro_argv = argv @@ -132,7 +132,7 @@ class ReproChange(object): self._data_item.data.relative)) os.remove(self._data_item.data.relative) - Logger.debug('Reproducing data file "{}". Re-runs command: {}'.format( + Logger.debug('Reproducing data file "{}". Re-runs cmd: {}'.format( self._data_item.data.relative, ' '.join(self._repro_argv))) return self._cmd_obj.run_command(self._repro_argv) diff --git a/dvc/cmd_run.py b/dvc/command/cmd_run.py similarity index 97% rename from dvc/cmd_run.py rename to dvc/command/cmd_run.py index ca817e44c..84c7b1a58 100644 --- a/dvc/cmd_run.py +++ b/dvc/command/cmd_run.py @@ -30,9 +30,9 @@ class CmdRun(CmdBase): parser.add_argument('--stdout', help='output std output to a file') parser.add_argument('--stderr', help='output std error to a file') parser.add_argument('--input-file', '-i', action='append', - help='Declare input file for reproducible command') + help='Declare input file for reproducible cmd') parser.add_argument('--output-file', '-o', action='append', - help='Declare output file for reproducible command') + help='Declare output file for reproducible cmd') parser.add_argument('--code', '-c', action='append', help='Code file or code directory which produces the output') pass @@ -57,7 +57,7 @@ class CmdRun(CmdBase): lock = fasteners.InterProcessLock(self.git.lock_file) gotten = lock.acquire(timeout=5) if not gotten: - Logger.printing('Cannot perform the command since DVC is busy and locked. Please retry the command later.') + Logger.printing('Cannot perform the cmd since DVC is busy and locked. Please retry the cmd later.') return 1 try: @@ -156,7 +156,7 @@ class CmdRun(CmdBase): return False # if not files_states.new_files: - # Logger.error('Errors occurred. No files were changed in run command.') + # Logger.error('Errors occurred. No files were changed in run cmd.') # return False return True