Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Addlast kwarg torun_repeating#1345

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

plammens
Copy link
Contributor

@plammensplammens commentedFeb 14, 2019
edited
Loading

Added alast keyword argument to therun_repeating method of job queues that takes in a time specifier (in the same formats supported byfirst). It specifies the last time the job should be run. Currently, checking if the job should be run or not involves a certain "delay buffer" (so that iflast is an exact multiple ofinterval, the internal delays don't mess up the intended behaviour), but it's a temporary solution. Also, I've made some minor refactorings.

Tests run correctly from my side. I've added one test for the new feature, but maybe a few more would be in place. The docs haven't been updated yet.

Closes#1333.

The procedure to convert a given time object to a float containingthe "seconds until the next run" was extracted into an auxiliarytop-level function named `_to_interval_seconds`.Also, `_put`'s "prep phase" was refactored as follows. A new localidentifier named `interval` was created to make its meaning clearer(instead of always reusing `next_t`, which was confusing). Theway in which the interval is fetched (and checked for `None`)has also been simplified. Finally, `next_t`'s last assignment isthe actual timestamp in which the job is to be run, which iseither `previous_t` (if available) or the current time plusthe amount stored in `interval`.Finally, `last_t` was renamed to `previous_t` to avoid confusionwith upcoming `last` kwarg.
Added a `last` kwarg to `run_repeating` that specifies whenthe job should last be run. The checking is done before executingthe job, but with a small delay buffer, so that if `last`is an exact multiple of `interval`, the last job is stillrun, even though the actual time is slightly after thetheoretical finish time.
Instead of converting to interval first and then addingthe current (or previous) time.
@plammensplammens mentioned this pull requestFeb 17, 2019
@Eldinnie
Copy link
Member

Hi,

Thanks for your contribution. As you can see tests fail on py2. This is because you modified the calculation for_next_t in a way adatetime on py2 will never be accepted.
Can you please fix this?

Pieter

@plammens
Copy link
ContributorAuthor

plammens commentedFeb 28, 2019
edited
Loading

Ah! Sorry I missed that. Will fix. By the way, could time objects be stored asdatetime.datetime instead of plain timestamps? That would simplify it a bit.

Python 2's datetime module doesn't have the datetime.timestamp()method. An equivalent calculation has been put in its place.
@plammens
Copy link
ContributorAuthor

@Eldinnie Should be fixed now. Though Travis keeps failing on the unrelatedtest_idle.

@EldinnieEldinnie changed the base branch frommaster toV12June 6, 2019 12:39
@plammens
Copy link
ContributorAuthor

@Eldinnie Any updates on this? I can make changes if the PR is not up to scratch

@tsnoamtsnoam closed thisAug 23, 2019
@Bibo-Joshi
Copy link
Member

This was closed when the V12 branch was deleted. Would you mind reopening the PR to master,@plammens ? :)

@plammens
Copy link
ContributorAuthor

@Bibo-Joshi Oh, that makes sense. Reopened as#1497!

@Bibo-JoshiTelegram GithubBot Revised
Copy link
Member

@plammens Thanks!

@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsAug 20, 2020
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@plammens@Eldinnie@Bibo-Joshi@tsnoam

[8]ページ先頭

©2009-2025 Movatter.jp