arelle.PluginUtils
¶
See COPYRIGHT.md for copyright information.
Module Contents¶
Classes¶
Wrapper class for ProcessPoolExecutor which loads a plugin module before executing any other code. This is necessary for dynamically loaded Arelle plugins, as any functions defined within plugin modules are not imported by newly spawned processes. |
Functions¶
API¶
- arelle.PluginUtils._loadPluginModules(pluginModuleLocationsByName: dict[str, str | None]) None ¶
- class arelle.PluginUtils.PluginProcessPoolExecutor(pluginModules: collections.abc.Sequence[types.ModuleType] | types.ModuleType, maxWorkers: int | None = None, mpContext: multiprocessing.context.BaseContext | None = None)¶
Bases:
concurrent.futures.ProcessPoolExecutor
Wrapper class for ProcessPoolExecutor which loads a plugin module before executing any other code. This is necessary for dynamically loaded Arelle plugins, as any functions defined within plugin modules are not imported by newly spawned processes.
Initialization
Initializes a new ProcessPoolExecutor instance.
Args: max_workers: The maximum number of processes that can be used to execute the given calls. If None or not given then as many worker processes will be created as the machine has processors. mp_context: A multiprocessing context to launch the workers created using the multiprocessing.get_context(‘start method’) API. This object should provide SimpleQueue, Queue and Process. initializer: A callable used to initialize worker processes. initargs: A tuple of arguments to pass to the initializer. max_tasks_per_child: The maximum number of tasks a worker process can complete before it will exit and be replaced with a fresh worker process. The default of None means worker process will live as long as the executor. Requires a non-‘fork’ mp_context start method. When given, we default to using ‘spawn’ if no mp_context is supplied.