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:
- username
str
,optional
Username for the service. The default is
"nexus"
.- password
str
,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
. IfTrue
, this method creates a database in the directory specified by thedb_directory
parameter and starts the service on top of it. An error is raised if the directory specified by thedb_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 toTrue
and the database already exists. The default isFalse
, in which case thestart()
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 theexit_on_close
parameter are set toTrue
.
- username
- 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.
Examples
import ansys.dynamicreporting.core as adr installation_dir = r'C:\Program Files\ANSYS Inc\v232' adr_service = adr.Service(ansys_installation = installation_dir, db_directory = r'D:\tmp\new_db', port = 8020) session_guid = adr_service.start()