summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRebeccah <rhunter@redhat.com>2020-06-16 23:53:07 +0200
committerRebeccah <rhunter@redhat.com>2020-06-18 21:52:59 +0200
commit118e1b8df1f02213b87491e9b8583b844560f27d (patch)
treea7a7e61376051dccea44ff478925aa34c9d8df57
parentMerge pull request #6911 from AlanCoding/rm_all_scripts (diff)
downloadawx-118e1b8df1f02213b87491e9b8583b844560f27d.tar.xz
awx-118e1b8df1f02213b87491e9b8583b844560f27d.zip
removing memchache mentions in comments
remove memcached folder as it is no longer needed, also address a couple grammatical errors
-rw-r--r--awx/api/generics.py2
-rw-r--r--awx/conf/settings.py6
-rw-r--r--awx/conf/tests/unit/test_settings.py34
-rw-r--r--awx/main/db/profiled_pg/base.py10
-rw-r--r--awx/main/dispatch/pool.py2
-rw-r--r--awx/main/management/commands/regenerate_secret_key.py2
-rw-r--r--awx/main/management/commands/run_dispatcher.py2
-rw-r--r--awx/main/tests/conftest.py4
-rw-r--r--awx/settings/development.py1
-rw-r--r--docs/tasks.md4
-rw-r--r--tools/memcached/.dir_placeholder1
11 files changed, 16 insertions, 52 deletions
diff --git a/awx/api/generics.py b/awx/api/generics.py
index 83780ad03c..2fcf1b3edb 100644
--- a/awx/api/generics.py
+++ b/awx/api/generics.py
@@ -980,7 +980,7 @@ class CopyAPIView(GenericAPIView):
if hasattr(new_obj, 'admin_role') and request.user not in new_obj.admin_role.members.all():
new_obj.admin_role.members.add(request.user)
if sub_objs:
- # store the copied object dict into memcached, because it's
+ # store the copied object dict into cache, because it's
# often too large for postgres' notification bus
# (which has a default maximum message size of 8k)
key = 'deep-copy-{}'.format(str(uuid.uuid4()))
diff --git a/awx/conf/settings.py b/awx/conf/settings.py
index 17521526fd..98a39978d3 100644
--- a/awx/conf/settings.py
+++ b/awx/conf/settings.py
@@ -31,18 +31,18 @@ logger = logging.getLogger('awx.conf.settings')
# Store a special value to indicate when a setting is not set in the database.
SETTING_CACHE_NOTSET = '___notset___'
-# Cannot store None in memcached; use a special value instead to indicate None.
+# Cannot store None in cache; use a special value instead to indicate None.
# If the special value for None is the same as the "not set" value, then a value
# of None will be equivalent to the setting not being set (and will raise an
# AttributeError if there is no other default defined).
# SETTING_CACHE_NONE = '___none___'
SETTING_CACHE_NONE = SETTING_CACHE_NOTSET
-# Cannot store empty list/tuple in memcached; use a special value instead to
+# Cannot store empty list/tuple in cache; use a special value instead to
# indicate an empty list.
SETTING_CACHE_EMPTY_LIST = '___[]___'
-# Cannot store empty dict in memcached; use a special value instead to indicate
+# Cannot store empty dict in cache; use a special value instead to indicate
# an empty dict.
SETTING_CACHE_EMPTY_DICT = '___{}___'
diff --git a/awx/conf/tests/unit/test_settings.py b/awx/conf/tests/unit/test_settings.py
index a8344e4bf4..7e3058e344 100644
--- a/awx/conf/tests/unit/test_settings.py
+++ b/awx/conf/tests/unit/test_settings.py
@@ -66,15 +66,6 @@ def test_unregistered_setting(settings):
assert settings.cache.get('DEBUG') is None
-def test_cached_settings_unicode_is_auto_decoded(settings):
- # https://github.com/linsomniac/python-memcached/issues/79
- # https://github.com/linsomniac/python-memcached/blob/288c159720eebcdf667727a859ef341f1e908308/memcache.py#L961
-
- value = 'Iñtërnâtiônàlizætiøn' # this simulates what python-memcached does on cache.set()
- settings.cache.set('DEBUG', value)
- assert settings.cache.get('DEBUG') == 'Iñtërnâtiônàlizætiøn'
-
-
def test_read_only_setting(settings):
settings.registry.register(
'AWX_READ_ONLY',
@@ -254,31 +245,6 @@ def test_setting_from_db(settings, mocker):
assert settings.cache.get('AWX_SOME_SETTING') == 'FROM_DB'
-@pytest.mark.parametrize('encrypted', (True, False))
-def test_setting_from_db_with_unicode(settings, mocker, encrypted):
- settings.registry.register(
- 'AWX_SOME_SETTING',
- field_class=fields.CharField,
- category=_('System'),
- category_slug='system',
- default='DEFAULT',
- encrypted=encrypted
- )
- # this simulates a bug in python-memcached; see https://github.com/linsomniac/python-memcached/issues/79
- value = 'Iñtërnâtiônàlizætiøn'
-
- setting_from_db = mocker.Mock(id=1, key='AWX_SOME_SETTING', value=value)
- mocks = mocker.Mock(**{
- 'order_by.return_value': mocker.Mock(**{
- '__iter__': lambda self: iter([setting_from_db]),
- 'first.return_value': setting_from_db
- }),
- })
- with mocker.patch('awx.conf.models.Setting.objects.filter', return_value=mocks):
- assert settings.AWX_SOME_SETTING == 'Iñtërnâtiônàlizætiøn'
- assert settings.cache.get('AWX_SOME_SETTING') == 'Iñtërnâtiônàlizætiøn'
-
-
@pytest.mark.defined_in_file(AWX_SOME_SETTING='DEFAULT')
def test_read_only_setting_assignment(settings):
"read-only settings cannot be overwritten"
diff --git a/awx/main/db/profiled_pg/base.py b/awx/main/db/profiled_pg/base.py
index ab1f9a7c93..2a449437ce 100644
--- a/awx/main/db/profiled_pg/base.py
+++ b/awx/main/db/profiled_pg/base.py
@@ -24,7 +24,7 @@ class RecordedQueryLog(object):
try:
self.threshold = cache.get('awx-profile-sql-threshold')
except Exception:
- # if we can't reach memcached, just assume profiling's off
+ # if we can't reach the cache, just assume profiling's off
self.threshold = None
def append(self, query):
@@ -110,7 +110,7 @@ class RecordedQueryLog(object):
class DatabaseWrapper(BaseDatabaseWrapper):
"""
This is a special subclass of Django's postgres DB backend which - based on
- the value of a special flag in memcached - captures slow queries and
+ the value of a special flag in cache - captures slow queries and
writes profile and Python stack metadata to the disk.
"""
@@ -133,19 +133,19 @@ class DatabaseWrapper(BaseDatabaseWrapper):
# is the same mechanism used by libraries like the django-debug-toolbar)
#
# in _this_ implementation, we represent it as a property which will
- # check memcache for a special flag to be set (when the flag is set, it
+ # check the cache for a special flag to be set (when the flag is set, it
# means we should start recording queries because somebody called
# `awx-manage profile_sql`)
#
# it's worth noting that this property is wrapped w/ @memoize because
# Django references this attribute _constantly_ (in particular, once
- # per executed query); doing a memcached.get() _at most_ once per
+ # per executed query); doing a cache.get() _at most_ once per
# second is a good enough window to detect when profiling is turned
# on/off by a system administrator
try:
threshold = cache.get('awx-profile-sql-threshold')
except Exception:
- # if we can't reach memcached, just assume profiling's off
+ # if we can't reach the cache, just assume profiling's off
threshold = None
self.queries_log.threshold = threshold
return threshold is not None
diff --git a/awx/main/dispatch/pool.py b/awx/main/dispatch/pool.py
index 4e784afbe1..f5b38262ad 100644
--- a/awx/main/dispatch/pool.py
+++ b/awx/main/dispatch/pool.py
@@ -222,7 +222,7 @@ class WorkerPool(object):
idx = len(self.workers)
# It's important to close these because we're _about_ to fork, and we
# don't want the forked processes to inherit the open sockets
- # for the DB and memcached connections (that way lies race conditions)
+ # for the DB and cache connections (that way lies race conditions)
django_connection.close()
django_cache.close()
worker = PoolWorker(self.queue_size, self.target, (idx,) + self.target_args)
diff --git a/awx/main/management/commands/regenerate_secret_key.py b/awx/main/management/commands/regenerate_secret_key.py
index 2e3d1a127d..61a2c46b4c 100644
--- a/awx/main/management/commands/regenerate_secret_key.py
+++ b/awx/main/management/commands/regenerate_secret_key.py
@@ -82,7 +82,7 @@ class Command(BaseCommand):
OAuth2Application.objects.filter(pk=app.pk).update(client_secret=encrypted)
def _settings(self):
- # don't update memcached, the *actual* value isn't changing
+ # don't update the cache, the *actual* value isn't changing
post_save.disconnect(on_post_save_setting, sender=Setting)
for setting in Setting.objects.filter().order_by('pk'):
if settings_registry.is_setting_encrypted(setting.key):
diff --git a/awx/main/management/commands/run_dispatcher.py b/awx/main/management/commands/run_dispatcher.py
index e22baa379f..fb8c1b4a6b 100644
--- a/awx/main/management/commands/run_dispatcher.py
+++ b/awx/main/management/commands/run_dispatcher.py
@@ -44,7 +44,7 @@ class Command(BaseCommand):
# It's important to close these because we're _about_ to fork, and we
# don't want the forked processes to inherit the open sockets
- # for the DB and memcached connections (that way lies race conditions)
+ # for the DB and cache connections (that way lies race conditions)
django_connection.close()
django_cache.close()
diff --git a/awx/main/tests/conftest.py b/awx/main/tests/conftest.py
index f79c3a7b39..409a4504ba 100644
--- a/awx/main/tests/conftest.py
+++ b/awx/main/tests/conftest.py
@@ -131,8 +131,8 @@ def mock_cache():
def pytest_runtest_teardown(item, nextitem):
# clear Django cache at the end of every test ran
- # NOTE: this should not be memcache, see test_cache in test_env.py
- # this is a local test cache, so we want every test to start with empty cache
+ # NOTE: this should not be memcache (as it is deprecated), nor should it be redis.
+ # This is a local test cache, so we want every test to start with an empty cache
cache.clear()
diff --git a/awx/settings/development.py b/awx/settings/development.py
index 851e3245b5..2b6e1162a8 100644
--- a/awx/settings/development.py
+++ b/awx/settings/development.py
@@ -21,7 +21,6 @@ from split_settings.tools import optional, include
# Load default settings.
from .defaults import * # NOQA
-# don't use memcache when running tests
if "pytest" in sys.modules:
CACHES = {
'default': {
diff --git a/docs/tasks.md b/docs/tasks.md
index 4fea6d4ef4..13d7f969b6 100644
--- a/docs/tasks.md
+++ b/docs/tasks.md
@@ -263,9 +263,9 @@ This entire process enables a response of a `202 Accepted`, where instead of wai
#### Handle Setting Changes
-Any time the user changes a setting in AWX (_e.g._, in `api/v2/settings`), data will be added to or altered in a database. Since querying databases directly can be extremely time-consuming, each node in a cluster runs a local `memcached` server, none of which are aware of each other. They all potentially have different values contained within, but ultimately need to be consistent. So how can this be accomplished?
+Any time the user changes a setting in AWX (_e.g._, in `api/v2/settings`), data will be added to or altered in a database. Since querying databases directly can be extremely time-consuming, each node in a cluster runs a local `redis-cache` server, none of which are aware of each other. They all potentially have different values contained within, but ultimately need to be consistent. So how can this be accomplished?
-"Handle Setting Changes" provides the solution! This "fanout" task (_i.e._, all nodes execute it) makes it so that there is a single source of truth even within a clustered system. Whenever a database setting is accessed, and that setting's name is not present in `memcached`, it grabs the setting from the database and then populates it in the applicable node's cache. When any database setting gets altered, all of the `memcached` servers on each node needs to "forget" the value that they previously retained. By deleting the setting in `memcached` on all nodes with the use of this task, we assure that the next time it is accessed, the database will be consulted for the most up-to-date value.
+"Handle Setting Changes" provides the solution! This "fanout" task (_i.e._, all nodes execute it) makes it so that there is a single source of truth even within a clustered system. Whenever a database setting is accessed, and that setting's name is not present in `redis-cache`, it grabs the setting from the database and then populates it in the applicable node's cache. When any database setting gets altered, all of the `redis-cache` servers on each node needs to "forget" the value that they previously retained. By deleting the setting in `redis-cache` on all nodes with the use of this task, we assure that the next time it is accessed, the database will be consulted for the most up-to-date value.
### Analytics and Administrative Tasks
diff --git a/tools/memcached/.dir_placeholder b/tools/memcached/.dir_placeholder
deleted file mode 100644
index 12ff59c525..0000000000
--- a/tools/memcached/.dir_placeholder
+++ /dev/null
@@ -1 +0,0 @@
-This dir must pre-exist and be owned by the user you are launching awx dev env as. If the dir does not exist before launching the awx dev environment then docker will create the dir and it will be owned by root. Since we start our awx dev environment with user: ${CURRENT_UID} the memcached container will be unable to create a socket file in a directory owned by root.