-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow manipulation of default session configuration (#218)
* git add . * small fixes * format * defaults mechanism * revert forcelist * try reset * revert * revert base * add to docs * doc fixes * better docs * more docs * add test * format * bool logic
- Loading branch information
Showing
9 changed files
with
234 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
__version__ = "5.28.1" | ||
|
||
from .frameworkclient import CAVEclient | ||
from .session_config import get_session_defaults, set_session_defaults | ||
|
||
__all__ = ["CAVEclient"] | ||
__all__ = ["CAVEclient", "set_session_defaults", "get_session_defaults"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
title: Configuration | ||
--- | ||
|
||
::: caveclient.set_session_defaults | ||
options: | ||
show_root_heading: true | ||
|
||
::: caveclient.get_session_defaults | ||
options: | ||
show_root_heading: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
title: Advanced Usage | ||
--- | ||
|
||
## Changing session configurations | ||
|
||
It is possible to change details of how a client talks to the various servers it needs | ||
to interface with. For instance, the `CAVEclient` will attempt to retry | ||
specific failed requests to the server, but will only try a specific number of times, | ||
and will only wait specific amounts of time between retries. These values can be changed | ||
via the `set_session_defaults` method. For instance, to change the number of retries to | ||
5, and to increase the delay between subsequent retries, you could do: | ||
|
||
```python | ||
from caveclient import set_session_defaults | ||
|
||
set_session_defaults(max_retries=5, backoff_factor=0.5) | ||
``` | ||
|
||
Note that this needs to happen before initializing the client for this to work | ||
properly. Some of these parameters are also adjustable at the client level. | ||
|
||
To view the current session defaults, you can use the `get_session_defaults` method: | ||
|
||
```python | ||
from caveclient import get_session_defaults | ||
|
||
client.get_session_defaults() | ||
``` | ||
|
||
More information on the available parameters can be found in the | ||
[API documentation](../client_api/config.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.