... ください。 HTTP リクエストが終了するたびに呼び出されるシグナルを登録することで、この仕組みを見てみましょう。ここでは request_finished シグナルに接続します。 レシーバ関数 ¶ まず、レシーバ関数を定義する必要があります。レシーバはPythonの関数やメソッドであれば ... 何でもかまいません: def my_receiver ( sender , ** kwargs ): print ( "Request finished!" ) Notice that the function takes a sender argument, along with wildcard keyword arguments ( **kwargs ); all signal recei ... s argument. All signals send keyword arguments, and may change those keyword arguments at any time. In the case of request_finished , it's documented as sending no arguments, which means we might be tempted to write our signal handling as my_receiver(sen ... ... ください。 HTTP リクエストが終了するたびに呼び出されるシグナルを登録することで、この仕組みを見てみましょう。ここでは request_finished シグナルに接続します。 レシーバ関数 ¶ まず、レシーバ関数を定義する必要があります。レシーバはPythonの関数やメソッドであれば ... 何でもかまいません: def my_receiver ( sender , ** kwargs ): print ( "Request finished!" ) Notice that the function takes a sender argument, along with wildcard keyword arguments ( **kwargs ); all signal recei ... s argument. All signals send keyword arguments, and may change those keyword arguments at any time. In the case of request_finished , it's documented as sending no arguments, which means we might be tempted to write our signal handling as my_receiver(sen ... ... being executed. FAILED ¶ The Task raised an exception during execution, or was unable to start. SUCCESSFUL ¶ The Task has finished executing successfully. class TaskResult [ソース] ¶ The TaskResult stores the information about a specific execution of a ... he Task began execution, on its first attempt. last_attempted_at ¶ The time when the most recent Task run began execution. finished_at ¶ The time when the Task finished execution, whether it failed or succeeded. backend ¶ The backend the result is from. ... ソース] ¶ Refresh the result's attributes from the queue store. arefresh () ¶ The async variant of TaskResult.refresh() . is_finished [ソース] ¶ Whether the Task has finished (successfully or not). attempts [ソース] ¶ The number of times the Task has been ... ... being executed. FAILED ¶ The Task raised an exception during execution, or was unable to start. SUCCESSFUL ¶ The Task has finished executing successfully. class TaskResult [ソース] ¶ The TaskResult stores the information about a specific execution of a ... he Task began execution, on its first attempt. last_attempted_at ¶ The time when the most recent Task run began execution. finished_at ¶ The time when the Task finished execution, whether it failed or succeeded. backend ¶ The backend the result is from. ... ソース] ¶ Refresh the result's attributes from the queue store. arefresh () ¶ The async variant of TaskResult.refresh() . is_finished [ソース] ¶ Whether the Task has finished (successfully or not). attempts [ソース] ¶ The number of times the Task has been ... ... ラクラス。例えば django.core.handlers.wsgi.WsgiHandler が該当します。 environ リクエストに提供される environ 辞書。 request_finished ¶ django.core.signals. request_finished ¶ クライアントへの HTTP レスポンスの配信が完了したときに送信されます。 このシグナル ... 引数は以下の通りです: sender The backend class which the Task was enqueued on to. task_result The started TaskResult . task_finished ¶ django.tasks.signals. task_finished ¶ Sent once a Task has finished executing, successfully or otherwise. このシグナルと ... ともに送信される引数は以下の通りです: sender The backend class which the Task was enqueued on to. task_result The finished TaskResult . 目次 シグナル モデルのシグナル pre_init post_init pre_save post_save pre_delete post_delete m2m_changed class ... ... ラクラス。例えば django.core.handlers.wsgi.WsgiHandler が該当します。 environ リクエストに提供される environ 辞書。 request_finished ¶ django.core.signals. request_finished ¶ クライアントへの HTTP レスポンスの配信が完了したときに送信されます。 このシグナル ... 引数は以下の通りです: sender The backend class which the Task was enqueued on to. task_result The started TaskResult . task_finished ¶ django.tasks.signals. task_finished ¶ Sent once a Task has finished executing, successfully or otherwise. このシグナルと ... ともに送信される引数は以下の通りです: sender The backend class which the Task was enqueued on to. task_result The finished TaskResult . 目次 シグナル モデルのシグナル pre_init post_init pre_save post_save pre_delete post_delete m2m_changed class ... ... message = "Hello there!" , ) This returns a TaskResult , which can be used to retrieve the result of the Task once it has finished executing. To enqueue Tasks in an async context, aenqueue() is available as an async variant of enqueue() . Because both T ... skResult has a unique id , which can be used to identify and retrieve the result once the code which enqueued the Task has finished. The get_result() method can retrieve a result based on its id : # Later, somewhere else... result = email_users . get_res ... o.tasks.TaskResult.return_value attribute: >>> result . status SUCCESSFUL >>> result . return_value 42 If the Task has not finished executing, or has failed, ValueError is raised. >>> result . status RUNNING >>> result . return_value Traceback (most rece ... ... message = "Hello there!" , ) This returns a TaskResult , which can be used to retrieve the result of the Task once it has finished executing. To enqueue Tasks in an async context, aenqueue() is available as an async variant of enqueue() . Because both T ... skResult has a unique id , which can be used to identify and retrieve the result once the code which enqueued the Task has finished. The get_result() method can retrieve a result based on its id : # Later, somewhere else... result = email_users . get_res ... o.tasks.TaskResult.return_value attribute: >>> result . status SUCCESSFUL >>> result . return_value 42 If the Task has not finished executing, or has failed, ValueError is raised. >>> result . status RUNNING >>> result . return_value Traceback (most rece ... ... te. Developers wishing to access the raw POST data for these cases, should use the request.body attribute instead. request_finished signal ¶ Django used to send the request_finished signal as soon as the view function returned a response. This interacted ... request, most notably uWSGI prior to 1.2.6 and Sentry's error reporting middleware up to 2.0.7. In those cases the request_finished signal isn't sent at all. This can result in idle connections to database and memcache servers. OPTIONS, PUT and DELETE re ... d views Context in year and month archive class-based views Context in TemplateView Non-form data in HTTP requests request_finished signal OPTIONS, PUT and DELETE requests in the test client System version of simplejson no longer used String types of has ... ... te. Developers wishing to access the raw POST data for these cases, should use the request.body attribute instead. request_finished signal ¶ Django used to send the request_finished signal as soon as the view function returned a response. This interacted ... request, most notably uWSGI prior to 1.2.6 and Sentry's error reporting middleware up to 2.0.7. In those cases the request_finished signal isn't sent at all. This can result in idle connections to database and memcache servers. OPTIONS, PUT and DELETE re ... d views Context in year and month archive class-based views Context in TemplateView Non-form data in HTTP requests request_finished signal OPTIONS, PUT and DELETE requests in the test client System version of simplejson no longer used String types of has ... 2026年10月08日