FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Dispatch Managing Actor by Marenz · Pull Request #54 · frequenz-floss/frequenz-dispatch-python · GitHub

Repository navigation

Dispatch Managing Actor - #54

Merged
Marenz merged 11 commits into
frequenz-floss:v0.x.xfrom
Marenz:runner
Sep 30, 2024
Merged

Marenz merged 11 commits into
frequenz-floss:v0.x.xfrom
Marenz:runner

Conversation

Marenz commented Sep 11, 2024

Copy link
Copy Markdown
Contributor
  • Reset release notes
  • Add dispatch runner

Marenz requested a review from a team as a code owner September 11, 2024 15:30
github-actions Bot added part:docs Affects the documentation part:dispatcher Affects the high-level dispatcher interface labels Sep 11, 2024
github-actions Bot added part:tests Affects the unit, integration and performance (benchmarks) tests part:actor Affects the dispatching actor labels Sep 11, 2024

daniel-zullo-frequenz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Just a few really minor comments to check for, LGTM otherwise

Comment thread tests/test_runner.py Outdated
Comment thread tests/test_runner.py Outdated
Comment thread src/frequenz/dispatch/_actor_runner.py Outdated

llucax left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I would say all comments are mostly bike shedding, but in particular I think not using configuration and use dispatch update is important, I think it can get a bit confusing for people dealing with dispatches and configuration (as in config manager) too. I really think we should replace all `configuration mentions to update/dispatch update.

Also I found the example a bit confusing, which ideally it shouldn't be the case, the example should help make things less confusing :P

Comment thread src/frequenz/dispatch/_actor_runner.py Outdated
Comment thread src/frequenz/dispatch/_actor_runner.py Outdated
Comment thread src/frequenz/dispatch/_actor_runner.py Outdated
Comment thread src/frequenz/dispatch/_actor_runner.py Outdated
Comment thread src/frequenz/dispatch/_actor_runner.py Outdated
Comment thread src/frequenz/dispatch/_actor_runner.py Outdated
Comment thread src/frequenz/dispatch/_actor_runner.py Outdated
match running:
case RunningState.STOPPED:
_logger.info("Stopping dispatch...")
await self._stop_actors("Dispatch stopped")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Maybe "Stopped by a dispatch".

Comment thread src/frequenz/dispatch/_actor_runner.py Outdated

Marenz commented Sep 13, 2024

Copy link
Copy Markdown
Contributor Author

I don't like update much in this context either though. How about DispatchParameterUpdate

llucax commented Sep 13, 2024

Copy link
Copy Markdown
Contributor

I don't like update much in this context either though. How about DispatchParameterUpdate

Why don't you like update? Adding Parameter doesn't make it better IMHO, there is no concept of a dispatch parameter in the API. Another option would be change instead of update, but for me update sounds more accurate in this context, this is why I wonder what you don't like about update.

github-actions Bot added the part:tooling Affects the development tooling (CI, deployment, dependency management, etc.) label Sep 16, 2024

llucax left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I see there was not much progress or replies on my comments. I guess you are focusing on getting shit to work, which sounds totally reasonable, but just saying that I didn't review much in this round.

Comment thread RELEASE_NOTES.md Outdated
Marenz force-pushed the runner branch 3 times, most recently from 1509e1b to ba6bd9f Compare September 23, 2024 15:42

llucax left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Very nice to see the new scheduling algorithm! 🎉 Way better than what we had before.

Lots of comments, so here is a summary:

Things I think needs to be addressed before merging:

  1. These commits need a commit message with a body that describes what's going on, it is really hard to review them without more information of what was wrong and how it was fixed:

    • Fix wrong running behaviors with duration=None
    • Rewrite internal architecture to be more flexible
    • Add dispatch runner (less important but it would be nice, is not a trivial class)
  2. Finish the renaming of config -> update

  3. The hack in the tests (session-wide event_loop fixture), we can't really merge this if something is so fucked up that makes tests hang or make the interpreter segfault 😬

  4. Figure out if we really need to support multiple actors, it is still make noise in my head, my feeling is we should encourage having one actor to handle one dispatch type, if that actor needs other supporting actors, it should be the actor itself in charge of spawning them.

  5. If we are doing more renaming (like DispatchManagingActor and payload -> options), it might be good to do them now too to avoid having breaking changes in the future.

The rest is minor or too big for this PR, so I will create follow-up issues.

Comment thread src/frequenz/dispatch/_actor_runner.py Outdated
Comment thread src/frequenz/dispatch/_actor_runner.py Outdated
dry_run: bool
"""Whether this is a dry run."""

payload: dict[str, Any]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

bikeshedding: Payload sounds weird to me. For a whole dispatch it makes sense (or at least it was the best we could find) but in this context maybe something like options is more intuitive? To be honest I think options might be a good choice for the specs too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

how about inputs?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yeah, that could work too, I think we discussed options at some point but wasn't perfectly accurate as some "options" might not be optional. I guess inputs is an improvement in that sense. Maybe parameters could work too.

Comment thread src/frequenz/dispatch/_actor_runner.py Outdated
Comment thread src/frequenz/dispatch/_actor_runner.py Outdated
Comment thread src/frequenz/dispatch/_actor_runner.py Outdated
Comment thread src/frequenz/dispatch/_actor_runner.py Outdated
Comment thread src/frequenz/dispatch/_actor_runner.py Outdated
Comment thread tests/test_frequenz_dispatch.py Outdated

Marenz commented Sep 24, 2024

Copy link
Copy Markdown
Contributor Author

And I still think "update" sucks and "configuration" was better. "Update" doesn't fit at all in the whole naming scheme

Marenz commented Sep 24, 2024

Copy link
Copy Markdown
Contributor Author

Addressed points 1 - 5

llucax left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

A few more instances of config and we need support for multiple actors for now (temporarily). I will also create issues for the stuff we can address in the future.

Comment thread src/frequenz/dispatch/_actor_runner.py Outdated
Comment thread src/frequenz/dispatch/_actor_runner.py Outdated
Comment thread src/frequenz/dispatch/_actor_runner.py Outdated
dry_run: bool
"""Whether this is a dry run."""

payload: dict[str, Any]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yeah, that could work too, I think we discussed options at some point but wasn't perfectly accurate as some "options" might not be optional. I guess inputs is an improvement in that sense. Maybe parameters could work too.

Comment thread tests/test_mananging_actor.py Outdated
Comment thread tests/test_mananging_actor.py Outdated
Comment thread tests/test_mananging_actor.py Outdated
Comment thread tests/test_mananging_actor.py Outdated
Comment thread tests/test_mananging_actor.py Outdated

Marenz commented Sep 24, 2024

Copy link
Copy Markdown
Contributor Author
  • Added multiple actors back
  • fixed confi -> up stuff

Marenz changed the title Dispatch Actor Runner Actor Dispatch Managing Actor Sep 24, 2024
Marenz force-pushed the runner branch 2 times, most recently from bc76d7e to 7003801 Compare September 24, 2024 16:14
llucax previously approved these changes Sep 30, 2024
Comment thread pyproject.toml
[tool.pytest.ini_options]
testpaths = ["tests", "src"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
* Dispatch.running() was always returning RUNNING for duration None
* Dispatch.next_run_after() was made aware that there is no next run for
  inf. Duration
* Dispatch._until() now raises when used with Dispatch.None
* Actor: delay marking a Dispatch as deleted, otherwise checks wrongly
  detect it as no longer running.

Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
The internal scheduling architecture was rewritten:

Instead of using one task per dispatch that will start/stop them,
we now have a queue of events and a timer that is rescheduled
to the earliest next event each time it triggers.

Previously we had to do complicated re-scheduling and cancelling of
tasks, now we always just update the event in the queue.

Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
A useful actor to help control and manange another actor using
dispatches.

Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
As recommended by the deprecation warning

Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
Marenz dismissed llucax’s stale review September 30, 2024 10:56

The merge-base changed after approval.

Marenz added this pull request to the merge queue Sep 30, 2024
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 30, 2024
Marenz added this pull request to the merge queue Sep 30, 2024
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 30, 2024
Marenz added this pull request to the merge queue Sep 30, 2024
Merged via the queue into frequenz-floss:v0.x.x with commit 2606895 Sep 30, 2024
Marenz deleted the runner branch September 30, 2024 14:13

llucax commented Oct 1, 2024

Copy link
Copy Markdown
Contributor

It looks like now cross-arch tests are consistently failing. This must be definitely a timing issue, the slowest the system is, the more likely we hit this bug and tests hang. Created an issue about it:

llucax mentioned this pull request Oct 1, 2024
This file contains hidden or 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:actor Affects the dispatching actor part:dispatcher Affects the high-level dispatcher interface part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL