{ "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": "# appenginetaskutils\nThis is the repo for the appengine task utils library. It generates the appenginetaskutils package \n\n## Install \n\nUse the python package for this library. You can find the package online [here](https://pypi.python.org/pypi/appenginetaskutils).\n\nChange to your Python App Engine project's root folder and do the following:\n\n> pip install appenginetaskutils --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\nThe most basic element of the taskutils library is task(). This decorator function is designed to be used as a replacement for [deferred](https://cloud.google.com/appengine/articles/deferred).\n\n### Configuring @task\n\nWhen using deferred you have a builtin to configure in app.yaml to make it work. For taskutils.task, you need to add the following to your app.yaml and/or \\.yaml file:\n\n\thandlers:\n\t\t- url: /_ah/task/.*\n\t\t script: taskutils.app\n\t\t login: admin\n\nThis rule creates a generic handler for task to defer work to background push tasks.\n\nAdd it at the top of the list (to make sure other rules don't override it).\n\n### Importing task\n\nYou can import task into your modules like this:\n\n\tfrom taskutils 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": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/emlynoregan/im_futurendbsharded", "keywords": "", "license": "../LICENSE.txt", "maintainer": "", "maintainer_email": "", "name": "im-futurendbsharded", "package_url": "https://pypi.org/project/im-futurendbsharded/", "platform": "", "project_url": "https://pypi.org/project/im-futurendbsharded/", "project_urls": { "Homepage": "https://github.com/emlynoregan/im_futurendbsharded" }, "release_url": "https://pypi.org/project/im-futurendbsharded/0.1.2/", "requires_dist": [ "im-task", "im-util", "im-future" ], "requires_python": "", "summary": "future based ndb sharded functions, for traversing ndb objects at any scale, for Google App Engine, Python standard environment", "version": "0.1.2" }, "last_serial": 3747751, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "f2401a66e3cba3e34cabb867985eb4d3", "sha256": "504dff82dbaa6ba465b7bcda9259cd510151fa96486c829a170a961091ad027d" }, "downloads": -1, "filename": "im_futurendbsharded-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f2401a66e3cba3e34cabb867985eb4d3", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7930, "upload_time": "2018-02-23T06:03:24", "url": "https://files.pythonhosted.org/packages/b2/78/c0428eb2cabe660308a9ce79d97c7be1b5873e21eeb4a1da4bc208469d31/im_futurendbsharded-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "272d160c2668d04af3f6493ae29a9be9", "sha256": "65039ce30d71dda04e351271f7039c77e41b818fb7fd72ef044e2671fe8acb7a" }, "downloads": -1, "filename": "im_futurendbsharded-0.1.0.tar.gz", "has_sig": false, "md5_digest": "272d160c2668d04af3f6493ae29a9be9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4848, "upload_time": "2018-02-23T06:03:25", "url": "https://files.pythonhosted.org/packages/5b/73/75b1979b2daa98d17a99bf715a58e3389a725d36ef8bd178ec9c662e5bfa/im_futurendbsharded-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "76c29d445e60ebe40c8b75892f01dac4", "sha256": "61bed5e9777039602ce2e86ac41a590480cb75d1ffa38c0314f88ad1dab72696" }, "downloads": -1, "filename": "im_futurendbsharded-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "76c29d445e60ebe40c8b75892f01dac4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7964, "upload_time": "2018-04-06T06:40:14", "url": "https://files.pythonhosted.org/packages/97/41/f235a1c880e0c05ab1dbd8da96a4949a6fd5de46c355d14e50ec766b371d/im_futurendbsharded-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "defd9eb1de96891e3f65b5e08895b623", "sha256": "bbb5d52333fd4b3523094065e489dcfaa7c5637787bab0e0e89bfcdfc17be232" }, "downloads": -1, "filename": "im_futurendbsharded-0.1.1.tar.gz", "has_sig": false, "md5_digest": "defd9eb1de96891e3f65b5e08895b623", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4882, "upload_time": "2018-04-06T06:40:15", "url": "https://files.pythonhosted.org/packages/5c/9b/02e6fbe25ecfa34100c6f4b3ee5badc4daf4e74ce1d05d69b09dacbf7928/im_futurendbsharded-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "37883421591848083c536b6308c3850b", "sha256": "ab95417e6aaa9019b0a51b319cb3ed964b56e42917ac939816eefb24e320d83a" }, "downloads": -1, "filename": "im_futurendbsharded-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "37883421591848083c536b6308c3850b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7977, "upload_time": "2018-04-09T07:14:45", "url": "https://files.pythonhosted.org/packages/b3/7c/922253916bca945042a015e49fc2abe03fd49401054b8ed9feebc8b05e55/im_futurendbsharded-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d033610f61da1e4d2d7981f780d5f1a8", "sha256": "d632e32e095e2ae377049507e4fe3a64c1a3da401b370cd4ad1ee8667ddd43f0" }, "downloads": -1, "filename": "im_futurendbsharded-0.1.2.tar.gz", "has_sig": false, "md5_digest": "d033610f61da1e4d2d7981f780d5f1a8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4894, "upload_time": "2018-04-09T07:14:46", "url": "https://files.pythonhosted.org/packages/e2/0b/04a046c951f546805c3ef2eda23c708c62ced8b3ca72abc86a028f8377a7/im_futurendbsharded-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "37883421591848083c536b6308c3850b", "sha256": "ab95417e6aaa9019b0a51b319cb3ed964b56e42917ac939816eefb24e320d83a" }, "downloads": -1, "filename": "im_futurendbsharded-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "37883421591848083c536b6308c3850b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7977, "upload_time": "2018-04-09T07:14:45", "url": "https://files.pythonhosted.org/packages/b3/7c/922253916bca945042a015e49fc2abe03fd49401054b8ed9feebc8b05e55/im_futurendbsharded-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d033610f61da1e4d2d7981f780d5f1a8", "sha256": "d632e32e095e2ae377049507e4fe3a64c1a3da401b370cd4ad1ee8667ddd43f0" }, "downloads": -1, "filename": "im_futurendbsharded-0.1.2.tar.gz", "has_sig": false, "md5_digest": "d033610f61da1e4d2d7981f780d5f1a8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4894, "upload_time": "2018-04-09T07:14:46", "url": "https://files.pythonhosted.org/packages/e2/0b/04a046c951f546805c3ef2eda23c708c62ced8b3ca72abc86a028f8377a7/im_futurendbsharded-0.1.2.tar.gz" } ] }