fix: allow session launcher parameters to be reset#434
fix: allow session launcher parameters to be reset#434olevski merged 6 commits intorelease-amaltheas-migrationfrom
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
659480c to
4ccfc03
Compare
be5272b to
b1932ee
Compare
4ccfc03 to
3a75082
Compare
b1932ee to
fd2e56c
Compare
3a75082 to
3930efa
Compare
fd2e56c to
df3bb88
Compare
3930efa to
4c4b1d7
Compare
squashme: use the amalthea session cache
4c4b1d7 to
a8165cb
Compare
Allows the API to accept None as input for args, command and the session launcher resource class ID so that they can be reset to their defaults in patch endpoints.
a8165cb to
5bbbf85
Compare
Panaetius
left a comment
There was a problem hiding this comment.
We had to solve the same issue in renku-python in the past, but we solved it with a specific object instance, not a type: https://github.com/SwissDataScienceCenter/renku-python/blob/develop/renku/domain_model/constant.py#L23
The benefit is that you can just use object id equality instead of isinstance checks, so it functions much more like regular None does than just a type. E.g. https://github.com/SwissDataScienceCenter/renku-python/blob/develop/renku/domain_model/constant.py#L23
I.e. there's only ever a single NO_VALUE object that contains nothing, except for the python object id, which is the same.
This is a common idiom for sentinel values, there is a PEP to have better support for sentinels but it's still a draft: https://peps.python.org/pep-0661/
The downside is that the object() approach doesn't have a nice repr, though not sure if we care about that.
You can use a class with a repr, but then it's important that you use the type as the value, not an instance, to have it behave like None does. This is discussed in a bit more detail in https://python-patterns.guide/python/sentinel-object/ and https://www.revsys.com/tidbits/sentinel-values-python/
In any case, we should use one of the more standard approaches.
|
@Panaetius ok I will switch to something like the example from renku python. |
Allows the API to accept None as input for args, command and the session launcher resource class ID so that they can be reset to their defaults in patch endpoints.
Allows the API to accept None as input for args, command and the session launcher resource class ID so that they can be reset to their defaults in patch endpoints.
Allows the API to accept None as input for args, command and the session launcher resource class ID so that they can be reset to their defaults in patch endpoints.
Allows the API to accept None as input for args, command and the session launcher resource class ID so that they can be reset to their defaults in patch endpoints.
Allows the API to accept None as input for args, command and the session launcher resource class ID so that they can be reset to their defaults in patch endpoints.
Allows the API to accept None as input for args, command and the session launcher resource class ID so that they can be reset to their defaults in patch endpoints.
Allows the API to accept None as input for args, command and the session launcher resource class ID so that they can be reset to their defaults in patch endpoints.
Allows the API to accept None as input for args, command and the session launcher resource class ID so that they can be reset to their defaults in patch endpoints.
Allows the API to accept None as input for args, command and the session launcher resource class ID so that they can be reset to their defaults in patch endpoints.
Allows the API to accept None as input for args, command and the session launcher resource class ID so that they can be reset to their defaults in patch endpoints.
Allows the API to accept None as input for args, command and the session launcher resource class ID so that they can be reset to their defaults in patch endpoints.
Allows the API to accept None as input for args, command and the session launcher resource class ID so that they can be reset to their defaults in patch endpoints.