Skip to content

Commit

Permalink
feat!: remove code owner optional prefix paths
Browse files Browse the repository at this point in the history
This implements a TODO comment stating that once
edx-platform import_shims is no longer used, we
could remove the _OPTIONAL_MODULE_PREFIX_PATTERN
implementation.
See https://github.com/openedx/edx-platform/tree/854502b560bda74ef898501bb2a95ce238cf794c/import_shims

Phase 1 of the code owner refactor is an opportune time
to make this clean-up because we can compare code_owner and
code_owner_2 results.

See #784
  • Loading branch information
robrap committed Dec 5, 2024
1 parent 2f09b97 commit 3f3e674
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ Added
-----
* Adds search script datadog_search.py, for searching Datadog monitors and dashboards.

[5.2.0] - 2024-12-05
~~~~~~~~~~~~~~~~~~~~
Removed
-------
* Removed code_owner optional path prefixes because edx-platform shims are no longer in use. See change for more details.

[5.1.0] - 2024-11-21
~~~~~~~~~~~~~~~~~~~~
Added
Expand Down
2 changes: 1 addition & 1 deletion edx_arch_experiments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
A plugin to include applications under development by the architecture team at 2U.
"""

__version__ = '5.1.0'
__version__ = '5.2.0'
12 changes: 0 additions & 12 deletions edx_arch_experiments/datadog_monitoring/code_owner/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Utilities for monitoring code_owner_2
"""
import logging
import re

from django.conf import settings
from edx_django_utils.monitoring import set_custom_attribute
Expand Down Expand Up @@ -95,11 +94,6 @@ def get_code_owner_mappings():
path_list = code_owner_mappings[code_owner]
for path in path_list:
path_to_code_owner_mapping[path] = code_owner
optional_module_prefix_match = _OPTIONAL_MODULE_PREFIX_PATTERN.match(path)
# if path has an optional prefix, also add the module name without the prefix
if optional_module_prefix_match:
path_without_prefix = path[optional_module_prefix_match.end():]
path_to_code_owner_mapping[path_without_prefix] = code_owner
except TypeError as e:
log.exception(
'Error processing CODE_OWNER_MAPPINGS. {}'.format(e) # pylint: disable=logging-format-interpolation
Expand Down Expand Up @@ -157,12 +151,6 @@ def clear_cached_mappings():
_CODE_OWNER_TO_THEME_AND_SQUAD_MAPPINGS = None


# TODO: Retire this once edx-platform import_shims is no longer used.
# Note: This should be ready for removal because import_shims has been removed.
# See https://github.com/openedx/edx-platform/tree/854502b560bda74ef898501bb2a95ce238cf794c/import_shims
_OPTIONAL_MODULE_PREFIX_PATTERN = re.compile(r'^(lms|common|openedx\.core)\.djangoapps\.')


# Cached lookup table for code owner theme and squad given a code owner.
# - Although code owner is "theme-squad", a hyphen may also be in the theme or squad name, so this ensures we get both
# correctly from config.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,10 @@ def setUp(self):
@ddt.data(
('xbl', None),
('xblock_2', None),
('xblock', 'team-red'),
('openedx.core.djangoapps', None),
('openedx.core.djangoapps.xblock', 'team-red'),
('openedx.core.djangoapps.xblock.views', 'team-red'),
('grades', 'team-red'),
('lms.djangoapps.grades', 'team-red'),
('xblock_django', 'team-blue'),
('common.djangoapps.xblock_django', 'team-blue'),
)
@ddt.unpack
Expand Down

0 comments on commit 3f3e674

Please sign in to comment.