forked from openedx/edx-enterprise
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request openedx#1733 from openedx/asheehan-edx/cleaning-up…
…-lost-transmission-audits feat: new mark orphaned transmisisions command and logic to remove du…
- Loading branch information
Showing
12 changed files
with
458 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
..._channels/integrated_channel/management/commands/mark_orphaned_content_metadata_audits.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
Mark all content metadata audit records not directly connected to a customer's catalogs as orphaned. | ||
""" | ||
import logging | ||
|
||
from django.core.management.base import BaseCommand | ||
|
||
from integrated_channels.integrated_channel.management.commands import IntegratedChannelCommandMixin | ||
from integrated_channels.integrated_channel.tasks import mark_orphaned_content_metadata_audit | ||
|
||
LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
class Command(IntegratedChannelCommandMixin, BaseCommand): | ||
""" | ||
Mark all content metadata audit records not directly connected to a customer's catalogs as orphaned. | ||
./manage.py lms mark_orphaned_content_metadata_audits | ||
""" | ||
|
||
def handle(self, *args, **options): | ||
""" | ||
Mark all content metadata audit records not directly connected to a customer's catalogs as orphaned. | ||
""" | ||
try: | ||
mark_orphaned_content_metadata_audit.delay() | ||
except Exception as exc: # pylint: disable=broad-except | ||
LOGGER.exception(f'Failed to mark orphaned content metadata audits. Task failed with exception: {exc}') |
32 changes: 32 additions & 0 deletions
32
integrated_channels/integrated_channel/migrations/0027_orphanedcontenttransmissions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Generated by Django 3.2.18 on 2023-03-31 18:14 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import django.utils.timezone | ||
import model_utils.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('integrated_channel', '0026_genericenterprisecustomerpluginconfiguration_last_modified_at'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='OrphanedContentTransmissions', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')), | ||
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')), | ||
('integrated_channel_code', models.CharField(max_length=30)), | ||
('plugin_configuration_id', models.PositiveIntegerField()), | ||
('content_id', models.CharField(max_length=255)), | ||
('resolved', models.BooleanField(default=False)), | ||
('transmission', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='orphaned_record', to='integrated_channel.contentmetadataitemtransmission')), | ||
], | ||
options={ | ||
'index_together': {('integrated_channel_code', 'plugin_configuration_id', 'resolved')}, | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.