Skip to content

Update actor documentationΒ #797

@daniel-zullo-frequenz

Description

@daniel-zullo-frequenz

What happened?

Initially, the actor was designed to run continuously unless there was an error or it was intentionally stopped. Later, the actor was updated to support a new use-case where the actor exits the running loop upon a normal termination.

The current actor documentation and examples primarily focus on stopping the actor manually, with only a brief mention that the actor also naturally terminates upon completing execution without errors. Some examples are either outdated or not entirely accurate.

For example, here it documents how it is expected to be used, as continuously running actors: https://github.com/frequenz-floss/frequenz-sdk-python/blob/v1.x.x/src/frequenz/sdk/actor/__init__.py#L214-L218
In this part, it states that actors will be restarted only when it exits with errors: https://github.com/frequenz-floss/frequenz-sdk-python/blob/v1.x.x/src/frequenz/sdk/actor/__init__.py#L38-L40
And here actors are awaited to finish execution https://github.com/frequenz-floss/frequenz-sdk-python/blob/v1.x.x/src/frequenz/sdk/actor/__init__.py#L46-L48 but the examples only point out that actors needs to be manually stopped

For this example, the actor will block either until execution termination or until it gets stopped
https://github.com/frequenz-floss/frequenz-sdk-python/blob/v1.x.x/src/frequenz/sdk/actor/__init__.py#L70-L88

Also internal documentation needs to be updated to reflect what the code actually does.
For instance, the actor will also exit if it finishes execution successfully without any error but this is not reflected in the function documentation
https://github.com/frequenz-floss/frequenz-sdk-python/blob/v1.x.x/src/frequenz/sdk/actor/_actor.py#L75-L111

What did you expect instead?

Update or extend documentation and examples in actor class and module to reflect what the actor code does, including the scenario where the actor terminates execution normally.

Affected version(s)

No response

Affected part(s)

Actors or actors utilities (decorator, etc.) (part:actor), Documentation (part:docs)

Extra information

Related to #632

Metadata

Metadata

Labels

part:actorAffects an actor ot the actors utilities (decorator, etc.)part:docsAffects the documentationpriority:highAddress this as soon as possible

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions