Configuration management#
Tools for managing Local Product Launcher configuration.
The methods in the config
class manage the default configuration
for launching products. The configuration is loaded from and stored to a
config.json
file. By default, this file is located in the user configuration
directory (platform-dependent). Its location can be specified explicitly
with the ANSYS_LAUNCHER_CONFIG_PATH
environment variable.
- ansys.tools.local_product_launcher.config.get_config_for(*, product_name, launch_mode)#
Get the configuration object for a (product, launch_mode) combination.
Get the default configuration object for the product. If a
launch_mode
parameter is given, the configuration for this mode is returned. Otherwise, the configuration for the default launch mode is returned.- Parameters:
- Return type:
- Returns:
Configuration object.
- Raises:
- ansys.tools.local_product_launcher.config.get_launch_mode_for(*, product_name, launch_mode=None)#
Get the default launch mode configured for a product.
- Parameters:
- Returns:
Launch mode for the product.
- Return type:
str or None
- ansys.tools.local_product_launcher.config.is_configured(*, product_name, launch_mode=None)#
Check if a configuration exists for the product/launch mode.
Note that if only the fallback launcher/configuration is available, this method returns
False
.
- ansys.tools.local_product_launcher.config.save_config()#
Save the configuration to a file on disk.
This method saves the current in-memory configuration to the
config.json
file.- Return type:
- ansys.tools.local_product_launcher.config.set_config_for(*, product_name, launch_mode, config, overwrite_default=False)#
Set the configuration for a given product and launch mode.
Update the configuration by setting the configuration for the given product and launch mode.
This method only updates the in-memory configuration, and it does not store it to a file.
- Parameters:
product_name (
str
) – Name of the product whose configuration to update.launch_mode (
str
) – Launch mode that the configuration applies to.config (
TypeVar
(LAUNCHER_CONFIG_T
, bound=DataclassProtocol
)) – Configuration object.overwrite_default (
bool
, default:False
) – Whether to change the default launch mode for the product to the value specified for thelaunch_mode
parameter.
- Return type: