KeyStringSynchronizer
QuantConnect.Util.KeyStringSynchronizer
Bases: Object
Helper class to synchronize execution based on a string key
execute
execute(
key: str,
single_execution: bool,
action: Callable[[], Any],
) -> None
execute(
key: str,
action: Callable[
[],
QuantConnect_Util_KeyStringSynchronizer_Execute_T,
],
) -> QuantConnect_Util_KeyStringSynchronizer_Execute_T
Signature descriptions:
-
Execute the given action synchronously with any other thread using the same key
-
Execute the given function synchronously with any other thread using the same key
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The synchronization key |
required |
single_execution
|
Optional[bool]
|
True if execution should happen only once at the same time for multiple threads |
None
|
action
|
Callable[[], Any] | Callable[[], QuantConnect_Util_KeyStringSynchronizer_Execute_T]
|
The action to execute |
required |