-
Notifications
You must be signed in to change notification settings - Fork 23
Set Premium as the default ServerContext #853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ng Premium as it is now the new default. Keep them marked.
…lobal server already running.
Codecov Report
@@ Coverage Diff @@
## master #853 +/- ##
==========================================
+ Coverage 86.44% 88.57% +2.12%
==========================================
Files 72 72
Lines 8220 8224 +4
==========================================
+ Hits 7106 7284 +178
+ Misses 1114 940 -174 |
…k_to_premium in conftest.py
…tion (which runs everything on one python process, making the Inprocess server Premium)
| @@ -0,0 +1,85 @@ | |||
| """ | |||
| .. _ref_manage_licensing: | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @JennaPaikowsky, sorry for the late notice, I see that you were not added in the PR, would you mind giving us some feedback on this new example please? @PProfizi, can you follow up on Jenna's comment please?
|
|
||
| - **Premium:** This context, which is the default, allows DPF to perform license checkouts, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Premium: This default context allows DPF to perform license checkouts, .......
| - **Entry:** This context, which is the default, loads the minimum capabilities without requiring any license checkout. | ||
| - **Premium:** This context enables **Entry** capabilities and the capabilities that require a license checkout, making | ||
| more operators available. | ||
| - **Premium:** This context, which is the default, allows DPF to perform license checkouts, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same text change comment as previous.
| Server Context of type LicensingContextType.entry with no xml path | ||
| .. warning:: | ||
| As starting an ``InProcess`` server means linking the DPF binaries to your current python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to your current Python....
| process, you cannot start a new ``InProcess`` server. Thus, if your local ``InProcess`` server | ||
| is already **Premium**, you cannot set it back as **Entry**. | ||
| ``InProcess`` being the default server type, the proper commands to work as **Entry** should be | ||
| set right at the beginning of your script. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set at the start of your script.
| print(out) | ||
|
|
||
| ############################################################################################### | ||
| # When Premium, using a LicenseContextManaged allows to control your interaction with a license |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PProfizi what does "control" mean, maybe you could describe what the LicenseContextManager can be used for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cbellot000 I am adding a bit more explanations, but compared to the examples in the dosctring of the LicenseContextManager, I personally would rather promote the with statement in this example compared to the rest.
| """ | ||
| .. _ref_manage_licensing: | ||
| Manage the DPF licensing logic via the server context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manage the DPF licensing logic using the server context
| Manage the DPF licensing logic via the server context | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| This examples shows how to manage the licensing logic of a DPF server using a `ServerContext`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example shows how....
| This examples shows how to manage the licensing logic of a DPF server using a `ServerContext`. | ||
| Preventing DPF from checking licenses out and blocking increments is possible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can prevent DPF from checking licenses out and blocking increments by using the Entry context.
| is already **Premium**, you cannot set it back as **Entry**. | ||
| ``InProcess`` being the default server type, the proper commands to work as **Entry** should be | ||
| set right at the beginning of your script. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cannot start a new InProcess server, as starting a server means linking the DPF binaries to your current Python process. If your local InProcess server is already set to Premium, you cannot set it back to Entry.
Since InProcess is the default server type, put the commands to set the Entry server context at the start of your script.
| # The context is shown as Entry | ||
| print(server.context) | ||
|
|
||
| # A server of type InProcess being linked to the current python process, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python
| print(out) | ||
|
|
||
| ############################################################################################### | ||
| # When Premium, using a LicenseContextManaged allows to control your interaction with a license |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allows you to control....
| Snake case name of the plugin it belongs to. | ||
| license: str | ||
| Optional license name to check out to run the operator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional license name to check out that is used to run the operator.
| Gives the ability to choose the context with which the server should be started. | ||
| The context allows to choose which capabilities are available. | ||
| By default, an **Entry** type of :class:`ServerContext` is used. | ||
| The context allows to choose the licensing logic for operators. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allows you to choose
Starting with
dpf_server_2023.2.pre1, the licensing logic changes to an operator-based logic where each operator is tagged as either requiring a given (specific or any among a list) license to be checked-out, or as only requiring a license to exist.This means the
ServerContextbeing Premium means operators are allowed to check-out a license, and is the default behavior.The
ServerContextbeing Entry means operators are not allowed to check-out a license and will throw an error.A DPF Server started with a Premium
ServerContextcannot be set back to Entry.Thus, the
server_context.py/set_default_server_context()function should not try to apply an new default Entry context to an already running global server started as Premium.For testing, having new servers being Premium by default means that:
conftest.py.For examples:
For Documentation: