Product instance APIs#

Extend products#

class ansys.saf.glow.solution.products.config.IProductInstanceConfiguration(*args, **kwargs)#

Bases: Protocol

Interface to configure a product instance.

All products managed by the product instance system (HPS or PIM) must implement this interface.

get_version_configuration(version: str) → IProductInstanceVersionConfiguration#

Return the configuration of a product for a specific version.

property product_name: str#

This is the product name that is exposed by the product instance management system.

It should be consistent with the name used in the PIM light and HPS configurations.

property versions: list[str]#

The set of versions that are supported.

The last version is the default if no version is specified when an instance is created.

class ansys.saf.glow.solution.products.config.IProductInstanceVersionConfiguration(*args, **kwargs)#

Bases: Protocol

Interface to configure a given version of a product instance.

property enable_secure_flags: bool#

Must be set to True for the product instance to use the secure communication command line arguments.

property environment: dict[str, str]#

The environment variables that will be set in the environment running the execution_command.

property exe_path_for_pim: str#

(For PIM only!) The path to the product’s executable.

property execution_command: str#

This is the command line used to start the product instance process.

It can contain template variables in the form ${VAR}. Supported variables are:

  • PORT: an integer which is the port that the process should expose its service on.

  • EXECUTABLE: the full path to the executable using either the first product listed in the software_requirements for HPS or the path specified by exe_path_for_pim for PIM.

Note that for PIM this code runs just once during the YAML file generation that PIM later uses to launch the products. Thus, it’s not feasible to generate and assign resources here for each launch. For instance, attempting to generate a temporary file/directory here and passing it to the command won’t work as expected.

property health_route: str | None#

The health route for the service. Typically ‘/health’ for a HTTP service.

property insecure_flags: str#

The command line arguments needed to configure the product instance for insecure communication.

property linux_local_secure_flags: str#

The command line arguments needed to configure the product instance for secure local communication on Linux.

property linux_uds_id: str#

Template for the uds_id, which is used to identify the socket file for UDS communication.

property remote_secure_flags: str#

The command line arguments needed to configure the product instance for secure remote communication.

property service_name: str#

This is the name of the service that is exposed by the instance management system (HPS or PIM) that identifies it from other services.

It should be consistent with the name used in the PIM light amd PIM K8S configurations. Typically its something simple like grpc or http.

property service_type: ServiceType#

The type of service: grpc, http or tcp.

property software_requirements: list[ISoftware]#

(For HPS only!) The software that must be installed on the node running the execution_command.

Find built-in products at ansys-rep-application-plugins.

property windows_local_secure_flags: str#

The command line arguments needed to configure the product instance for secure local communication on Windows.

class ansys.saf.glow.solution.products.config.ISoftware(*args, **kwargs)#

Bases: Protocol

Interface to define the software requirements.

class ansys.saf.glow.solution.products.config.PimLightConfigWriter#

Bases: object

A utility class for writing PIM Light Server configuration files.

classmethod write_config(configurations_dir: Path, instance_configuration: IProductInstanceConfiguration)#

Writes the PIM configuration to a YAML file in the specified configurations directory.

Parameters:
configurations_dirPath

The path to the directory where the configuration YAML file will be written.

Examples

You can write the configuration to a directory called my_solution/product_instance_configs like this:

>>> config.write_config(Path("my_solution/product_instance_configs"))
class ansys.saf.glow.solution.products.config.PimProductInstanceVersionDefinition(definition: ansys.platform.instancemanagement.Definition)#

Bases: IProductInstanceVersionDefinition

PIM implementation to configure a given version of a product instance.

class ansys.saf.glow.solution.products.config.ProductInstanceConfigurationsManager#

Bases: object

Manage the default and custom product instance configurations.

get_products() → list[str]#

List all available products.

get_version_configuration(product_name: str, product_version: str | None = None) → tuple[str, IProductInstanceVersionConfiguration]#

Get the product instance configuration for the specified product and version.

Note: if product_version is None, returns the latest version configuration.

list_configurations() → list[IProductInstanceConfiguration]#

List all available product instance configurations.

list_versions(product_name: str) → list[str]#

List all versions configured for the given product name.

Parameters:
product_namestr

The name of the product.

load_configurations(product_instance_configs_dir: Path | None)#

Load the product instance configurations found in the specified directory.

class ansys.saf.glow.solution.products.config.ServiceType(*values)#

Bases: Enum

Define the type of API the service is using.

class ansys.saf.glow.solution.products.config.Software(name: str, version: str | None)#

Bases: object

Define the software requirements.