Service#
- class ansys.dynamicreporting.core.Service(ansys_version: int | None = None, docker_image: str = 'ghcr.io/ansys-internal/nexus', data_directory: str | None = None, db_directory: str | None = None, port: int = 8000, logfile: str | None = None, ansys_installation: str | None = None)#
Provides for creating a connection to an Ansys Dynamic Reporting service.
- Parameters:
- ansys_version
int
,optional
Three-digit format for a locally installed Ansys version. For example,
232
for Ansys 2023 R2. The default isNone
.- docker_image
str
,optional
Docker image to use if you do not have a local Ansys installation. The default is
"ghcr.io/ansys-internal/nexus"
.- data_directory
str
,optional
Path to the directory for storing temporary information from the Docker image. The default is creating a new directory inside the OS temporary directory. This parameter must pass a directory that exists and is empty.
- db_directory
str
,optional
Path to the database directory for the Ansys Dynamic Reporting service. The default is
None
. This parameter must pass a directory that exists and is empty.- port
int
,optional
Port to run the Ansys Dynamic Reporting service on. The default is
8000
.- logfile
str
,optional
File to write logs to. The default is
None
. Acceptable values are filenames orstdout
for standard output.- ansys_installation
str
,optional
Path to the directory where Ansys is installed locally. If Ansys is not installed locally but is to be run in a Docker image, set the value for this paraemter to
"docker"
.
- ansys_version
- Raises:
DatabaseDirNotProvidedError
The
"db_directory"
argument has not been provided when using a Docker image.CannotCreateDatabaseError
Can not create the
"db_directory"
when using a Docker image.InvalidAnsysPath
The
"ansys_installation"
does not correspond to a valid Ansys installation. directoryAnsysVersionAbsentError
Can not find the Ansys version number from the installation directory.
Examples
Initialize the class and connect to an Ansys Dynamic Reporting service running on the localhost on port 8010 with
username
set to"admin"
andpassword
set to"mypsw"
using a local Ansys installation:import ansys.dynamicreporting.core as adr installation_dir = r'C:\Program Files\ANSYS Inc\v232' adr_service = adr.Service(ansys_installation = installation_dir) ret = adr_service.connect(url = "http://localhost:8010", username = "admin", password = "mypsw")
Methods
Service.connect
([url, username, password, ...])Connect to a running service.
Service.create_item
([obj_name, source])Create an item that gets automatically pushed into the database.
Service.delete
(items)Delete objects from the database.
Service.get_list_reports
([r_type])Get a list of top-level reports in the database.
Service.get_report
(report_name)Get a
Report
item that corresponds to a report in the database with a given name.Service.query
([query_type, filter])Query the database.
Service.start
([username, password, ...])Start a new service.
Stop the service connected to the session.
Service.visualize_report
([report_name, ...])Render the report.
Attributes
GUID of the session associated with the service.
URL for the service.