"tutor local upgrade --from=nutmeg" fails with "Unknown MySQL server host 'mysql' (-3)")"

I executed the following commands:

pip install --upgrade "tutor[full]"
 -> tutor, version 15.3.6

tutor local launch

tutor local stop

tutor plugins list
<disabling various plugins that I thought shouldn't be necessary in the latest version>

tutor images build all

tutor local upgrade --from=nutmeg

First a question: Did the running of “tutor local launch” actually end up upgrading from Nutmeg to Olive? The tutor instructions on upgrades are unclear whether I should run the “tutor local launch” or wait until later after the local upgrade.

In any case, the error I get (after a seemingly-successful “tutor images build all”) is:

ubuntu@ip-172-31-12-148:~$ tutor local upgrade --from=nutmeg
⚠️  This command only performs a partial upgrade of your Open edX platform. To perform a full upgrade, you should run `tutor local launch`.
docker-compose -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.prod.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.tmp.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.override.yml --project-name tutor_local -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.jobs.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.jobs.tmp.yml run --rm lms-job sh -e -c './manage.py lms compute_grades -v1 --all_courses'
Starting tutor_local_mongodb-permissions_1 ... done
Starting tutor_local_mongodb_1             ... done
Creating tutor_local_lms-job_run           ... done
Traceback (most recent call last):
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
    self.connect()
  File "/openedx/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/openedx/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 234, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/openedx/venv/lib/python3.8/site-packages/MySQLdb/__init__.py", line 123, in Connect
    return Connection(*args, **kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/MySQLdb/connections.py", line 185, in __init__
    super().__init__(*args, **kwargs2)
MySQLdb.OperationalError: (2005, "Unknown MySQL server host 'mysql' (-3)")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "./manage.py", line 106, in <module>
    execute_from_command_line([sys.argv[0]] + django_args)
  File "/openedx/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/openedx/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/openedx/venv/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/openedx/venv/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/openedx/edx-platform/lms/djangoapps/grades/management/commands/compute_grades.py", line 76, in handle
    self.enqueue_all_shuffled_tasks(options)
  File "/openedx/edx-platform/lms/djangoapps/grades/management/commands/compute_grades.py", line 83, in enqueue_all_shuffled_tasks
    for seq_id, kwargs in enumerate(self._shuffled_task_kwargs(options)):
  File "/openedx/edx-platform/lms/djangoapps/grades/management/commands/compute_grades.py", line 102, in _shuffled_task_kwargs
    for course_key in self._get_course_keys(options):
  File "/openedx/edx-platform/lms/djangoapps/grades/management/commands/compute_grades.py", line 126, in _get_course_keys
    course_keys = [course.id for course in modulestore().get_course_summaries()]
  File "/openedx/edx-platform/xmodule/modulestore/mixed.py", line 81, in inner
    retval = func(field_decorator=strip_key_collection, *args, **kwargs)
  File "/openedx/edx-platform/xmodule/modulestore/mixed.py", line 289, in get_course_summaries
    for course_summary in store.get_course_summaries(**kwargs):
  File "/openedx/edx-platform/xmodule/modulestore/split_mongo/split_draft.py", line 90, in get_course_summaries
    return super().get_course_summaries(
  File "/openedx/venv/lib/python3.8/site-packages/mongodb_proxy.py", line 55, in wrapper
    return func(*args, **kwargs)
  File "/openedx/edx-platform/xmodule/modulestore/split_mongo/split.py", line 987, in get_course_summaries
    for entry, structure_info in self._get_courselike_blocks_for_branch(branch, **kwargs):
  File "/openedx/edx-platform/xmodule/modulestore/split_mongo/split.py", line 863, in _get_courselike_blocks_for_branch
    version_guids, id_version_map = self.collect_ids_from_matching_indexes(branch, **kwargs)
  File "/openedx/edx-platform/xmodule/modulestore/split_mongo/split.py", line 894, in collect_ids_from_matching_indexes
    matching_indexes = self.find_matching_course_indexes(
  File "/openedx/edx-platform/xmodule/modulestore/split_mongo/split.py", line 520, in find_matching_course_indexes
    indexes = self.db_connection.find_matching_course_indexes(
  File "/openedx/edx-platform/xmodule/modulestore/split_mongo/mongo_connection.py", line 678, in find_matching_course_indexes
    return (course_index.as_v1_schema() for course_index in queryset)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py", line 280, in __iter__
    self._fetch_all()
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py", line 1324, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py", line 51, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1173, in execute_sql
    cursor = self.connection.cursor()
  File "/openedx/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 259, in cursor
    return self._cursor()
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 235, in _cursor
    self.ensure_connection()
  File "/openedx/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
    self.connect()
  File "/openedx/venv/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
    self.connect()
  File "/openedx/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/openedx/venv/lib/python3.8/site-packages/django/utils/asyncio.py", line 33, in inner
    return func(*args, **kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 234, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/openedx/venv/lib/python3.8/site-packages/MySQLdb/__init__.py", line 123, in Connect
    return Connection(*args, **kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/MySQLdb/connections.py", line 185, in __init__
    super().__init__(*args, **kwargs2)
django.db.utils.OperationalError: (2005, "Unknown MySQL server host 'mysql' (-3)")
ERROR: 1
Error: Command failed with status 1: docker-compose -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.prod.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.tmp.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.override.yml --project-name tutor_local -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.jobs.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.jobs.tmp.yml run --rm lms-job sh -e -c ./manage.py lms compute_grades -v1 --all_courses

But interestingly if I run “tutor local start -d” and then look at my landing page source code, it says I’ve already upgraded to olive…which was why I was wondering if maybe I wasn’t supposed to run launch after the tutor upgrade as is mentioned in the tutor instructions.

And then, just because I knew it would be a while before I heard back. I decided to try running “tutor local launch” after the failed “tutor local upgrade --from=nutmeg”, and that succeeded. And then I ran “tutor local upgrade --from=nutmeg” a 2nd time, and that succeeded too. So maybe this was just some weird transient error?