{ "info": { "author": "Abhishek Tamrakar", "author_email": "abhishek.tamrakar08@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3" ], "description": "# PessimisticLockMongo\nPessimistic lock implementation for mongoengine, using a very simple logic\n\n`Inspired by mongolock and pessimistic locks concept.`\n\nRead more about the implementation [here](https://medium.com/@abhishek.tamrakar/implementing-pessimistic-locks-in-mongodb-8f3fbe2ddfa9)\n\n## Setting up the context\nThe real intention behind writing this utility isn't just Database locking. Locking is already handled in mongoDB, sufficient or not, but it locks the Database with exclusive write locks, thats when the problem begins.\n\nWith multiple collections and frequent requests coming in, it is on DB performance when a transaction is waitingon the lock on Database, when there is only one collection involved in the operation at the moment.\n\nHence, this utility, targets collection based locking mechanism, fully controoled in application for the DB.\n\n## Usage\n```\nfrom mongoEngineLock import mongoEngineLock, MongoLockTimeout\n\nlock = mongoEngineLock('', poll=1, timeout=40, retries=15)\n\nwith lock(entity):\n try:\n <..do something here..>\n except Exception as e:\n raise e\n\n# or use with conditional statements\n\nif lock(entity):\n try:\n <..do something here..>\n except Exception as e:\n raise e\n```\n##### mongoEngineLock Parameters:\n**client**: connection information for MongoEngine.\n\n**poll**: interval to introduce a delay while retrying.\n\n**timeout**: interval (seconds) to introduce timeout.\n\n**retries**: number of retries before timeout.\n\n##### Instance of the class takes exactly 1 parameter: \n**entity**: owner of the lock or collection name(in case there are more than one collections to be managed in a database).\n\n## Misc\n* Try to use a smaller polling interval or interval based on time taken to execute the query, in case of bigger DB size.\n* Worth to mention, timeout or retries should not supersede each other. \n* Use proper NTP servers to keep your machines in time sync.\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/abhiTamrakar/PessimisticMongo", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "mongoEngineLock", "package_url": "https://pypi.org/project/mongoEngineLock/", "platform": "", "project_url": "https://pypi.org/project/mongoEngineLock/", "project_urls": { "Homepage": "https://github.com/abhiTamrakar/PessimisticMongo" }, "release_url": "https://pypi.org/project/mongoEngineLock/0.1.0/", "requires_dist": [ "mongoengine (>=0.16.3)", "pymongo (>=3.7.2)" ], "requires_python": "", "summary": "Mongoengine pessimistic lock utility", "version": "0.1.0" }, "last_serial": 4678102, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "46d1d648c7c0c3ec0308957ae4d5b074", "sha256": "2dbfd690188b62b4a476bb95aa90a6154e9be6a6750343f505701b32343424c2" }, "downloads": -1, "filename": "mongoEngineLock-0.1.0-py2-none-any.whl", "has_sig": false, "md5_digest": "46d1d648c7c0c3ec0308957ae4d5b074", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 5544, "upload_time": "2019-01-09T19:19:11", "url": "https://files.pythonhosted.org/packages/6f/66/63d9c9b2032375568098598e96d5b9960e927f6190051aca9ae1c08b6631/mongoEngineLock-0.1.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "572a4d77b8b121fc3d68751c1cfb0c12", "sha256": "7be6c0792516115c8378ba93778d821cbd54a1468ad035448fff8f679a1cedb8" }, "downloads": -1, "filename": "mongoEngineLock-0.1.0.tar.gz", "has_sig": false, "md5_digest": "572a4d77b8b121fc3d68751c1cfb0c12", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3536, "upload_time": "2019-01-09T19:19:14", "url": "https://files.pythonhosted.org/packages/b9/f6/336a2232e4ce947400556e7a6e3b6ce2b0c3496dde7216c694c13d0d0c78/mongoEngineLock-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "46d1d648c7c0c3ec0308957ae4d5b074", "sha256": "2dbfd690188b62b4a476bb95aa90a6154e9be6a6750343f505701b32343424c2" }, "downloads": -1, "filename": "mongoEngineLock-0.1.0-py2-none-any.whl", "has_sig": false, "md5_digest": "46d1d648c7c0c3ec0308957ae4d5b074", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 5544, "upload_time": "2019-01-09T19:19:11", "url": "https://files.pythonhosted.org/packages/6f/66/63d9c9b2032375568098598e96d5b9960e927f6190051aca9ae1c08b6631/mongoEngineLock-0.1.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "572a4d77b8b121fc3d68751c1cfb0c12", "sha256": "7be6c0792516115c8378ba93778d821cbd54a1468ad035448fff8f679a1cedb8" }, "downloads": -1, "filename": "mongoEngineLock-0.1.0.tar.gz", "has_sig": false, "md5_digest": "572a4d77b8b121fc3d68751c1cfb0c12", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3536, "upload_time": "2019-01-09T19:19:14", "url": "https://files.pythonhosted.org/packages/b9/f6/336a2232e4ce947400556e7a6e3b6ce2b0c3496dde7216c694c13d0d0c78/mongoEngineLock-0.1.0.tar.gz" } ] }