-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path00-launch-reporting-service.py
52 lines (38 loc) · 1.71 KB
/
00-launch-reporting-service.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""
.. _ref_launch_reporting_service:
Launching the Ansys Dynamic Reporting Service
=============================================
To launch the service, provide an Ansys installation directory as a string.
You can provide an existing, empty, directory if you intend to create a database.
.. note::
This example assumes that you have a local Ansys installation.
"""
import ansys.dynamicreporting.core as adr
db_dir = "C:\\tmp\\my_local_db_directory"
ansys_ins = "C:\\Program Files\\Ansys Inc\\v241"
adr_service = adr.Service(ansys_installation=ansys_ins, db_directory=db_dir)
###############################################################################
# Starting the Service
# ~~~~~~~~~~~~~~~~~~~~
# Once a `Service` object has been created, it must be started. It can be
# similarly stopped.
#
session_guid = adr_service.start(create_db=True)
# To stop the service
adr_service.stop()
###############################################################################
# Connecting to a remote Service
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# You may need to connect to a service that is already running. To do so create
# a Service object, as before, but leave off the database argument and this time,
# call the `connect` method and provide connection details, including any
# credentials required. If no username and password were set when creating the
# database, you can leave these fields empty and the default values will be
# used.
#
ansys_ins = r"C:\Program Files\Ansys Inc\v241"
adr_service = adr.Service(ansys_installation=ansys_ins)
adr_service.connect(url="http://localhost:8000", username="user", password="p455w0rd")
# To stop the service
# sphinx_gallery_thumbnail_path = '_static/00_create_db_0.png'
adr_service.stop()