start#

Service.start(username: str = 'nexus', password: str = 'cei', create_db: bool = False, error_if_create_db_exists: bool = False, exit_on_close: bool = False, delete_db: bool = False) str#

Start a new service.

Parameters:
usernamestr, optional

Username for the service. The default is "nexus".

passwordstr, optional

Password for the service. The default is "cei".

create_dbbool, optional

Whether to create a new database before starting the service on top of it. The default is False. If True, this method creates a database in the directory specified by the db_directory parameter and starts the service on top of it. An error is raised if the directory specified by the db_directory parameter already exists and is not empty.

error_if_create_db_existsbool, optional

Whether to raise an error if the create_db parameter is set to True and the database already exists. The default is False, in which case the start() method uses the database found instead of creating one.

exit_on_closebool, optional

Whether to automatically shut down the service when exiting the script. The default is False, in which case the service continues to run.

delete_dbbool, optional

Whether to automatically delete the database when exiting the script. The default is False. This parameter is valid only if this parameter and the exit_on_close parameter are set to True.

Returns:
str

ID of the connected session.

Raises:
DatabaseDirNotProvidedError

There is no database directory associated with the Service.

CannotCreateDatabaseError

Error when creating the database.

AlreadyConnectedError

Object is already connected to a running ADR service.

StartingServiceError

Can not start the ADR service.

NotValidServer

Can not validate the current ADR service.

UnsupportedServerVersionError

The started server reports an unsupported, missing, or malformed Ansys version.

Examples

import ansys.dynamicreporting.core as adr
installation_dir = r'C:\Program Files\ANSYS Inc\v261'
adr_service = adr.Service(ansys_installation = installation_dir,
db_directory = r'D:\tmp\new_db', port = 8020)
session_guid = adr_service.start()