Skip to content

Commit

Permalink
Revert shell feedback heuristics & progress (#3197)
Browse files Browse the repository at this point in the history
* Revert "Asking the user for feedback using custom heuristic (#3139)"

This reverts commit 274a9fc.

* Revert progress change

* minor changes that can be included

* Final fixes
  • Loading branch information
derekbekoe authored May 5, 2017
1 parent 2cd1931 commit 39a8fcd
Show file tree
Hide file tree
Showing 21 changed files with 62 additions and 624 deletions.
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ adal==0.4.3
applicationinsights==0.10.0
argcomplete==1.8.0
colorama==0.3.7
humanfriendly==2.4
jmespath
mock==1.3.0
paramiko==2.0.2
Expand Down
6 changes: 0 additions & 6 deletions src/azure-cli-core/azure/cli/core/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import azure.cli.core.azlogging as azlogging
from azure.cli.core.util import todict, truncate_text, CLIError, read_file_content
from azure.cli.core._config import az_config
import azure.cli.core.commands.progress as progress

import azure.cli.core.telemetry as telemetry

Expand Down Expand Up @@ -128,11 +127,6 @@ def __init__(self, configuration=None):

self.parser = AzCliCommandParser(prog='az', parents=[self.global_parser])
self.configuration = configuration
self.progress_controller = progress.ProgressHook()

def get_progress_controller(self):
self.progress_controller.init_progress(progress.get_progress_view())
return self.progress_controller

def initialize(self, configuration):
self.configuration = configuration
Expand Down
14 changes: 2 additions & 12 deletions src/azure-cli-core/azure/cli/core/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import azure.cli.core.azlogging as azlogging
import azure.cli.core.telemetry as telemetry
from azure.cli.core.util import CLIError
from azure.cli.core.application import APPLICATION
from azure.cli.core.prompting import prompt_y_n, NoTTYException
from azure.cli.core._config import az_config, DEFAULTS_SECTION
from azure.cli.core.profiles import ResourceType, supported_api_version
Expand Down Expand Up @@ -125,13 +126,10 @@ def __setattr__(self, name, value):

class LongRunningOperation(object): # pylint: disable=too-few-public-methods

def __init__(self, start_msg='', finish_msg='',
poller_done_interval_ms=1000.0, progress_controller=None):
def __init__(self, start_msg='', finish_msg='', poller_done_interval_ms=1000.0):
self.start_msg = start_msg
self.finish_msg = finish_msg
self.poller_done_interval_ms = poller_done_interval_ms
from azure.cli.core.application import APPLICATION
self.progress_controller = progress_controller or APPLICATION.get_progress_controller()

def _delay(self):
time.sleep(self.poller_done_interval_ms / 1000.0)
Expand All @@ -140,9 +138,7 @@ def __call__(self, poller):
from msrest.exceptions import ClientException
logger.info("Starting long running operation '%s'", self.start_msg)
correlation_message = ''
self.progress_controller.begin()
while not poller.done():
self.progress_controller.add(message='Running')
try:
# pylint: disable=protected-access
correlation_id = json.loads(
Expand All @@ -155,10 +151,8 @@ def __call__(self, poller):
try:
self._delay()
except KeyboardInterrupt:
self.progress_controller.stop()
logger.error('Long running operation wait cancelled. %s', correlation_message)
raise

try:
result = poller.result()
except ClientException as client_exception:
Expand All @@ -167,7 +161,6 @@ def __call__(self, poller):
fault_type='failed-long-running-operation',
summary='Unexpected client exception in {}.'.format(LongRunningOperation.__name__))
message = getattr(client_exception, 'message', client_exception)
self.progress_controller.stop()

try:
message = '{} {}'.format(
Expand All @@ -183,7 +176,6 @@ def __call__(self, poller):

logger.info("Long running operation '%s' completed with result %s",
self.start_msg, result)
self.progress_controller.end()
return result


Expand Down Expand Up @@ -240,8 +232,6 @@ def __init__(self, name, handler, description=None, table_transformer=None,

@staticmethod
def _should_load_description():
from azure.cli.core.application import APPLICATION

return not APPLICATION.session['completer_active']

def load_arguments(self):
Expand Down
142 changes: 0 additions & 142 deletions src/azure-cli-core/azure/cli/core/commands/progress.py

This file was deleted.

17 changes: 0 additions & 17 deletions src/azure-cli-core/azure/cli/core/test_utils/vcr_test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,6 @@ def _mock_operation_delay(_):
return


class _MockOutstream(object):
""" mock outstream for testing """
def __init__(self):
self.string = ''

def write(self, message):
self.string = message

def flush(self):
pass


def _mock_get_progress_view(determinant=False, out=None): # pylint: disable=unused-argument
return _MockOutstream()


# TEST CHECKS


Expand Down Expand Up @@ -389,7 +373,6 @@ def _execute_live_or_recording(self):
if callable(tear_down) and not self.skip_teardown:
self.tear_down()

@mock.patch('azure.cli.core.commands.progress.get_progress_view', _mock_get_progress_view)
@mock.patch('azure.cli.core._profile.Profile.load_cached_subscriptions', _mock_subscriptions)
@mock.patch('azure.cli.core._profile.CredsCache.retrieve_token_for_user',
_mock_user_access_token) # pylint: disable=line-too-long
Expand Down
1 change: 0 additions & 1 deletion src/azure-cli-core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
'applicationinsights',
'argcomplete>=1.8.0',
'colorama',
'humanfriendly',
'jmespath',
'msrest>=0.4.4',
'msrestazure>=0.4.7',
Expand Down
99 changes: 0 additions & 99 deletions src/azure-cli-core/tests/test_progress.py

This file was deleted.

3 changes: 1 addition & 2 deletions src/azure-cli-testsdk/azure/cli/testsdk/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from .patches import (patch_load_cached_subscriptions, patch_main_exception_handler,
patch_retrieve_token_for_user, patch_long_run_operation_delay,
patch_time_sleep_api, patch_progress_controller)
patch_time_sleep_api)
from .exceptions import CliExecutionError
from .const import (ENV_LIVE_TEST, ENV_SKIP_ASSERT, ENV_TEST_DIAGNOSE, MOCKED_SUBSCRIPTION_ID)
from .recording_processors import (SubscriptionRecordingProcessor, OAuthRequestResponsesFilter,
Expand Down Expand Up @@ -160,7 +160,6 @@ def setUp(self):
patch_long_run_operation_delay(self)
patch_load_cached_subscriptions(self)
patch_retrieve_token_for_user(self)
patch_progress_controller(self)

def tearDown(self):
os.environ = self.original_env
Expand Down
Loading

0 comments on commit 39a8fcd

Please sign in to comment.