mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-27 15:37:44 +00:00
feat: async mechanism for multi-trace (#981)
* start to work on multi-trace + async * init ver of async-multi-tarce, to test * add eng-ver log * complete version of async+ mul-trace * debug * fix bug on DS_RD_SETTING.get() * update * fix bug + simplif the usage of async in multi-trace * fix mini bug of arg_name * Move local_selection into class Experiment & clean the code
This commit is contained in:
@@ -136,6 +136,11 @@ class LoopBase:
|
||||
if isinstance(limit := RD_AGENT_SETTINGS.step_semaphore, dict):
|
||||
limit = limit.get(step_name, 1) # default to 1 if not specified
|
||||
|
||||
# NOTE: we assume the record step is always the last step to modify the global environment,
|
||||
# so we set the limit to 1 to avoid race condition
|
||||
if step_name == "record":
|
||||
limit = 1
|
||||
|
||||
if step_name not in self.semaphores:
|
||||
self.semaphores[step_name] = asyncio.Semaphore(limit)
|
||||
return self.semaphores[step_name]
|
||||
|
||||
Reference in New Issue
Block a user