How to use get_lock_for_request method in localstack

Best Python code snippet using localstack_python

plugins.py

Source:plugins.py Github

copy

Full Screen

...48 @abc.abstractmethod49 def is_write_request(self, request: Request) -> bool:50 """Returns whether the given request is a write request that should trigger serialization"""51 return False52 def get_lock_for_request(self, request: Request) -> Optional[rwlock.Lockable]:53 """Returns a lock (or None) that should be used to guard the given request, for concurrency control"""54 return None55 def get_context(self) -> PersistenceContext:56 """Returns the current persistence context"""57 return None58class StateSerializerComposite(StateSerializer):59 """Composite state serializer that delegates the requests to a list of underlying concrete serializers"""60 def __init__(self, serializers: List[StateSerializer] = None):61 self.serializers: List[StateSerializer] = serializers or []62 def restore_state(self, context: PersistenceContext):63 for serializer in self.serializers:64 serializer.restore_state(context)65 def update_state(self, context: PersistenceContext, request: Request):66 for serializer in self.serializers:67 serializer.update_state(context, request)68 def is_write_request(self, request: Request) -> bool:69 return any(ser.is_write_request(request) for ser in self.serializers)70 def get_lock_for_request(self, request: Request) -> Optional[rwlock.Lockable]:71 if self.serializers:72 return self.serializers[0].get_lock_for_request(73 request74 ) # return lock from first serializer75 def get_context(self) -> PersistenceContext:76 if self.serializers:77 return self.serializers[0].get_context() # return context from first serializer78# maps service names to serializers (TODO: to be encapsulated in ServicePlugin instances)79SERIALIZERS: Dict[str, StateSerializer] = {}80# -----------------81# PLUGIN UTILITIES82# -----------------83class Plugin(object):84 def __init__(self, name, start, check=None, listener=None, priority=0, active=False):85 self.plugin_name = name86 self.start_function = start...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful