[Django] #31793: Async management command support

11 views
Skip to first unread message

Django

unread,
Jul 15, 2020, 7:59:41 AM7/15/20
to django-...@googlegroups.com
#31793: Async management command support
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: nobody
Type: New | Status: new
feature |
Component: Core | Version: 3.0
(Management commands) |
Severity: Normal | Keywords: assync
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Currently, a management command with `async def handle` will fail for
"coroutine was never awaited".

--
Ticket URL: <https://code.djangoproject.com/ticket/31793>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 15, 2020, 8:01:09 AM7/15/20
to django-...@googlegroups.com
#31793: Async management command support
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: nobody
Type: New feature | Status: new
Component: Core (Management | Version: 3.0
commands) |
Severity: Normal | Resolution:
Keywords: assync | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by James Pic):

Patch: https://github.com/django/django/pull/13190

--
Ticket URL: <https://code.djangoproject.com/ticket/31793#comment:1>

Django

unread,
Jul 15, 2020, 8:54:26 AM7/15/20
to django-...@googlegroups.com
#31793: Async management command support
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: nobody
Type: New feature | Status: closed

Component: Core (Management | Version: 3.0
commands) |
Severity: Normal | Resolution: wontfix

Keywords: assync | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* status: new => closed
* resolution: => wontfix


Comment:

Hi James.

Thanks for the suggestion. I'm going to say wontfix here: there's no need
for ''async management commands''. If a management command needs to run
async code, for which, of course, there may be a need, `asyncio.run()` is
the perfect approach. (I see you note that as the workaround on the PR.)
It's just not worth any complexity to be able to handle top level async
def handle methods directly. '

I hope that makes sense.

--
Ticket URL: <https://code.djangoproject.com/ticket/31793#comment:2>

Django

unread,
Jul 17, 2020, 12:06:39 PM7/17/20
to django-...@googlegroups.com
#31793: Async management command support
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: nobody
Type: New feature | Status: closed
Component: Core (Management | Version: 3.0
commands) |
Severity: Normal | Resolution: wontfix
Keywords: assync | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by James Pic):

Well I'm not to judge if it makes sense, time & users will tell ;)

--
Ticket URL: <https://code.djangoproject.com/ticket/31793#comment:3>

Django

unread,
Jul 27, 2020, 1:07:22 AM7/27/20
to django-...@googlegroups.com
#31793: Async management command support
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: nobody
Type: New feature | Status: closed
Component: Core (Management | Version: 3.0
commands) |
Severity: Normal | Resolution: wontfix
Keywords: assync | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by James Pic):

Just for the update: it seems both async and non async middlewares will be
supported by Django: https://forum.djangoproject.com/t/the-trouble-with-
middleware/19/11

So, if management commands would support both then it wouldn't be
inconsistent.

--
Ticket URL: <https://code.djangoproject.com/ticket/31793#comment:4>

Django

unread,
Jul 28, 2020, 2:56:31 AM7/28/20
to django-...@googlegroups.com
#31793: Async management command support
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: nobody
Type: New feature | Status: closed
Component: Core (Management | Version: 3.0
commands) |
Severity: Normal | Resolution: wontfix
Keywords: assync | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

Hi James. There's a fundamental difference between middlewares, which sit
squarely on the request-response pathway, and **need** to be async capable
if we're to leverage the full potential of that, on the one hand, and
management commands, which are called one-by-one from the command line
most usually, on the other. A management can **use** async code, in which
can `asyncio.run()` is fine, but there's no demonstrated need for the top-
level `handle()` entry point to itself be async capable. There's no
concurrency need for management commands. ("Au contraire mon ami" -- fine,
use multiprocessing if you insist, but there's nothing that's worth adding
complexity to the main entry point here for.)

--
Ticket URL: <https://code.djangoproject.com/ticket/31793#comment:5>

Django

unread,
Nov 5, 2022, 8:47:08 AM11/5/22
to django-...@googlegroups.com
#31793: Async management command support
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: nobody
Type: New feature | Status: closed
Component: Core (Management | Version: 3.0
commands) |
Severity: Normal | Resolution: wontfix
Keywords: assync | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jon Janzen):

* cc: Jon Janzen (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/31793#comment:6>

Reply all
Reply to author
Forward
0 new messages