{ "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_futuregcsfilesharded", "keywords": "", "license": "../LICENSE.txt", "maintainer": "", "maintainer_email": "", "name": "im-futuregcsfilesharded", "package_url": "https://pypi.org/project/im-futuregcsfilesharded/", "platform": "", "project_url": "https://pypi.org/project/im-futuregcsfilesharded/", "project_urls": { "Homepage": "https://github.com/emlynoregan/im_futuregcsfilesharded" }, "release_url": "https://pypi.org/project/im-futuregcsfilesharded/0.1.1/", "requires_dist": [ "im-task", "im-util", "GoogleAppEngineCloudStorageClient", "im-future", "im-gcsfilesharded" ], "requires_python": "", "summary": "future based gcs file sharding map functions, for traversing gcs text files at any scale, for Google App Engine, Python standard environment", "version": "0.1.1" }, "last_serial": 3740116, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "a203d36261115fc2ccd7cc943da45e32", "sha256": "b9de452f78d838d3d2b9ad515ae2d3a2b45a28f3b6c27c52d6ff114e861e1774" }, "downloads": -1, "filename": "im_futuregcsfilesharded-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a203d36261115fc2ccd7cc943da45e32", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7379, "upload_time": "2018-02-23T06:12:09", "url": "https://files.pythonhosted.org/packages/c6/5f/186d9f1e6cc5fec626567c643f78f655f8ee85579463224588b938f4582f/im_futuregcsfilesharded-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f7a4baa2fa60f755219e86019ca03c18", "sha256": "a3efb39bd85c02d5d58942181f5cb228a57e9af0918dbe38fdce90f9e931cffc" }, "downloads": -1, "filename": "im_futuregcsfilesharded-0.1.0.tar.gz", "has_sig": false, "md5_digest": "f7a4baa2fa60f755219e86019ca03c18", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4204, "upload_time": "2018-02-23T06:12:10", "url": "https://files.pythonhosted.org/packages/6b/14/ad12b8ae7b210ad599814b6b8d424f32a635b899e08f6daf6e9f11def288/im_futuregcsfilesharded-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "2dd243c52d20b682ebeb875c70fdddc1", "sha256": "5d8c6e63d1a0c176fde5adca664e39fee1b874a558f3e3569b674eadc64843d4" }, "downloads": -1, "filename": "im_futuregcsfilesharded-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2dd243c52d20b682ebeb875c70fdddc1", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7417, "upload_time": "2018-04-06T06:24:19", "url": "https://files.pythonhosted.org/packages/3c/15/77b5bb0e208bc83e446739444bb2d0f6968fddff2736cd77a50caddc616c/im_futuregcsfilesharded-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ce262cee73e3567129c182e5bf3cd402", "sha256": "4840d7128612ee53b199bfa8cfdb785dad50cae918a5404783bbd9ae8d0aedf3" }, "downloads": -1, "filename": "im_futuregcsfilesharded-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ce262cee73e3567129c182e5bf3cd402", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4233, "upload_time": "2018-04-06T06:24:20", "url": "https://files.pythonhosted.org/packages/07/be/3fd4609d9d0da8934f3b43190c8de2333b323e92f576f7ca97cde5bacbb9/im_futuregcsfilesharded-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2dd243c52d20b682ebeb875c70fdddc1", "sha256": "5d8c6e63d1a0c176fde5adca664e39fee1b874a558f3e3569b674eadc64843d4" }, "downloads": -1, "filename": "im_futuregcsfilesharded-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2dd243c52d20b682ebeb875c70fdddc1", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7417, "upload_time": "2018-04-06T06:24:19", "url": "https://files.pythonhosted.org/packages/3c/15/77b5bb0e208bc83e446739444bb2d0f6968fddff2736cd77a50caddc616c/im_futuregcsfilesharded-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ce262cee73e3567129c182e5bf3cd402", "sha256": "4840d7128612ee53b199bfa8cfdb785dad50cae918a5404783bbd9ae8d0aedf3" }, "downloads": -1, "filename": "im_futuregcsfilesharded-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ce262cee73e3567129c182e5bf3cd402", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4233, "upload_time": "2018-04-06T06:24:20", "url": "https://files.pythonhosted.org/packages/07/be/3fd4609d9d0da8934f3b43190c8de2333b323e92f576f7ca97cde5bacbb9/im_futuregcsfilesharded-0.1.1.tar.gz" } ] }