rockverse.configure.config_context#
- class rockverse.configure.config_context(params)[source]#
Context manager for temporarily modifying the configuration settings.
This context manager allows for a temporary reassignment of configuration parameters. Changes made within the context manager are reverted back to the original settings once the context is exited.
Parameters:#
- paramsdict
A dictionary of configuration parameters to update.
Example:#
Temporarily change the list of allowed GPU devices:
>>> with config_context({'selected_gpus': [2, 4, 6]}): >>> # Do stuff using these 3 devices >>> my_awesome_function_that_uses_gpu() >>> . >>> . >>> . >>> # After the with block, the original configuration is restored.