Skip to content

Conversation

@PProfizi
Copy link
Contributor

@PProfizi PProfizi commented Mar 22, 2023

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 ServerContext being Premium means operators are allowed to check-out a license, and is the default behavior.
The ServerContext being Entry means operators are not allowed to check-out a license and will throw an error.

A DPF Server started with a Premium ServerContext cannot 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:

  • no more need to set the default context as Premium in the conftest.py.
  • features to be tested as Entry should use a specific server started as Entry. They are moved to a specific folder and tested separately.

For examples:

  • no need to mark the examples as requiring Premium
  • no more need to set_default_server_context(Premium) in the first lines.
  • create an example on using an Entry server context

For Documentation:

  • update documentation to explain the new licensing logic

@PProfizi PProfizi added the enhancement New feature or request label Mar 22, 2023
@PProfizi PProfizi self-assigned this Mar 22, 2023
@PProfizi PProfizi added this to the v0.7.5 milestone Mar 22, 2023
@codecov
Copy link

codecov bot commented Mar 22, 2023

Codecov Report

Merging #853 (3fe4f30) into master (0dd37a8) will increase coverage by 2.12%.
The diff coverage is 71.42%.

@@            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     

@PProfizi PProfizi requested a review from cbellot000 March 23, 2023 15:16
@PProfizi PProfizi merged commit 1b13263 into master Mar 27, 2023
@PProfizi PProfizi deleted the feat/premium_as_default branch March 27, 2023 11:50
@@ -0,0 +1,85 @@
"""
.. _ref_manage_licensing:
Copy link
Contributor

@cbellot000 cbellot000 Mar 29, 2023

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?

Comment on lines +135 to +136

- **Premium:** This context, which is the default, allows DPF to perform license checkouts,
Copy link
Contributor

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,
Copy link
Contributor

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
Copy link
Contributor

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.
Copy link
Contributor

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
Copy link
Contributor

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?

Copy link
Contributor Author

@PProfizi PProfizi Mar 29, 2023

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
Copy link
Contributor

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`.
Copy link
Contributor

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
Copy link
Contributor

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.
Copy link
Contributor

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,
Copy link
Contributor

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
Copy link
Contributor

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.
Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allows you to choose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants