This repository was archived by the owner on Apr 27, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121import atexit
2222from collections import defaultdict , Mapping
2323from concurrent .futures import ThreadPoolExecutor , wait as wait_futures
24+ from copy import copy
2425import logging
2526from random import random
2627import socket
@@ -2062,6 +2063,21 @@ def _get_execution_profile(self, ep):
20622063 except KeyError :
20632064 raise ValueError ("Invalid execution_profile: '%s'; valid profiles are %s" % (ep , profiles .keys ()))
20642065
2066+ def execution_profile_clone_update (self , ep , ** kwargs ):
2067+ """
2068+ Returns a clone of the ``ep`` profile. ``kwargs`` can be specified to update attributes
2069+ of the returned profile.
2070+
2071+ This is a shollow clone, so any objects referenced by the profile are shared. This means Load Balancing Policy
2072+ is maintained by inclusion in the active profiles. It also means updating any other rich objects will be seen
2073+ by the active profile. In cases where this is not desirable, be sure to replace the instance instead of manipulating
2074+ the shared object.
2075+ """
2076+ clone = copy (self ._get_execution_profile (ep ))
2077+ for attr , value in kwargs .items ():
2078+ setattr (clone , attr , value )
2079+ return clone
2080+
20652081 def prepare (self , query , custom_payload = None ):
20662082 """
20672083 Prepares a query string, returning a :class:`~cassandra.query.PreparedStatement`
Original file line number Diff line number Diff line change 146146
147147 .. automethod :: set_keyspace(keyspace)
148148
149+ .. automethod :: execution_profile_clone_update
150+
149151.. autoclass :: ResponseFuture ()
150152
151153 .. autoattribute :: query
You can’t perform that action at this time.
0 commit comments