From 18540126b0cfa0704bca0ff5082f3e87e623e000 Mon Sep 17 00:00:00 2001 From: Bihan Zhang Date: Wed, 7 Dec 2016 14:46:49 -0500 Subject: [PATCH] Revert "Add --ignore-running-workers option to pulp-manage-db" This reverts commit e0a950c517bde193992d9f862e091cad56b1c223. re #2469 https://pulp.plan.io/issues/2469 --- docs/user-guide/troubleshooting.rst | 8 -------- server/pulp/server/db/manage.py | 22 ++++++++-------------- server/test/unit/server/db/test_manage.py | 2 +- 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/docs/user-guide/troubleshooting.rst b/docs/user-guide/troubleshooting.rst index 37ed74ce65..00f5d59283 100644 --- a/docs/user-guide/troubleshooting.rst +++ b/docs/user-guide/troubleshooting.rst @@ -286,11 +286,3 @@ Workers not releasing memory See the :ref:`process recycling documentation` for more information on how to have your Pulp workers return memory back to the system. - -pulp-manage-db prompts for running workers when running automated upgrade -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -While running an automated upgrade to Pulp 2.11.x Pulp will prompt you that you have running -workers even though all workers are stopped. When this happens please call `pulp-manage-db` with -the `--ignore-running-workers` flag. This flag should only be used in automation, and the -automation is responsible for ensuring all pulp processes are stopped before the upgrade proceeds. diff --git a/server/pulp/server/db/manage.py b/server/pulp/server/db/manage.py index 08c8cc6e7c..13271b48a1 100644 --- a/server/pulp/server/db/manage.py +++ b/server/pulp/server/db/manage.py @@ -54,11 +54,6 @@ def parse_args(): parser.add_option('--dry-run', action='store_true', dest='dry_run', default=False, help=_('Perform a dry run with no changes made. Returns 1 if there are ' 'migrations to apply.')) - - parser.add_option('--ignore-running-workers', action='store_true', - dest='ignore_running_workers', default=False, - help=_('Runs migrations without checking for running workers. ' - 'Please ensure there are no running works before using this flag.')) options, args = parser.parse_args() if args: parser.error(_('Unknown arguments: %s') % ', '.join(args)) @@ -201,15 +196,14 @@ def main(): _start_logging() connection.initialize(max_timeout=1) - if not options.ignore_running_workers: - # Prompt the user if there are workers that have not timed out - if filter(lambda worker: (UTCDateTimeField().to_python(datetime.now()) - - worker['last_heartbeat']) < - timedelta(seconds=constants.CELERY_TIMEOUT_SECONDS), status.get_workers()): - if not _user_input_continue('There are still running workers, continuing could ' - 'corrupt your Pulp installation. Are you sure you wish ' - 'to continue?'): - return os.EX_OK + # Prompt the user if there are workers that have not timed out + if filter(lambda worker: (UTCDateTimeField().to_python(datetime.now()) - + worker['last_heartbeat']) < + timedelta(seconds=constants.CELERY_TIMEOUT_SECONDS), status.get_workers()): + if not _user_input_continue('There are still running workers, continuing could ' + 'corrupt your Pulp installation. Are you sure you wish ' + 'to continue?'): + return os.EX_OK return _auto_manage_db(options) except UnperformedMigrationException: return 1 diff --git a/server/test/unit/server/db/test_manage.py b/server/test/unit/server/db/test_manage.py index c85d7bdfb3..bc17a41f4c 100644 --- a/server/test/unit/server/db/test_manage.py +++ b/server/test/unit/server/db/test_manage.py @@ -592,7 +592,7 @@ def test_dry_run_no_changes(self, mock_file_config, mock_parse_args, initialize, mocked_apply_migration, mock_entry, getLogger, mock_ensure_indexes): logger = MagicMock() getLogger.return_value = logger - mock_args = Namespace(dry_run=True, test=False, ignore_running_workers=True) + mock_args = Namespace(dry_run=True, test=False) mock_parse_args.return_value = mock_args # Test that when dry run is on, it returns 1 if migrations remain