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

sched - provide an "async" argument for run() method #57658

Closed
giampaolo opened this issue Nov 22, 2011 · 6 comments
Closed

sched - provide an "async" argument for run() method #57658

giampaolo opened this issue Nov 22, 2011 · 6 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@giampaolo
Copy link
Contributor

giampaolo commented Nov 22, 2011

BPO 13449
Nosy @josiahcarlson, @pitrou, @giampaolo
Files
  • sched-async.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/giampaolo'
    closed_at = <Date 2011-12-14.13:41:06.308>
    created_at = <Date 2011-11-22.00:19:43.202>
    labels = ['type-feature', 'library']
    title = 'sched - provide an "async" argument for run() method'
    updated_at = <Date 2011-12-14.13:41:46.257>
    user = 'https://github.com/giampaolo'

    bugs.python.org fields:

    activity = <Date 2011-12-14.13:41:46.257>
    actor = 'giampaolo.rodola'
    assignee = 'giampaolo.rodola'
    closed = True
    closed_date = <Date 2011-12-14.13:41:06.308>
    closer = 'giampaolo.rodola'
    components = ['Library (Lib)']
    creation = <Date 2011-11-22.00:19:43.202>
    creator = 'giampaolo.rodola'
    dependencies = []
    files = ['23746']
    hgrepos = []
    issue_num = 13449
    keywords = ['patch']
    message_count = 6.0
    messages = ['148095', '148097', '149443', '149444', '149445', '149448']
    nosy_count = 5.0
    nosy_names = ['josiahcarlson', 'pitrou', 'giampaolo.rodola', 'josiah.carlson', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue13449'
    versions = ['Python 3.3']

    @giampaolo
    Copy link
    Contributor Author

    giampaolo commented Nov 22, 2011

    If True it would run the scheduled functions due to expire soonest (if any) and then return.
    This would make sched module usable into asynchronous applications.

    @pitrou
    Copy link
    Member

    pitrou commented Nov 22, 2011

    I think this would be better served by a separate method. You could call it e.g. run_nowait().

    @ezio-melotti ezio-melotti added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Dec 2, 2011
    @giampaolo
    Copy link
    Contributor Author

    giampaolo commented Dec 14, 2011

    What about run(nowait=...) or run(only_ready=...)?
    Doing this as a separate method seems unnecessarily complicated to me in terms of implementation (move run logic into _run, add "run" and "run_nowait", etc...).
    Most importantly, the user will have to remember two methods which are basically equivalent in terms of "what they actually do".

    @pitrou
    Copy link
    Member

    pitrou commented Dec 14, 2011

    That's a good point. Then perhaps call the flag "wait" or "blocking", since it avoids false positives and is more explicit than "async"?

    @giampaolo
    Copy link
    Contributor Author

    giampaolo commented Dec 14, 2011

    "blocking" seems the most explicit to me.
    With this, we can also fix bpo-1641 by providing a specific section into asyncore doc which explains how to use asyncore in conjunction with sched.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Dec 14, 2011

    New changeset 2975618965c0 by Giampaolo Rodola' in branch 'default':
    Fix bpo-13449: add 'blocking' parameter to sched.scheduler.run() so that the scheduler can be used in non-blocking applications
    http://hg.python.org/cpython/rev/2975618965c0

    @giampaolo giampaolo self-assigned this Dec 14, 2011
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants