{ "info": { "author": "GeorgeLubaretsi", "author_email": "", "bugtrack_url": null, "classifiers": [ "Framework :: Django", "Framework :: Django :: 1.11", "Framework :: Django :: 2.0", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "============================\nDjango Cloud Tasks\n============================\nIntegrate `Google Cloud Tasks `_ with Django.\n\nPackage provides easy to use decorator to create task handlers.\n\nApp looks for tasks in ``cloud_tasks.py`` files in your installed applications and auto-registers them.\n\nPackage is in early alpha and it does not have any real security at the moment. You need to authorize requests coming\nto your instances yourself.\n\nPrerequisites\n=============\n\n- Django 1.8+\n- Python 3.4, 3.5, 3.6\n\nDependencies\n============\n\n- `google-api-python-client `_\n\nDocumentation\n=============\n\nTODO\n\nInstallation\n============\n\n(1) Install latest version from Github (PyPy package will be available as soon as stable version is released):\n\n .. code-block:: sh\n\n pip install -e git+git@github.com:GeorgeLubaretsi/django-cloud-tasks.git#egg=django_cloud_tasks\n\n\n(2) Add ``django_cloud_tasks`` to ``INSTALLED_APPS``:\n\n .. code-block:: python\n\n INSTALLED_APPS = (\n # ...\n 'django_cloud_tasks',\n # ...\n )\n\n\n(3) Add configuration to your settings\n\n .. code-block:: python\n\n DJANGO_CLOUD_TASKS={\n 'project_location_name': 'projects/{project_name}/locations/us-central1',\n 'task_handler_root_url': '/_tasks/',\n },\n\n # This setting allows you to debug your cloud tasks by running actual task handler function locally\n # instead of sending them to the task queue. Default: False\n DJANGO_CLOUD_TASKS_EXECUTE_LOCALLY = False\n\n # If False, running `.execute()` on remote task will simply log the task data instead of adding it to\n # the queue. Useful for debugging. Default: True\n DJANGO_CLOUD_TASKS_BLOCK_REMOTE_TASKS = False\n\n\n(4) Add cloud task views to your urls.py (must resolve to the same url as ``task_handler_root_url``)\n\n .. code-block:: python\n\n # urls.py\n # ...\n from django.urls import path, include\n from django_cloud_tasks import urls as dct_urls\n\n urlpatterns = [\n # ...\n path('_tasks/', include(dct_urls)),\n ]\n\n\n\nQuick start\n===========\n\nSimply import the task decorator and define the task inside ``cloud_tasks.py`` in your app.\nFirst parameter should always be ``request`` which is populated after task is executed by Cloud Task service.\n\nYou can get actual request coming from Cloud Task service by accessing ``request.request`` in your task body and\nadditional attributes such as: ``request.task_id```, ```request.request_headers```\n\n.. code-block:: python\n\n # cloud_tasks.py\n # ...\n from django_cloud_tasks.decorators import task\n\n @task(queue='default')\n def example_task(request, p1, p2):\n print(p1, p2)\n print(request.task_id)\n\n\nPushing the task to the queue:\n\n.. code-block:: python\n\n from my_app.cloud_tasks import example_task\n\n example_task(p1='1', p2='2').execute()\n\n\nPushing remote task to the queue (when task handler is defined elsewhere):\n\n.. code-block:: python\n\n from django_cloud_tasks import remote_task\n from django_cloud_tasks import batch_execute\n\n example_task = remote_task(queue='my-queue', handler='remote_app.cloud_tasks.example_task'):\n payload_1 = example_task(payload={'p1': 1, 'p2': '2'})\n payload_2 = example_task(payload={'p1': 2, 'p2': '3'})\n\n # Execute in batch:\n batch_execute([payload_1, payload_2])\n\n # Or one by one:\n payload_1.execute()\n payload_2.execute()\n\n\nYou can also send tasks in batch if latency is an issue and you have to send many small tasks to the queue\n(limited to 1000 at a time):\n\n.. code-block:: python\n\n from my_app.cloud_tasks import example_task\n from django_cloud_tasks import batch_execute\n\n tasks = []\n for i in range(0, 420):\n task = example_task(p1=i, p2=i)\n tasks.append(task)\n\n batch_execute(tasks)\n\n\n\nIt is also possible to run an actual function using ``run`` method of ``CloudTaskWrapper`` object instance that is returned after task is called (this can be useful for debugging):\n\n.. code-block:: python\n\n task = example_task(p1=i, p2=i)\n task.run()\n\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/GeorgeLubaretsi/django-cloud-tasks", "keywords": "django cloudtasks cloud tasks", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-cloud-tasks", "package_url": "https://pypi.org/project/django-cloud-tasks/", "platform": "", "project_url": "https://pypi.org/project/django-cloud-tasks/", "project_urls": { "Homepage": "https://github.com/GeorgeLubaretsi/django-cloud-tasks" }, "release_url": "https://pypi.org/project/django-cloud-tasks/0.0.4/", "requires_dist": [ "google-api-python-client (>=1.6.4)" ], "requires_python": "", "summary": "Google Cloud Tasks integration for Django", "version": "0.0.4" }, "last_serial": 4360546, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "089a6a39f79a5cafbfbd8525482ede70", "sha256": "26e29563197c16419b6904e3fe773d1eb9acef54bb6ddd28354b36d48f3cb6f8" }, "downloads": -1, "filename": "django-cloud-tasks-0.0.2.tar.gz", "has_sig": false, "md5_digest": "089a6a39f79a5cafbfbd8525482ede70", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8078, "upload_time": "2018-08-25T21:42:54", "url": "https://files.pythonhosted.org/packages/6a/7a/2d7dc4a100fd081fecd04aee681ce50f6ae29f49cb962acae5eaf616dd12/django-cloud-tasks-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "31b88b561a14782b62c6bc839b6ac2f5", "sha256": "2bdba0c18a65607da6537d67b74a2e282c0e3c7d560f4764b1cca2456e648e08" }, "downloads": -1, "filename": "django_cloud_tasks-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "31b88b561a14782b62c6bc839b6ac2f5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10114, "upload_time": "2018-09-12T15:52:11", "url": "https://files.pythonhosted.org/packages/a9/7e/8d19b456f8dfc63f0afbc4f6b19862a81ac1acd5e810e9ec055dbf026ba4/django_cloud_tasks-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "02fcfe8a0c1c5f6d3f09c45070b3caa0", "sha256": "dc882987ffa908833f351aa3d40a788bb16ebe36f7d410545fb935607b8c76e5" }, "downloads": -1, "filename": "django-cloud-tasks-0.0.3.tar.gz", "has_sig": false, "md5_digest": "02fcfe8a0c1c5f6d3f09c45070b3caa0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8088, "upload_time": "2018-09-12T15:52:13", "url": "https://files.pythonhosted.org/packages/f0/77/b37b6d7bda74b725f93cd7d0a0e7d55bf9eeab2e078a7f7337d956ef8671/django-cloud-tasks-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "48a66bbab3b85ea6eeda9f3ea32470f9", "sha256": "c9b2103fd1b65201d92f8803f3e4cb65f132e010851b90222008558f6050043f" }, "downloads": -1, "filename": "django_cloud_tasks-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "48a66bbab3b85ea6eeda9f3ea32470f9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10088, "upload_time": "2018-10-10T15:38:09", "url": "https://files.pythonhosted.org/packages/45/4a/d2f8fa74c4eac830d0c8a445e81e352458ef7823db793a15471801526239/django_cloud_tasks-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e9bf9380ae52e170bbcdaf2673069c1d", "sha256": "d048b3f7cb168c02db10f3b80ef9c42d0ee9bd716b3e61487200ce756d90912a" }, "downloads": -1, "filename": "django-cloud-tasks-0.0.4.tar.gz", "has_sig": false, "md5_digest": "e9bf9380ae52e170bbcdaf2673069c1d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8066, "upload_time": "2018-10-10T15:38:11", "url": "https://files.pythonhosted.org/packages/45/d1/6f12c890f73e63be2b52a3a235245e70e0924c1d5f1d524bc2a6efb30cec/django-cloud-tasks-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "48a66bbab3b85ea6eeda9f3ea32470f9", "sha256": "c9b2103fd1b65201d92f8803f3e4cb65f132e010851b90222008558f6050043f" }, "downloads": -1, "filename": "django_cloud_tasks-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "48a66bbab3b85ea6eeda9f3ea32470f9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10088, "upload_time": "2018-10-10T15:38:09", "url": "https://files.pythonhosted.org/packages/45/4a/d2f8fa74c4eac830d0c8a445e81e352458ef7823db793a15471801526239/django_cloud_tasks-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e9bf9380ae52e170bbcdaf2673069c1d", "sha256": "d048b3f7cb168c02db10f3b80ef9c42d0ee9bd716b3e61487200ce756d90912a" }, "downloads": -1, "filename": "django-cloud-tasks-0.0.4.tar.gz", "has_sig": false, "md5_digest": "e9bf9380ae52e170bbcdaf2673069c1d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8066, "upload_time": "2018-10-10T15:38:11", "url": "https://files.pythonhosted.org/packages/45/d1/6f12c890f73e63be2b52a3a235245e70e0924c1d5f1d524bc2a6efb30cec/django-cloud-tasks-0.0.4.tar.gz" } ] }