.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/00-basic/00-launch-reporting-service.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_00-basic_00-launch-reporting-service.py: .. _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. .. GENERATED FROM PYTHON SOURCE LINES 14-23 .. code-block:: Python 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) .. GENERATED FROM PYTHON SOURCE LINES 24-29 Starting the Service ~~~~~~~~~~~~~~~~~~~~ Once a `Service` object has been created, it must be started. It can be similarly stopped. .. GENERATED FROM PYTHON SOURCE LINES 29-35 .. code-block:: Python session_guid = adr_service.start(create_db=True) # To stop the service adr_service.stop() .. GENERATED FROM PYTHON SOURCE LINES 36-45 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. .. GENERATED FROM PYTHON SOURCE LINES 45-53 .. code-block:: Python 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() .. _sphx_glr_download_examples_00-basic_00-launch-reporting-service.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 00-launch-reporting-service.ipynb <00-launch-reporting-service.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 00-launch-reporting-service.py <00-launch-reporting-service.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 00-launch-reporting-service.zip <00-launch-reporting-service.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_