Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfixes - 'Sync resources' is not functioning at all #3690

Closed
pcenov opened this issue Sep 28, 2022 · 3 comments
Closed

Hotfixes - 'Sync resources' is not functioning at all #3690

pcenov opened this issue Sep 28, 2022 · 3 comments
Assignees

Comments

@pcenov
Copy link
Member

pcenov commented Sep 28, 2022

Observed behavior

I'm not observing any updates applied to my resources after trying to sync them with the resources from the channel from which they were imported.

Expected behavior

Fully functioning 'Sync resources' functionality

Steps to reproduce the issue

  1. Go to https://hotfixes.studio.learningequality.org/en/accounts/#/ and sign in as user A
  2. Share a channel with User B
  3. Sign in as User B and create a new channel by importing the resources from the shared channel
  4. As user A edit the details of a resource from the share channel (this could be an uploaded PDF file)
  5. As user B select the 'Sync resources' option and select all available options
  6. Confirm the sync operation

Additional information

Details

{"disallowed":[],"allowed":[],"changes":[],"errors":[],"successess":[],"tasks":[{"task_id":"924a22dbb7904653a7434ed023e86982","task_name":"sync-channel","traceback":"Traceback (most recent call last):\n File \"/contentcuration/contentcuration/contentcuration/viewsets/base.py\", line 920, in create_change_tracker\n yield tracker\n File \"/contentcuration/contentcuration/contentcuration/viewsets/channel.py\", line 542, in sync\n sync_channel(\n File \"/contentcuration/contentcuration/contentcuration/utils/sync.py\", line 38, in sync_channel\n node = sync_node(\n File \"/contentcuration/contentcuration/contentcuration/utils/sync.py\", line 68, in sync_node\n sync_node_tags(node, original_node)\n File \"/contentcuration/contentcuration/contentcuration/utils/sync.py\", line 100, in sync_node_tags\n new_tag, _ = ContentTag.objects.get_or_create(\n File \"/usr/local/lib/python3.9/site-packages/django/db/models/manager.py\", line 85, in manager_method\n return getattr(self.get_queryset(), name)(*args, **kwargs)\n File \"/usr/local/lib/python3.9/site-packages/django/db/models/query.py\", line 581, in get_or_create\n return self.get(**kwargs), False\n File \"/usr/local/lib/python3.9/site-packages/django/db/models/query.py\", line 439, in get\n raise self.model.MultipleObjectsReturned(\ncontentcuration.models.ContentTag.MultipleObjectsReturned: get() returned more than one ContentTag -- it returned 16!\n","progress":15,"channel_id":"98435ca3-6b2a-47b3-8b62-a59c0f9ab48a","status":"FAILURE"},{"task_id":"14bbc13444c446fc950709004033a9aa","task_name":"copy_nodes","traceback":"Traceback (most recent call last):\n File \"/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py\", line 84, in _execute\n return self.cursor.execute(sql, params)\n File \"/usr/local/lib/python3.9/site-packages/django_prometheus/db/common.py\", line 71, in execute\n return super().execute(*args, **kwargs)\npsycopg2.errors.UniqueViolation: duplicate key value violates unique constraint \"contentcuration_contentnode_tags_contentnode_id_cfa67da1_uniq\"\nDETAIL: Key (contentnode_id, contenttag_id)=(31c590565930485a8dee5ab9817c6316, 701a80aaafda4c93aaae6d6e8edc9ed3) already exists.\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/contentcuration/contentcuration/contentcuration/viewsets/base.py\", line 920, in create_change_tracker\n yield tracker\n File \"/contentcuration/contentcuration/contentcuration/viewsets/contentnode.py\", line 962, in copy\n new_node = source.copy_to(\n File \"/contentcuration/contentcuration/contentcuration/models.py\", line 1899, in copy_to\n return self._tree_manager.copy_node(self, target, position, pk, mods, excluded_descendants, can_edit_source_channel, batch_size, progress_tracker)[0]\n File \"/contentcuration/contentcuration/contentcuration/db/models/manager.py\", line 361, in copy_node\n return self._copy(\n File \"/contentcuration/contentcuration/contentcuration/db/models/manager.py\", line 391, in _copy\n copied_nodes = self._deep_copy(\n File \"/contentcuration/contentcuration/contentcuration/db/models/manager.py\", line 619, in _deep_copy\n self._copy_associated_objects(source_copy_id_map)\n File \"/contentcuration/contentcuration/contentcuration/db/models/manager.py\", line 541, in _copy_associated_objects\n self._copy_tags(source_copy_id_map)\n File \"/contentcuration/contentcuration/contentcuration/db/models/manager.py\", line 480, in _copy_tags\n self.model.tags.through.objects.bulk_create(mappings_to_create)\n File \"/usr/local/lib/python3.9/site-packages/django/db/models/manager.py\", line 85, in manager_method\n return getattr(self.get_queryset(), name)(*args, **kwargs)\n File \"/usr/local/lib/python3.9/site-packages/django/db/models/query.py\", line 514, in bulk_create\n returned_columns = self._batched_insert(\n File \"/usr/local/lib/python3.9/site-packages/django/db/models/query.py\", line 1287, in _batched_insert\n inserted_rows.extend(self._insert(\n File \"/usr/local/lib/python3.9/site-packages/django/db/models/query.py\", line 1270, in _insert\n return query.get_compiler(using=using).execute_sql(returning_fields)\n File \"/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py\", line 1416, in execute_sql\n cursor.execute(sql, params)\n File \"/usr/local/lib/python3.9/site-packages/sentry_sdk/integrations/django/__init__.py\", line 556, in execute\n return real_execute(self, sql, params)\n File \"/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py\", line 66, in execute\n return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)\n File \"/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py\", line 75, in _execute_with_wrappers\n return executor(sql, params, many, context)\n File \"/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py\", line 84, in _execute\n return self.cursor.execute(sql, params)\n File \"/usr/local/lib/python3.9/site-packages/django/db/utils.py\", line 90, in __exit__\n raise dj_exc_value.with_traceback(traceback) from exc_value\n File \"/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py\", line 84, in _execute\n return self.cursor.execute(sql, params)\n File \"/usr/local/lib/python3.9/site-packages/django_prometheus/db/common.py\", line 71, in execute\n return super().execute(*args, **kwargs)\ndjango.db.utils.IntegrityError: duplicate key value violates unique constraint \"contentcuration_contentnode_tags_contentnode_id_cfa67da1_uniq\"\nDETAIL: Key (contentnode_id, contenttag_id)=(31c590565930485a8dee5ab9817c6316, 701a80aaafda4c93aaae6d6e8edc9ed3) already exists.\n\n","progress":null,"channel_id":"98435ca3-6b2a-47b3-8b62-a59c0f9ab48a","status":"FAILURE"},{"task_id":"5a30876731284d94a739038b3de203b1","task_name":"copy_nodes","traceback":"Traceback (most recent call last):\n File \"/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py\", line 84, in _execute\n return self.cursor.execute(sql, params)\n File \"/usr/local/lib/python3.9/site-packages/django_prometheus/db/common.py\", line 71, in execute\n return super().execute(*args, **kwargs)\npsycopg2.errors.UniqueViolation: duplicate key value violates unique constraint \"contentcuration_contentnode_tags_contentnode_id_cfa67da1_uniq\"\nDETAIL: Key (contentnode_id, contenttag_id)=(ed62a59190a944e6a0b90d2aca108b72, 701a80aaafda4c93aaae6d6e8edc9ed3) already exists.\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/contentcuration/contentcuration/contentcuration/viewsets/base.py\", line 920, in create_change_tracker\n yield tracker\n File \"/contentcuration/contentcuration/contentcuration/viewsets/contentnode.py\", line 962, in copy\n new_node = source.copy_to(\n File \"/contentcuration/contentcuration/contentcuration/models.py\", line 1899, in copy_to\n return self._tree_manager.copy_node(self, target, position, pk, mods, excluded_descendants, can_edit_source_channel, batch_size, progress_tracker)[0]\n File \"/contentcuration/contentcuration/contentcuration/db/models/manager.py\", line 361, in copy_node\n return self._copy(\n File \"/contentcuration/contentcuration/contentcuration/db/models/manager.py\", line 391, in _copy\n copied_nodes = self._deep_copy(\n File \"/contentcuration/contentcuration/contentcuration/db/models/manager.py\", line 619, in _deep_copy\n self._copy_associated_objects(source_copy_id_map)\n File \"/contentcuration/contentcuration/contentcuration/db/models/manager.py\", line 541, in _copy_associated_objects\n self._copy_tags(source_copy_id_map)\n File \"/contentcuration/contentcuration/contentcuration/db/models/manager.py\", line 480, in _copy_tags\n self.model.tags.through.objects.bulk_create(mappings_to_create)\n File \"/usr/local/lib/python3.9/site-packages/django/db/models/manager.py\", line 85, in manager_method\n return getattr(self.get_queryset(), name)(*args, **kwargs)\n File \"/usr/local/lib/python3.9/site-packages/django/db/models/query.py\", line 514, in bulk_create\n returned_columns = self._batched_insert(\n File \"/usr/local/lib/python3.9/site-packages/django/db/models/query.py\", line 1287, in _batched_insert\n inserted_rows.extend(self._insert(\n File \"/usr/local/lib/python3.9/site-packages/django/db/models/query.py\", line 1270, in _insert\n return query.get_compiler(using=using).execute_sql(returning_fields)\n File \"/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py\", line 1416, in execute_sql\n cursor.execute(sql, params)\n File \"/usr/local/lib/python3.9/site-packages/sentry_sdk/integrations/django/__init__.py\", line 556, in execute\n return real_execute(self, sql, params)\n File \"/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py\", line 66, in execute\n return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)\n File \"/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py\", line 75, in _execute_with_wrappers\n return executor(sql, params, many, context)\n File \"/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py\", line 84, in _execute\n return self.cursor.execute(sql, params)\n File \"/usr/local/lib/python3.9/site-packages/django/db/utils.py\", line 90, in __exit__\n raise dj_exc_value.with_traceback(traceback) from exc_value\n File \"/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py\", line 84, in _execute\n return self.cursor.execute(sql, params)\n File \"/usr/local/lib/python3.9/site-packages/django_prometheus/db/common.py\", line 71, in execute\n return super().execute(*args, **kwargs)\ndjango.db.utils.IntegrityError: duplicate key value violates unique constraint \"contentcuration_contentnode_tags_contentnode_id_cfa67da1_uniq\"\nDETAIL: Key (contentnode_id, contenttag_id)=(ed62a59190a944e6a0b90d2aca108b72, 701a80aaafda4c93aaae6d6e8edc9ed3) already exists.\n\n","progress":null,"channel_id":"98435ca3-6b2a-47b3-8b62-a59c0f9ab48a","status":"FAILURE"}]}

Usage Details

@pcenov
Copy link
Member Author

pcenov commented Sep 28, 2022

@radinamatic @bjester

@rtibbles rtibbles self-assigned this Sep 28, 2022
@rtibbles
Copy link
Member

Relevant traceback here:

Traceback (most recent call last):
 File \"/contentcuration/contentcuration/contentcuration/viewsets/base.py\", line 920, in create_change_tracker
 yield tracker
 File \"/contentcuration/contentcuration/contentcuration/viewsets/channel.py\", line 542, in sync
 sync_channel(
     File \"/contentcuration/contentcuration/contentcuration/utils/sync.py\", line 38, in sync_channel
 node = sync_node(
     File \"/contentcuration/contentcuration/contentcuration/utils/sync.py\", line 68, in sync_node
 sync_node_tags(node, original_node)
 File \"/contentcuration/contentcuration/contentcuration/utils/sync.py\", line 100, in sync_node_tags
 new_tag, _ = ContentTag.objects.get_or_create(
     File \"/usr/local/lib/python3.9/site-packages/django/db/models/manager.py\", line 85, in manager_method
 return getattr(self.get_queryset(), name)(*args, **kwargs)
 File \"/usr/local/lib/python3.9/site-packages/django/db/models/query.py\", line 581, in get_or_create
 return self.get(**kwargs), False
 File \"/usr/local/lib/python3.9/site-packages/django/db/models/query.py\", line 439, in get
 raise self.model.MultipleObjectsReturned(
    contentcuration.models.ContentTag.MultipleObjectsReturned: get() returned more than one ContentTag -- it returned 16!

@bjester
Copy link
Member

bjester commented Sep 30, 2022

Closed by #3701

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants