{ "info": { "author": "Stephen Tierney", "author_email": "sjtrny@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License" ], "description": "[![Documentation Status](https://readthedocs.org/projects/mockr/badge/?version=latest)](https://mockr.readthedocs.io/en/latest/?badge=latest)\n\n# mockr\n\nmockr is a Python library for writing MapReduce jobs in an Educational setting. It is intended to be used as a\nconceptual teaching tool.\n\nmockr provides an interface for defining and running MapReduce locally. Simply define your map and reduce functions,\ninput your data and call the run function. Everything is run sequentially and locally.\n\n## Installation\n\n pip install mockr\n\n## Documentation\n\nFull documentation available here [https://mockr.readthedocs.io/](https://mockr.readthedocs.io/)\n\n### Streaming Jobs\n\nStreamingJob class which expects the input to be a byte stream of characters. The chunks of data are separated by\nnewline (\"\\n\") characters. Each line is sent to a separate map worker.\n\n### Native Python Sequence Jobs\n\nPythonJob class expects input to be a Collections.abc.Sequence type object e.g. Python List. Python Jobs provide two\nexection methods:\n\n- the sequence is divided into chunks and each chunk is sent to a separate map worker\n- each item in the list is individually sent to a dedicated map worker\n\n### Pandas Jobs\n\nPandasJob class expects input to be a Pandas DataFrame. The rows of the data frame are equally divided into chunks and\neach chunk is sent to a separate map worker\n\n\n## Example Usage\n\n import re\n from mockr import run_stream_job\n\n WORD_RE = re.compile(r\"[\\w']+\")\n\n def map_fn(chunk):\n # yield each word in the line\n for word in WORD_RE.findall(chunk):\n yield (word.lower(), 1)\n\n def reduce_fn(key, values):\n yield (key, sum(values))\n\n input_str = \"Hello!\\nThis is a sample string.\\nIt is very simple.\\nGoodbye!\"\n\n results = run_stream_job(input_str, map_fn, reduce_fn)\n\n print(results)\n\n\nOutput:\n\n [('hello', 1), ('this', 1), ('is', 2), ('a', 1), ('sample', 1), ('string', 1), ('it', 1), ('very', 1), ('simple', 1), ('goodbye', 1)]\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sjtrny/mockr", "keywords": "mockr mapreduce map reduce education", "license": "", "maintainer": "", "maintainer_email": "", "name": "mockr", "package_url": "https://pypi.org/project/mockr/", "platform": "", "project_url": "https://pypi.org/project/mockr/", "project_urls": { "Homepage": "https://github.com/sjtrny/mockr" }, "release_url": "https://pypi.org/project/mockr/0.36/", "requires_dist": [ "pandas" ], "requires_python": ">=3", "summary": "A Python library for prototyping MapReduce jobs", "version": "0.36" }, "last_serial": 4111241, "releases": { "0.36": [ { "comment_text": "", "digests": { "md5": "7b718228598d40219ec8cd8f74a907eb", "sha256": "90b33602a87ae963eb46818dbd27e2533ed623b7b11d3616b292815e614ec7b2" }, "downloads": -1, "filename": "mockr-0.36-py3-none-any.whl", "has_sig": false, "md5_digest": "7b718228598d40219ec8cd8f74a907eb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 4108, "upload_time": "2018-07-28T08:27:33", "url": "https://files.pythonhosted.org/packages/64/2a/4d95feac8c2dc83992a655ab551705965c51bada3ba1cfe6f501705a8716/mockr-0.36-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7b718228598d40219ec8cd8f74a907eb", "sha256": "90b33602a87ae963eb46818dbd27e2533ed623b7b11d3616b292815e614ec7b2" }, "downloads": -1, "filename": "mockr-0.36-py3-none-any.whl", "has_sig": false, "md5_digest": "7b718228598d40219ec8cd8f74a907eb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 4108, "upload_time": "2018-07-28T08:27:33", "url": "https://files.pythonhosted.org/packages/64/2a/4d95feac8c2dc83992a655ab551705965c51bada3ba1cfe6f501705a8716/mockr-0.36-py3-none-any.whl" } ] }