Session#

class ansys.dpf.core.session.Session(server=None)#

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.

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

add_operator(operator, pin, identifier)#

Creates 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

handle_events_with_file_logger(file_path, verbosity_level=1)#

Adds 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

start_emitting_rpc_log()#

Adds 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()).

listen_to_progress()#

Starts a progress bar and updates it every time an operator is finished.

add_progress_system()#

Asks the session to start recording progress events. Called when the session is started.

flush_workflows()#

This removes the handle on the workflow by the session