Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add list of preconditions to event docstrings #543

Open
sed-i opened this issue May 27, 2021 · 4 comments
Open

add list of preconditions to event docstrings #543

sed-i opened this issue May 27, 2021 · 4 comments
Labels
24.04 docs Improvements or additions to documentation

Comments

@sed-i
Copy link
Contributor

sed-i commented May 27, 2021

It would be valuable to document what each event guarantees.
For example, "RelationJoinedEvent" guarantees (i.e. has a precondition) that peer buckets are visible (cf. #542).

operator/ops/charm.py

Lines 352 to 362 in 37e3399

class RelationJoinedEvent(RelationEvent):
"""Event triggered when a new unit joins a relation.
This event is triggered whenever a new unit of a related
application joins the relation. The event fires only when that
remote unit is first observed by the unit. Callback methods bound
to this event may set any local unit settings that can be
determined using no more than the name of the joining unit and the
remote ``private-address`` setting, which is always available when
the relation is created and is by convention not deleted.
"""

@balbirthomas
Copy link
Contributor

It would be valuable to document what each event guarantees.
For example, "RelationJoinedEvent" guarantees (i.e. has a precondition) that peer buckets are visible (cf. #542).

I wonder if this should be in the docstring of get_binding() also. The precondition of get_binding() network for a peer relation or any relation is that the relation joined event for that particular relation and unit has happened. It may be fair to add a cross reference in RelationJoinedEvent saying once this event has occured get_binding() will return a valid address.

@sed-i
Copy link
Contributor Author

sed-i commented May 27, 2021

Enumerating entry pathways is also useful, for example:

  • RelationJoined:
    1. as part of the startup sequence (may appear multiple times);
    2. re-entry after defer().
  • RelationChanged:
    1. immediately after a newly joint unit receives RelationJoined, all of its peers receive RelationChanged.
    2. when relation data bucket is modified.
    3. re-entry after defer().
  • PebbleReady:
    1. as part of the startup sequence (only once);
    2. re-entry after defer().

@rbarry82 rbarry82 added the docs Improvements or additions to documentation label Jul 27, 2021
@benhoyt
Copy link
Collaborator

benhoyt commented Oct 5, 2023

I think we can probably improve our docs here in places, however, I think it's probably better that the details are described in the Juju docs rather than in the ops API docs. We could even shorten our ops docs in some cases, and perhaps link to the relevant Juju doc.

@benhoyt benhoyt added the 24.04 label Oct 5, 2023
@benhoyt
Copy link
Collaborator

benhoyt commented Mar 18, 2024

@tmihoc You had some thoughts about making Juju event docs clearer -- what was your concrete plan for that again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
24.04 docs Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants