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

Changing the master-slave terminology #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/rome/core/session/fake_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def flush(self, *args, **kwargs):


#
# def get_session(use_slave=False, **kwargs):
# # facade = _create_facade_lazily(use_slave)
# def get_session(use_subordinate=False, **kwargs):
# # facade = _create_facade_lazily(use_subordinate)
# # return facade.get_session(**kwargs)
#
# return FakeSession()
8 changes: 4 additions & 4 deletions lib/rome/utils/MemoizationDecorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __call__(self, *args, **kwargs):
should_retry = False
item["modification_lock"].release()
if should_retry:
# memory has been destroyed by a master call, simply abort it and repeat the method.
# memory has been destroyed by a main call, simply abort it and repeat the method.
return self.__call__(*args, **kwargs)
# Wait for the expected value.
result = item["result_queue"].get()
Expand All @@ -67,7 +67,7 @@ def __call__(self, *args, **kwargs):
self.insertion_lock.release()

if should_retry:
# memory has been initialised by a quicker concurrent call, simply abort it and become a slave.
# memory has been initialised by a quicker concurrent call, simply abort it and become a subordinate.
return self.__call__(*args, **kwargs)

# compute the expected value and store it in a shared memory.
Expand All @@ -85,11 +85,11 @@ def __call__(self, *args, **kwargs):
# delete the memory item
item = self.memory[call_hash]

# send to concurrent slave calls.
# send to concurrent subordinate calls.
for i in range(item["waiting_threads_count"]):
item["result_queue"].put(result)

# Once there are no more slave calls, the item can be destroyed
# Once there are no more subordinate calls, the item can be destroyed
item["modification_lock"].acquire()
self.insertion_lock.acquire()
del self.memory[call_hash]
Expand Down
2 changes: 1 addition & 1 deletion test/glance/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def get_engine():
# return facade.get_session(autocommit=autocommit,
# expire_on_commit=expire_on_commit)

def get_session(use_slave = False, **kwargs):
def get_session(use_subordinate = False, **kwargs):
return RomeSession()

def clear_db_env():
Expand Down
2 changes: 1 addition & 1 deletion test/glance/test_image_get_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def _drop_protected_attrs(model_class, values):
if attr in values:
del values[attr]

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
2 changes: 1 addition & 1 deletion test/glance/test_image_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _drop_protected_attrs(model_class, values):
if attr in values:
del values[attr]

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
2 changes: 1 addition & 1 deletion test/nova/features/test_convert_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import datetime
import pytz

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
2 changes: 1 addition & 1 deletion test/nova/methods/test__action_get_by_request_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
2 changes: 1 addition & 1 deletion test/nova/methods/test__instance_data_get_for_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
2 changes: 1 addition & 1 deletion test/nova/methods/test_aggregate_get_by_metadata_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand All @@ -44,12 +44,12 @@ def model_query(context, *args, **kwargs):
return RomeQuery(*args, **kwargs)

def _block_device_mapping_get_query(context, session=None,
columns_to_join=None, use_slave=False):
columns_to_join=None, use_subordinate=False):
if columns_to_join is None:
columns_to_join = []

query = model_query(context, models.BlockDeviceMapping,
session=session, use_slave=use_slave)
session=session, use_subordinate=use_subordinate)

for column in columns_to_join:
query = query.options(joinedload(column))
Expand All @@ -58,8 +58,8 @@ def _block_device_mapping_get_query(context, session=None,


def block_device_mapping_get_all_by_instance(context, instance_uuid,
use_slave=False):
return _block_device_mapping_get_query(context, use_slave=use_slave).\
use_subordinate=False):
return _block_device_mapping_get_query(context, use_subordinate=use_subordinate).\
filter_by(instance_uuid=instance_uuid).\
all()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
2 changes: 1 addition & 1 deletion test/nova/methods/test_compute_node_get_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
6 changes: 3 additions & 3 deletions test/nova/methods/test_conductor_service_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand All @@ -39,9 +39,9 @@ def model_query(context, *args, **kwargs):
return RomeQuery(*args, **kwargs)

def _service_get(context, service_id, with_compute_node=True, session=None,
use_slave=False):
use_subordinate=False):
query = model_query(context, models.Service, session=session,
use_slave=use_slave).\
use_subordinate=use_subordinate).\
filter_by(id=service_id)

# if with_compute_node:
Expand Down
2 changes: 1 addition & 1 deletion test/nova/methods/test_ensure_default_secgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import logging

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
2 changes: 1 addition & 1 deletion test/nova/methods/test_extract_flavor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
2 changes: 1 addition & 1 deletion test/nova/methods/test_fixed_ip_associate_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
2 changes: 1 addition & 1 deletion test/nova/methods/test_fixed_ip_from_db_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
2 changes: 1 addition & 1 deletion test/nova/methods/test_fixed_ip_get_by_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
2 changes: 1 addition & 1 deletion test/nova/methods/test_fixed_ip_get_by_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
2 changes: 1 addition & 1 deletion test/nova/methods/test_fixed_ip_get_by_instance_uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
2 changes: 1 addition & 1 deletion test/nova/methods/test_fixed_ip_get_by_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
2 changes: 1 addition & 1 deletion test/nova/methods/test_flavor_get_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
2 changes: 1 addition & 1 deletion test/nova/methods/test_flavor_get_by_flavor_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
2 changes: 1 addition & 1 deletion test/nova/methods/test_get_by_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
2 changes: 1 addition & 1 deletion test/nova/methods/test_instance_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)


def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand Down
12 changes: 6 additions & 6 deletions test/nova/methods/test_instance_get_active_by_window_joined.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand All @@ -53,14 +53,14 @@ def _network_get_query(context, session=None):
read_deleted="no")

def _instance_get_all_query(context, project_only=False,
joins=None, use_slave=False):
joins=None, use_subordinate=False):
if joins is None:
joins = ['info_cache', 'security_groups']

query = model_query(context,
models.Instance,
project_only=project_only,
use_slave=use_slave)
use_subordinate=use_subordinate)
# for join in joins:
# query = query.options(joinedload(join))
return query
Expand All @@ -71,7 +71,7 @@ def _instance_pcidevs_get_multi(context, instance_uuids, session=None):
filter(models.PciDevice.instance_uuid.in_(instance_uuids))

def _instances_fill_metadata(context, instances,
manual_joins=None, use_slave=False):
manual_joins=None, use_subordinate=False):
"""Selectively fill instances with manually-joined metadata. Note that
instance will be converted to a dict.
:param context: security context
Expand Down Expand Up @@ -128,9 +128,9 @@ def _manual_join_columns(columns_to_join):

def instance_get_active_by_window_joined(context, begin, end=None,
project_id=None, host=None,
use_slave=False):
use_subordinate=False):
"""Return instances and joins that were active during window."""
session = get_session(use_slave=use_slave)
session = get_session(use_subordinate=use_subordinate)
query = session.query(models.Instance)

query = query.options(joinedload('info_cache')).\
Expand Down
10 changes: 5 additions & 5 deletions test/nova/methods/test_instance_get_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
INSTANCE_OPTIONAL_ATTRS = (_INSTANCE_OPTIONAL_JOINED_FIELDS +
_INSTANCE_OPTIONAL_NON_COLUMN_FIELDS)

def get_session(use_slave=False, **kwargs):
def get_session(use_subordinate=False, **kwargs):
# return FakeSession()
return RomeSession()
# return OldRomeSession()
Expand All @@ -55,7 +55,7 @@ def _manual_join_columns(columns_to_join):

def instance_get_all_by_filters(context, filters, sort_key, sort_dir,
limit=None, marker=None, columns_to_join=None,
use_slave=False):
use_subordinate=False):
"""Return instances that match all filters. Deleted instances
will be returned by default, unless there's a filter that says
otherwise.
Expand Down Expand Up @@ -89,10 +89,10 @@ def instance_get_all_by_filters(context, filters, sort_key, sort_dir,

sort_fn = {'desc': desc, 'asc': asc}

# if CONF.database.slave_connection == '':
# use_slave = False
# if CONF.database.subordinate_connection == '':
# use_subordinate = False

session = get_session(use_slave=use_slave)
session = get_session(use_subordinate=use_subordinate)

if columns_to_join is None:
columns_to_join = ['info_cache', 'security_groups']
Expand Down
Loading