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

feature - enabling a time to execution property on Routines #416

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

rsivilli
Copy link

@rsivilli rsivilli commented Aug 14, 2023

Pull request summary

Proposed attempt to exposing a "time to next execution" property within Routines

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
    • I have updated the changelog with a quick recap of my changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

Copy link
Contributor

@AbstractUmbra AbstractUmbra left a comment

Choose a reason for hiding this comment

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

Whilst I respect this is still in draft, it has some issues already:

time_till_execution is not proper English, perhaps you'd mean to use next_execution_time?

There are more in the review steps below.

twitchio/ext/routines/__init__.py Outdated Show resolved Hide resolved
twitchio/ext/routines/__init__.py Outdated Show resolved Hide resolved


@property
def time_till_execution(self) -> datetime.timedelta:
Copy link
Contributor

Choose a reason for hiding this comment

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

See review comment on this one.

Copy link
Author

Choose a reason for hiding this comment

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

Actually, I'm going back through this and it sort of clicked. The naming of the property could be confusing.

This does expose a next_event_time. As an aside, that should probably be marked as private.

How would you feel about something like time_until_next_event? While the docstring and typing should be pretty clear, I figure the naming could also be improved to emphasize that this is a duration estimate.

twitchio/ext/routines/__init__.py Outdated Show resolved Hide resolved
twitchio/ext/routines/__init__.py Outdated Show resolved Hide resolved
@chillymosh
Copy link
Collaborator

chillymosh commented Aug 14, 2023

Have you tested all variations of multiple routines running simultaneously with some being stopped, the execution time being changed mid run, cancelled etc.

We also run this with black -l 120

@rsivilli
Copy link
Author

Have you tested all variations of multiple routines running simultaneously with some being stopped, the execution time being changed mid run, cancelled etc.

We also run this with black -l 120

Still working through test cases. Happy path for what I need it for seems to be stable with start/stops but it's by no means exhaustive yet. Are there tests in the repo or elsewhere to improve that coverage or at least ensure I'm doing no harm?

Copy on the use of black.

@rsivilli
Copy link
Author

Whilst I respect this is still in draft, it has some issues already:

time_till_execution is not proper English, perhaps you'd mean to use next_execution_time?

There are more in the review steps below.

I think the name came from the discord discussion. Will update in next push

Copy link
Contributor

@AbstractUmbra AbstractUmbra left a comment

Choose a reason for hiding this comment

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

One missed change

docs/changelog.rst Outdated Show resolved Hide resolved
@AbstractUmbra
Copy link
Contributor

The checks are failing due to using 3.10+ Union syntax (T | None) when the minimum python version is 3.7. You may need to switch it out for typing.Union[T, None].

@rsivilli rsivilli force-pushed the rms/freature-time-remaining-routines branch from f396e88 to d918338 Compare August 19, 2023 13:41
@rsivilli rsivilli force-pushed the rms/freature-time-remaining-routines branch from a2a1ac1 to 3b017b0 Compare August 19, 2023 20:14
@rsivilli
Copy link
Author

Have you tested all variations of multiple routines running simultaneously with some being stopped, the execution time being changed mid run, cancelled etc.

We also run this with black -l 120

./test.py is my sort of body of evidence that, yes, I believe that this has now been tested against most use cases (in the hackiest way). It will be removed when this leaves draft, but I wasn't sure how else to prove that.

@rsivilli rsivilli marked this pull request as ready for review August 21, 2023 14:41
Copy link
Contributor

@AbstractUmbra AbstractUmbra left a comment

Choose a reason for hiding this comment

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

Some queries around style choices and whatnot, that's all!

@@ -1,11 +1,12 @@
:orphan:
orphan:
Copy link
Contributor

Choose a reason for hiding this comment

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

Directive should be :orphan:, no?


Master
======
- TwitchIO
- Bug fixes
- Fix IndexError when getting prefix when empty message is sent in a reply.

- Additioons
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Additioons
- Additions

@@ -24,6 +25,7 @@ Master
- Added :func:`~twitchio.Client.fetch_content_classification_labels` along with :class:`~twitchio.ContentClassificationLabel`
- Added :attr:`~twitchio.ChannelInfo.content_classification_labels` and :attr:`~twitchio.ChannelInfo.is_branded_content` to :class:`~twitchio.ChannelInfo`
- Added new parameters to :func:`~twitchio.PartialUser.modify_stream` for ``is_branded_content`` and ``content_classification_labels``

Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this newline added? Did it cause an issue in the building of the documentation?

@@ -211,7 +215,6 @@ def restart_when_over(fut, *, args=args, kwargs=kwargs):

if self._can_be_cancelled():
self._task.add_done_callback(restart_when_over)

Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this newline removed?

@AbstractUmbra
Copy link
Contributor

There's also a merge conflict that must be resolved be we can merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants