Session
#
- class ansys.dpf.core.session.Session(server=None)#
Create a class to manage server sessions and handle events like progress and logging.
A class used to create a user session on the server, it allows to plan events call backs from the server: progress bar when workflows are running, logging… A session is started every time a
'DpfServer'
is created.Notes
Class available with server’s version starting at 3.0.
Overview#
Add a workflow to the session. It allows to follow the workflow’s events while it’s running. |
|
Create a workflow made of the input operator and all its ancestors to the session. |
|
Add an event handler of type |
|
Add a signal emitter to the session. This emitter will catch all incoming rpc calls. |
|
Start a progress bar and updates it every time an operator is finished. |
|
Ask the session to start recording progress events. |
|
Remove the handle on the workflow by the |
|
Clean up resources associated with the instance. |
Clean up resources associated with the instance. |
Import detail#
from ansys.dpf.core.session import Session
Method detail#
- Session.add_workflow(workflow, identifier)#
Add a workflow to the session. It allows to follow the workflow’s events while it’s running.
This method is automatically called when a workflow’s output is requested.
- Parameters:
workflow (Workflow)
identifier (str) – name given to the workflow
- Session.add_operator(operator, pin, identifier)#
Create a workflow made of the input operator and all its ancestors to the session.
It allows to follow the workflow’s events while it’s running. This method is automatically called when an operator’s output is requested and the property
ansys.dpf.core.dpf_operator.Operator.progress_bar()
is set to'True'
.- Parameters:
operator (Operator)
pin (int) – output pin number requested
identifier (str) – name given to the workflow
- Session.handle_events_with_file_logger(file_path, verbosity_level=1)#
Add an event handler of type
file_logger
server side.Events will then be caught and forwarded to the file stream.
- Parameters:
file_path (str)
verbosity_level (int) – 0, 1 or 2
- Session.start_emitting_rpc_log()#
Add a signal emitter to the session. This emitter will catch all incoming rpc calls.
Adding a handler will enable the logging ( use
Session.handle_events_with_file_logger()
).
- Session.listen_to_progress()#
Start a progress bar and updates it every time an operator is finished.
- Session.add_progress_system()#
Ask the session to start recording progress events.
Called when the session is started.
- Session.flush_workflows()#
Remove the handle on the workflow by the
session
.
- Session.delete()#
Clean up resources associated with the instance.
This method calls the deleter function to release resources. If an exception occurs during deletion, a warning is issued.
- Raises:
Warning – If an exception occurs while attempting to delete resources.
- Session.__del__()#
Clean up resources associated with the instance.