{ "info": { "author": "Emlyn O'Regan", "author_email": "emlynoregan@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Distributed Computing" ], "description": "# im_task\nThis package contains the @task function, for decorating python functions to be appengine tasks.\n\n## Install\n\nUse the python package for this library. You can find the package online [here](https://pypi.org/project/im-task/).\n\nChange to your Python App Engine project's root folder and do the following:\n\n> pip install im_task --target lib\n\nOr add it to your requirements.txt. You'll also need to set up vendoring, see [app engine vendoring instructions here](https://cloud.google.com/appengine/docs/python/tools/using-libraries-python-27).\n\n## @task\n\nThis decorator function is designed to be used as a replacement for [deferred](https://cloud.google.com/appengine/articles/deferred).\n\n### Configuring @task\n\nThis bit needs a rewrite. Note that this library doesn't provide utilities for frameworks (eg: flask, webapp2), for those you'll\nwant the following packages:\n\n- im_task_flask\n- im_task_webapp2\n\n### Importing task\n\nYou can import task into your modules like this:\n\n\tfrom im_task import task\n\n### Using task as a decorator\n\nYou can take any function and make it run in a separate task, like this:\n\n\t@task\n\tdef myfunction():\n\t ... do stuff ... \n\nJust call the function normally, eg:\n\n\tmyfunction()\n\nYou can use @task on any function, including nested functions, recursive functions, recursive nested functions, the sky is the limit. This is possible because of use of [yccloudpickle](https://medium.com/the-infinite-machine/python-function-serialisation-with-yccloudpickle-b2ff6b2ad5da#.zei3n0ibu) as the underlying serialisation library.\n\nYour function can also have arguments, including other functions:\n\n\tdef myouterfunction(mapf):\n\n\t @task\n\t def myinnerfunction(objects):\n\t \tfor object in objects:\n\t \t\tmapf(object)\n\n\t ...get some list of lists of objects... \n\t\tfor objects in objectslist:\n\t\t\tmyinnerfunction(objects)\n\n\tdef dosomethingwithobject(object):\n\t\t... do something with an object ...\t\t\n\n\tmyouterfunction(dosomethingwithobject)\n\nThe functions and arguments are being serialised and deserialised for you behind the scenes.\n\nWhen enqueuing a background task, the App Engine Task and TaskQueue libraries can take a set of parameters. You can pass these to the decorator:\n\n\t@task(queue=\"myqueue\", countdown=5)\n\tdef anotherfunction():\n\t ... do stuff ... \n\nDetails of the arguments allowed to Tasks are available [here](https://cloud.google.com/appengine/docs/python/refdocs/google.appengine.api.taskqueue), under **class google.appengine.api.taskqueue.Task(payload=None, \\*\\*kwargs)**. The task decorator supports a couple of extra ones, detailed below.\n\n### Using task as a factory\n\nYou can also use task to decorate a function on the fly, like this:\n\n\tdef somefunction(a, b):\n\t ... does something ...\n\n somefunctionintask = task(somefunction, queue=\"myqueue\")\n\nThen you can call the function returned by task when you are ready:\n\n somefunctionintask(1, 2)\n\nYou could do both of these steps at once, too:\n\n\n task(somefunction, queue=\"myqueue\")(1, 2)\n\n### transactional\n\nPass transactional=True to have your [task launch transactionally](https://cloud.google.com/appengine/docs/python/datastore/transactions#transactional_task_enqueuing). eg:\n\n\t@task(transactional=True)\n\tdef myserioustransactionaltask():\n\t ...\n\n### includeheaders\n\nIf you'd like access to headers in your function (a dictionary of headers passed to your task, it's a web request after all), set includeheaders=True in your call to @task. You'll also need to accept the headers argument in your function.\n\n\t@task(includeheaders=True)\n\tdef myfunctionwithheaders(amount, headers):\n\t ... stuff ...\n\n\tmyfunctionwithheaders(10)\n\nApp Engine passes useful information to your task in headers, for example X-Appengine-TaskRetryCount.\n\n### other bits\n\nWhen using deferred, all your calls are logged as /_ah/queue/deferred. But @task uses a url of the form /_ah/task/\\/\\, eg:\n\n\t/_ah/task/mymodule/somefunction\n\nwhich makes debugging a lot easier.\n\n\n##\n\n\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/emlynoregan/im_task", "keywords": "", "license": "../LICENSE.txt", "maintainer": "", "maintainer_email": "", "name": "im-task", "package_url": "https://pypi.org/project/im-task/", "platform": "", "project_url": "https://pypi.org/project/im-task/", "project_urls": { "Homepage": "https://github.com/emlynoregan/im_task" }, "release_url": "https://pypi.org/project/im-task/0.1.1/", "requires_dist": [ "im-util (>=0.1.4)", "cloudpickle" ], "requires_python": "", "summary": "@task for Google App Engine, Python standard environment", "version": "0.1.1" }, "last_serial": 3608066, "releases": { "0.0.1.dev1": [ { "comment_text": "", "digests": { "md5": "8d27459d00dd2f8b80a52090a3deeac8", "sha256": "9e41f712ff91813a6dafc8abebf3823d12b22015789f3e069c829734ff359657" }, "downloads": -1, "filename": "im_task-0.0.1.dev1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8d27459d00dd2f8b80a52090a3deeac8", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8299, "upload_time": "2018-02-22T03:17:43", "url": "https://files.pythonhosted.org/packages/f1/d5/efc97fbc009cf7ff0c0dc06c41458d107dd018a0a1cf9ebab7f7ef1f6bfb/im_task-0.0.1.dev1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0007effbce474e5f15c51c2cadea4e0d", "sha256": "7abc8cd40f1a37325c14ae13f39c3b43a3ef426a2de245298e5852ac0a73a300" }, "downloads": -1, "filename": "im_task-0.0.1.dev1.tar.gz", "has_sig": false, "md5_digest": "0007effbce474e5f15c51c2cadea4e0d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5584, "upload_time": "2018-02-22T03:17:44", "url": "https://files.pythonhosted.org/packages/61/cc/06be2fcf2a602f4649e4933012f1e2e7638a0d7498f7d947e4fa0d953735/im_task-0.0.1.dev1.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "1e1f7130567f311a4980d9470bc5ca46", "sha256": "6d808b043b2c1a156b536e64680205aa9abd582b7097d3375324ba6391fca024" }, "downloads": -1, "filename": "im_task-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1e1f7130567f311a4980d9470bc5ca46", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8217, "upload_time": "2018-02-22T04:57:04", "url": "https://files.pythonhosted.org/packages/46/12/0425f86729ab7e4b5ff2b52e8dcc4117fd288aabe94b25c74556c0fad002/im_task-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5722c39bb9b5b8be64a1d1c7fe350334", "sha256": "bd33e9de28c9a48cd645884965fc4937240502426dba78668991ab98d8f274f0" }, "downloads": -1, "filename": "im_task-0.1.0.tar.gz", "has_sig": false, "md5_digest": "5722c39bb9b5b8be64a1d1c7fe350334", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5250, "upload_time": "2018-02-22T04:57:04", "url": "https://files.pythonhosted.org/packages/3b/c0/00e163c6cd0fc5f6c502ef8663f6145ee4025698d0e2759d6231f31b3f05/im_task-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "f1b91e271fe3ef3b550324c5a9c0fecb", "sha256": "5ea5cf4c8268a0cb90de65a5c4b96823691e29f7146a2da910fbd5adff4b3ecf" }, "downloads": -1, "filename": "im_task-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f1b91e271fe3ef3b550324c5a9c0fecb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7977, "upload_time": "2018-02-23T06:54:04", "url": "https://files.pythonhosted.org/packages/d3/b4/adec7a4c5c2d6a8b2a64d326be75af5529f564fed832e1aa8df94c6148a0/im_task-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ff711c41d6f8a8116dc65d53fe8fe470", "sha256": "b478e7c23de81f553268c39c2494ecb337b36d72d25427f439677f27c55ad440" }, "downloads": -1, "filename": "im_task-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ff711c41d6f8a8116dc65d53fe8fe470", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5083, "upload_time": "2018-02-23T06:54:06", "url": "https://files.pythonhosted.org/packages/43/69/27cc561d0190bb7194f1b9981d8595024af19485e9ce36198b84b61a1688/im_task-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f1b91e271fe3ef3b550324c5a9c0fecb", "sha256": "5ea5cf4c8268a0cb90de65a5c4b96823691e29f7146a2da910fbd5adff4b3ecf" }, "downloads": -1, "filename": "im_task-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f1b91e271fe3ef3b550324c5a9c0fecb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7977, "upload_time": "2018-02-23T06:54:04", "url": "https://files.pythonhosted.org/packages/d3/b4/adec7a4c5c2d6a8b2a64d326be75af5529f564fed832e1aa8df94c6148a0/im_task-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ff711c41d6f8a8116dc65d53fe8fe470", "sha256": "b478e7c23de81f553268c39c2494ecb337b36d72d25427f439677f27c55ad440" }, "downloads": -1, "filename": "im_task-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ff711c41d6f8a8116dc65d53fe8fe470", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5083, "upload_time": "2018-02-23T06:54:06", "url": "https://files.pythonhosted.org/packages/43/69/27cc561d0190bb7194f1b9981d8595024af19485e9ce36198b84b61a1688/im_task-0.1.1.tar.gz" } ] }