The server_context.py module#

Summary#

LicenseContextManager

Can optionally be used to check out a license before using licensed DPF Operators.

ServerContext

The context defines whether DPF capabilities requiring a license checkout are allowed.

AvailableServerContexts

Defines available server contexts.

LicensingContextType

Enum representing different types of licensing contexts.

set_default_server_context

Set this context as default for any new server.

Description#

ServerContext.

Gives the ability to choose the context with which the server should be started. The context allows you to choose the licensing logic for operators. For every context, DPF always checks if an Ansys license is available. By default, a Premium type of ServerContext is used, meaning that any operator requiring a license check-out can do so. The Entry context instead does not allow operators to check a license out, which will result in failure of operators requiring it. The default context can be overwritten using the ANSYS_DPF_SERVER_CONTEXT environment variable. ANSYS_DPF_SERVER_CONTEXT=ENTRY and ANSYS_DPF_SERVER_CONTEXT=PREMIUM can be used.

Module detail#

server_context.set_default_server_context(context=AvailableServerContexts.premium) None#

Set this context as default for any new server.

Also applies it to the global server if it is running as Entry and requested context is Premium.

The context enables to choose whether DPF capabilities requiring a license checkout are allowed.

Parameters:

context (ServerContext) – Context to apply to the given server or to the newly started servers (when no server is given).

Notes

Available with server’s version starting at 6.0 (Ansys 2023R2).

server_context.DPF_SERVER_CONTEXT_ENV = 'ANSYS_DPF_SERVER_CONTEXT'#
server_context.SERVER_CONTEXT#
server_context.default_context#