Skip to content

Commit bb538ed

Browse files
committed
update docs
1 parent 090afd6 commit bb538ed

3 files changed

Lines changed: 21 additions & 9 deletions

File tree

doc/source/core/run.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ Runs
1111
.. autoclass:: ixmp4.core.run.Run
1212
:members:
1313

14+
.. autoclass:: ixmp4.core.run.RunCheckpoints
15+
:members:

doc/source/usage/locks-and-versioning.rst

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@ these instances may acquire a lock.
5656
a **method of coordination** for clients that rely on versioning facilities
5757
and thus **not a reliable security mechanism** in any manner.
5858

59-
Checkpoints
60-
-----------
59+
For advanced use of the locking mechanism, read about:
60+
61+
- :meth:`ixmp4.core.run.Run.lock`
62+
- :meth:`ixmp4.core.run.Run.unlock`
63+
64+
Checkpoints and Reversion
65+
-------------------------
6166

6267
Checkpoints are used to label important transactions in the transaction history
6368
as to provide "anchors" to revert to. They are created automatically at the exit
@@ -74,14 +79,20 @@ created at any other point.
7479
#> Checkpoint "Add data" created
7580
7681
If an exception occurs within a :meth:`~ixmp4.core.run.Run.transact` block,
77-
data in the run will be rolled back to the latest checkpoint on platforms
82+
data in the run will be reverted to the latest checkpoint on platforms
7883
that support versioning.
7984

85+
To manually revert to a past state, use the ``revert()`` methods on
86+
:class:`~ixmp4.core.run.Run` and :class:`~ixmp4.core.checkpoint.Checkpoint`.
87+
88+
- :meth:`ixmp4.core.run.Run.revert`
89+
- :meth:`ixmp4.core.checkpoint.Checkpoint.revert`
90+
8091
Checkpoint Views
8192
----------------
8293

8394
Checkpoint views provide read-only access to run data at a specific checkpoint.
84-
Access them through ``run.checkpoints[checkpoint_id]``.
95+
Access them through :class:`~ixmp4.core.run.RunCheckpoints` / :attr:`~ixmp4.core.run.Run.checkpoints``.
8596

8697
.. autoclass:: ixmp4.core.checkpoint.Checkpoint
8798
:members:

ixmp4/core/checkpoint.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@ class Checkpoint(BaseFacadeObject[CheckpointService, CheckpointDto]):
3131
3232
# Create a checkpoint and access it later
3333
run.checkpoints.create("after scenario setup")
34-
checkpoint = run.checkpoints.tabulate().iloc[0]
34+
checkpoint = run.checkpoints.list().pop()
3535
36-
view = run.checkpoints[checkpoint.id]
37-
df = view.iamc.tabulate()
38-
meta = view.meta
39-
scalars = view.optimization.scalars.tabulate()
36+
df = checkpoint.iamc.tabulate()
37+
meta = checkpoint.meta
38+
scalars_df = checkpoint.optimization.scalars.tabulate()
4039
4140
# Revert run to this checkpoint state
4241
view.revert()

0 commit comments

Comments
 (0)