Skip to content

Commit

Permalink
Remove references to get_storage #606
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Delaunay committed Dec 12, 2022
1 parent a994595 commit 25301ca
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 87 deletions.
23 changes: 7 additions & 16 deletions docs/src/user/storage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -269,32 +269,26 @@ Although we recommend using the experiment client,
we document the storage backend here for users who may need
more flexibility.

There is two ways for creating the storage client. If you
already created an experiment client, the storage
was already created during the process of creating the
experiment client and you can get it with
:py:func:`orion.storage.base.get_storage`.
Otherwise, you can create the storage client with
:py:func:`orion.storage.base.setup_storage` before
fetching it with
:py:func:`get_storage() <orion.storage.base.get_storage>`.
You should try to reuse the same storage throughout the your code.
if the storage is otherwise unreachable you can create the storage client with
:py:func:`orion.storage.base.setup_storage`.

To recap, you can create it indirectly with
:py:func:`create_experiment() <orion.client.create_experiment>`
or directly with
:py:func:`setup_storage() <orion.storage.base.setup_storage>`.
In both case, you can access it with
:py:func:`get_storage() <orion.storage.base.get_storage>`.


.. code-block:: python
from orion.client import create_experiment
from orion.storage.base import get_storage, setup_storage
from orion.storage.base import setup_storage
# Create the ExperimentClient and storage implicitly
experiment = create_experiment('exp-name', space=dict(x='uniform(0, 1)'))
# Or create storage explicitly using setup_storage
setup_storage(dict(
storage = setup_storage(dict(
type='legacy',
database=dict(
type='pickleddb',
Expand All @@ -303,9 +297,6 @@ In both case, you can access it with
)
)
# Get the storage client
storage = get_storage()
# fetch trials
trials = storage.fetch_trials(uid=experiment.id)
Expand Down
135 changes: 70 additions & 65 deletions examples/plotting/plotting-api.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],
"source": [
"from orion.client import create_experiment\n",
"from orion.storage.base import get_storage, setup_storage\n",
"from orion.storage.base import setup_storage\n",
"\n",
"# Specify the database where the experiments are stored. We use a local PickleDB here.\n",
"storage = dict(\n",
Expand Down Expand Up @@ -2976,45 +2976,45 @@
{
"label": "/learning_rate[0]",
"range": [
1e-05,
0.00001,
0.001
],
"values": [
0.0005747845526091205,
9.717910919311446e-05,
1.6570229481291695e-05,
3.055511532871133e-05,
0.00009717910919311446,
0.000016570229481291695,
0.00003055511532871133,
0.0006310174120379774,
0.0002546606785410005,
9.851088184326168e-05,
2.5839973998924114e-05,
0.00009851088184326168,
0.000025839973998924114,
0.00012927136876192215,
8.455081703732675e-05,
0.00008455081703732675,
0.0004258496241899244,
3.0373209590744556e-05,
5.2726454497507856e-05,
3.5468688314901095e-05,
1.7999524467305948e-05,
3.66140797391207e-05,
1.4733224669469006e-05,
0.000030373209590744556,
0.000052726454497507856,
0.000035468688314901095,
0.000017999524467305948,
0.0000366140797391207,
0.000014733224669469006,
0.0002035386656699011,
6.94995526881964e-05,
0.0000694995526881964,
0.00017795140355708494,
0.0001674150935354242,
6.162228573932309e-05,
0.00006162228573932309,
0.00024169992630823463,
0.00030625248177846556,
0.00014883022451967707,
8.073030448245357e-05,
0.00008073030448245357,
0.00039190228101553936,
0.0006110131331685214,
0.0001832226868080067,
1.5137521313778242e-05,
0.000015137521313778242,
0.00021206262131970825,
0.00011541207641569087,
1.580306429454298e-05,
3.5522776121717326e-05,
2.352741654302332e-05,
0.00001580306429454298,
0.000035522776121717326,
0.00002352741654302332,
0.0006817340528688578,
0.00035510262109951637,
0.0003082643537380882,
Expand All @@ -3024,94 +3024,94 @@
{
"label": "/learning_rate[1]",
"range": [
1e-05,
0.00001,
0.001
],
"values": [
0.0007403062056513132,
0.0008794227014616495,
9.009161652070386e-05,
0.00009009161652070386,
0.00019198106027355725,
0.0005047523465972278,
0.00017898644618389488,
1.6343301895298622e-05,
2.629486098693607e-05,
0.000016343301895298622,
0.00002629486098693607,
0.0007651062484988466,
0.0009369867377074616,
1.7452642229039106e-05,
4.789898251482055e-05,
5.469784883343372e-05,
0.000017452642229039106,
0.00004789898251482055,
0.00005469784883343372,
0.0009741294850455306,
1.9351528007231025e-05,
0.000019351528007231025,
0.00010410549034836072,
0.00022678915008766235,
5.7383408009935865e-05,
2.0953602428663968e-05,
1.5170170887300964e-05,
2.8477259454960604e-05,
5.9393999889614525e-05,
7.370197805953986e-05,
3.512434055709906e-05,
7.73168751791157e-05,
3.1561176126177294e-05,
7.526533412650216e-05,
1.696517943151868e-05,
0.000057383408009935865,
0.000020953602428663968,
0.000015170170887300964,
0.000028477259454960604,
0.000059393999889614525,
0.00007370197805953986,
0.00003512434055709906,
0.0000773168751791157,
0.000031561176126177294,
0.00007526533412650216,
0.00001696517943151868,
0.0008372023946454619,
1.4951524856584976e-05,
2.288696745946192e-05,
0.000014951524856584976,
0.00002288696745946192,
0.0002718698558881767,
0.00046253217586407654,
0.0009283552495525243,
1.8615756508172953e-05,
0.000018615756508172953,
0.0005263453271835594,
0.00012579660168350864,
0.0005689807581229017,
3.1471161387911096e-05
0.000031471161387911096
]
},
{
"label": "/learning_rate[2]",
"range": [
1e-05,
0.00001,
0.001
],
"values": [
7.029479558500134e-05,
0.00007029479558500134,
0.0002974449216599116,
0.0001541849826165435,
0.0006214390692323961,
1.811829408823701e-05,
0.00001811829408823701,
0.00024697024477918526,
1.4091376734556873e-05,
0.000014091376734556873,
0.0002530397813068888,
2.130216637761497e-05,
4.6563156261754155e-05,
1.502128669566774e-05,
2.258643070257094e-05,
0.00002130216637761497,
0.000046563156261754155,
0.00001502128669566774,
0.00002258643070257094,
0.00013878319082790997,
1.5737422343453218e-05,
0.000015737422343453218,
0.0006572760438162273,
0.0004570211179201021,
0.000883426632055141,
2.917916719330865e-05,
1.6840762984921162e-05,
0.00002917916719330865,
0.000016840762984921162,
0.0005277725119955368,
0.00048622276355058145,
1.9387949053570255e-05,
0.000019387949053570255,
0.0001301973147657616,
1.6125035921339283e-05,
7.92492726920181e-05,
0.000016125035921339283,
0.0000792492726920181,
0.0004053354336359227,
0.0007495440809699879,
4.7416411204499516e-05,
0.000047416411204499516,
0.0004907267584974197,
7.810069819952566e-05,
0.00007810069819952566,
0.0006536321122271506,
0.00012283161301636497,
7.189341358999385e-05,
0.00007189341358999385,
0.00046191483270093605,
7.233161739226541e-05,
6.382894335278974e-05,
0.00007233161739226541,
0.00006382894335278974,
0.0004554858153911407,
0.00011475654732920408,
0.00013224066434810178
Expand Down Expand Up @@ -5153,7 +5153,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3.9.5 ('base')",
"language": "python",
"name": "python3"
},
Expand All @@ -5167,7 +5167,12 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
"version": "3.9.5"
},
"vscode": {
"interpreter": {
"hash": "e578965c7e0d2aba54bb439f3a11ff2b11a1cf142236cd78b5a94eff9a1581e5"
}
}
},
"nbformat": 4,
Expand Down
6 changes: 0 additions & 6 deletions src/orion/storage/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
>>> storage_factory.create('track', uri='file://orion_test.json')
>>> storage_factory.create('legacy', experiment=...)
Notes
-----
When retrieving an already initialized Storage object you should use `get_storage`.
`storage_factory.create()` should only be used for initialization purposes as `get_storage`
raises more granular error messages.
"""
from __future__ import annotations

Expand Down

0 comments on commit 25301ca

Please sign in to comment.