{ "info": { "author": "OpenCensus Authors", "author_email": "census-developers@googlegroups.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "OpenCensus Runtime Context\n============================================================================\n\n|pypi|\n\n.. |pypi| image:: https://badge.fury.io/py/opencensus-context.svg\n :target: https://pypi.org/project/opencensus-context/\n\nThe **OpenCensus Runtime Context** provides in-process context propagation.\nBy default, ``thread local storage`` is used for Python 2.7, 3.4 and 3.5;\n``contextvars`` is used for Python >= 3.6, which provides ``asyncio`` support.\n\nInstallation\n------------\n\nThis library is installed by default with ``opencensus``, there is no need\nto install it explicitly.\n\nUsage\n-----\n\nIn most cases context propagation happens automatically within a process,\nfollowing the control flow of threads and asynchronous coroutines. The runtime\ncontext is a dictionary stored in a `context variable `_\nwhen available, and in `thread local storage `_\notherwise.\n\nThere are cases where you may want to propagate the context explicitly:\n\nExplicit Thread Creation\n~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n from threading import Thread\n from opencensus.common.runtime_context import RuntimeContext\n\n def work(name):\n # here you will get the context from the parent thread\n print(RuntimeContext)\n\n thread = Thread(\n # propagate context explicitly\n target=RuntimeContext.with_current_context(work),\n args=('foobar',),\n )\n thread.start()\n thread.join()\n\nThread Pool\n~~~~~~~~~~~\n\n.. code:: python\n\n from multiprocessing.dummy import Pool as ThreadPool\n from opencensus.common.runtime_context import RuntimeContext\n\n def work(name):\n # here you will get the context from the parent thread\n print(RuntimeContext)\n\n pool = ThreadPool(2)\n # propagate context explicitly\n pool.map(RuntimeContext.with_current_context(work), [\n 'bear',\n 'cat',\n 'dog',\n 'horse',\n 'rabbit',\n ])\n pool.close()\n pool.join()\n\nReferences\n----------\n\n* `Examples `_\n* `OpenCensus Project `_\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/census-instrumentation/opencensus-python/tree/master/context/opencensus-context", "keywords": "", "license": "Apache-2.0", "maintainer": "", "maintainer_email": "", "name": "opencensus-context", "package_url": "https://pypi.org/project/opencensus-context/", "platform": "", "project_url": "https://pypi.org/project/opencensus-context/", "project_urls": { "Homepage": "https://github.com/census-instrumentation/opencensus-python/tree/master/context/opencensus-context" }, "release_url": "https://pypi.org/project/opencensus-context/0.1.1/", "requires_dist": [ "contextvars ; python_version >= \"3.6\" and python_version < \"3.7\"" ], "requires_python": "", "summary": "OpenCensus Runtime Context", "version": "0.1.1" }, "last_serial": 5640780, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "a8f7bdc0990b20db6c71ecda1f5dd043", "sha256": "0d63a1da591b529371d4121819ffe0c191548236a24af3df5b502d3e6eb10447" }, "downloads": -1, "filename": "opencensus_context-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a8f7bdc0990b20db6c71ecda1f5dd043", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3727, "upload_time": "2019-04-09T01:44:59", "url": "https://files.pythonhosted.org/packages/67/71/ca8180acc6f43ec9b1ef91fe5b0dc30c8671d410d22d342179ba13a1b894/opencensus_context-0.1.0-py2.py3-none-any.whl" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "d9544c3095cfa936806c671f5a51c4c2", "sha256": "1a3fdf6bec537031efcc93d51b04f1edee5201f8c9a0c85681d63308b76f5702" }, "downloads": -1, "filename": "opencensus_context-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d9544c3095cfa936806c671f5a51c4c2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4430, "upload_time": "2019-06-01T04:02:19", "url": "https://files.pythonhosted.org/packages/2b/b7/720d4507e97aa3916ac47054cd75490de6b6148c46d8c2c487638f16ad95/opencensus_context-0.1.1-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d9544c3095cfa936806c671f5a51c4c2", "sha256": "1a3fdf6bec537031efcc93d51b04f1edee5201f8c9a0c85681d63308b76f5702" }, "downloads": -1, "filename": "opencensus_context-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d9544c3095cfa936806c671f5a51c4c2", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4430, "upload_time": "2019-06-01T04:02:19", "url": "https://files.pythonhosted.org/packages/2b/b7/720d4507e97aa3916ac47054cd75490de6b6148c46d8c2c487638f16ad95/opencensus_context-0.1.1-py2.py3-none-any.whl" } ] }