geofileops.options.set_worker_type#
- static options.set_worker_type(worker_type: Literal['processes', 'threads', 'auto'] | None) _RestoreOriginalHandler#
Set the type of worker to use for parallel processing.
Possible options are:
“processes” (default if not set): use multiprocessing with separate processes.
“threads”: use multithreading within the same process.
“auto”: automatically choose the best worker type based on the operation being performed.
Remarks:
You can also set the option temporarily by using this function as a context manager.
You can also set the option by directly setting the environment variable GFO_WORKER_TYPE to one of “processes”, “threads”, or “auto”.
Added in version 0.11.0.
- Parameters:
worker_type (Literal["processes", "threads", "auto"] | None) – The type of worker to use. If None, the option is unset (so the default behavior is used).
Examples
If you want to change the default value of the option in general, you can just call it as a function:
gfo.options.set_worker_type("threads")
If you want to temporarily change the option, you can use it as a context manager:
with gfo.options.set_worker_type("threads"): gfo.buffer(...)