{ "info": { "author": "Salem Harrache", "author_email": "salem.harrache@inria.fr", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Clustering" ], "description": "Python OAR Common Library\r\n=========================\r\n\r\n.. image:: https://img.shields.io/travis/oar-team/python-oar-lib.svg\r\n :target: https://travis-ci.org/oar-team/python-oar-lib\r\n\r\n.. image:: https://img.shields.io/pypi/v/oar-lib.svg\r\n :target: https://pypi.python.org/pypi/oar-lib\r\n\r\n.. image:: http://codecov.io/github/oar-team/python-oar-lib/coverage.svg?branch=master\r\n :target: http://codecov.io/github/oar-team/python-oar-lib?branch=master\r\n\r\nPython version of OAR Common Library\r\n\r\n* Free software: BSD license\r\n* Documentation: https://oar-lib.readthedocs.org.\r\n\r\nRead Configuration\r\n-------------------\r\n\r\n::\r\n\r\n >>> from oar import config\r\n >>>\r\n >>> config.load_file(\"/path/to/config\")\r\n True\r\n >>> config[\"ENERGY_SAVING_INTERNAL\"]\r\n 'no'\r\n >>> config.get_namespace('OARSUB_')\r\n {'default_resources': '/resource_id=1', 'force_job_key': 'no', 'nodes_resources': 'network_address'}\r\n\r\n\r\nQuery the database\r\n------------------\r\n\r\n::\r\n\r\n >>> from oar import db, Resource\r\n >>> db\r\n \r\n\r\n::\r\n\r\n >>> db.query(Resource).first()\r\n \r\n >>> Resource.query.first()\r\n \r\n\r\n::\r\n\r\n >>> db\r\n \r\n\r\n::\r\n\r\n >>> for r in Resource.query.filter(Resource.core > 3).limit(2):\r\n ... print(r.id, r.network_address)\r\n ...\r\n (12L, u'node3')\r\n (9L, u'node3')\r\n\r\n::\r\n\r\n >>> req = db.query(Resource.id, Resource.network_address)\r\n >>> req.filter(Resource.core > 3).limit(2).all()\r\n [(12L, u'node3'), (9L, u'node3')]\r\n\r\n\r\nLogger\r\n------\r\n\r\nLogging from the root logger::\r\n\r\n >> from oar import logger as log\r\n >> log.info(\"Init confiuration\")\r\n ## [INFO] [2014-12-05 14:13:42,239] [oar]: Init confiuration\r\n\r\nLogging from your own sublogger::\r\n\r\n >> from oar import get_logger\r\n >> log = get_logger(\"oar.kao\")\r\n >> log.error(\"fatal error\")\r\n ## [ERROR] [2014-12-05 14:14:32,116] [oar.kao]: fatal error\r\n\r\n\r\n\r\nOAR lib changes\r\n===============\r\n\r\nVersion 0.4.1\r\n-------------\r\n\r\nReleased on September 30th 2015\r\n\r\n- [all] Switched the license to BSD\r\n- [all] Dropped python 3.3 support\r\n- [all] Little code refactoring\r\n\r\n- [database] Supported session read-only mode via oar_reader user\r\n- [database] ``engine.execute`` is not used directly anymore, prefer ``session.execute``\r\n- [database] Used the same database connection with alembic and sqlalchemy\r\n- [database] Added ephemeral session context manager that will rollback the transaction at the end\r\n- [database] Added ``db.show()`` method to quickly show the database content\r\n- [database] Used truncate instead of delete on postgresql in ``db.delete_all()``\r\n- [database] ``db.close()`` method closes the session and disposes the engine\r\n- [database] Fixed ``db.close`` method by removing deadlock\r\n- [database] Raised ``KeyError`` exception from ``Database`` if wanted ``Model`` or ``Table`` are missing\r\n- [database] Configured automatically default table args with ``DeclarativeMeta`` class\r\n- [database] Created ``DeferredReflectionModel`` metaclass per ``Database`` instance to avoid conflict during database reflection\r\n- [database] Collected declared tables and models when they are defined\r\n- [database] Avoided circular import of db object\r\n- [database] Generated a tablename if none specified\r\n\r\n- [models] The ``__repr__`` method in ``Model`` classes include the identity of the object (primary key)\r\n- [models] Set column ``Resource.scheduler_priority`` to ``BigInteger``\r\n- [models] Added ``BaseModel.to_json method()`` method to convert a sqlalchemy entity to json\r\n- [models] Added ``BaseModel.to_dict()`` method to convert a sqlalchemy entity to a dictionary\r\n- [models] Fixed ``BaseModel.create()`` method\r\n\r\n- [utils] Added ability to run command without timeout\r\n- [utils] Used decimal module to check if input is a number\r\n- [utils] Reset ``ResultProxyIter`` iterator automatically\r\n- [utils] Fixed ``ResultProxyIter`` rowcount\r\n- [utils] Reset ``cached_property`` attribut when deleted\r\n- [utils] Added ``merge_dicts()`` that merge given dictionaries into a new dictionary\r\n\r\n- [basequery] Updated ``Query.render()`` method to return a special string that have useful ``__repr__``\r\n- [basequery] Added ``BaseQuery.get_jobs_for_user()`` query\r\n\r\n- [test] Tested on postgresql and sqlite-file/memory with tox and travis.ci\r\n- [test] Added test helper scripts to populate database\r\n- [test] Fixed tests on python 3.4\r\n- [test] More tests\r\n\r\n- [compat] Removed unused ``SimpleNamespace`` class from compat module\r\n\r\n\r\nVersion 0.3.0\r\n-------------\r\n\r\nReleased on July 07th 2015\r\n\r\n- [database] Fixed ``Database.delete_all`` method to remove all database content\r\n- [database] Listed all datetime columns in ``models.TIME_COLUMNS``\r\n- [database] Made table and model import easier with getitem syntax (Eg. db['table_name'])\r\n- [database] Added an alembic operator as ``Database.op`` attribut\r\n- [database] Kept columns order during dictionary conversion\r\n- [database] Put MySQLdb SSCursor tweak on standby\r\n\r\n- [models] Added ``ResultProxyIter`` class that make SQLAlchemy ResultProxies iterable by dicts\r\n- [models] Fixed columns orders for admission_rules table\r\n- [models] ``models.all_tables`` returns a dictionary with table names as keys now\r\n- [models] Forwarded log to STDOUT if ``get_logger(..)`` receive ``stdout=True``\r\n\r\n- [configuration] New default configuration values for *DB_PORT=5432* and *DB_TYPE=Pg*\r\n- [configuration] Handled ``OARCONFFILE`` environment variable to load OAR configuration\r\n\r\n- [basequery] Added ``Query.render`` that generate an SQL expression string from statement\r\n- [basequery] Added ``get_gantt_visu_scheduled_jobs_resources`` method that returns all nodes allocated to a (waiting) reservation\r\n- [basequery] Added ``get_assigned_jobs_resources`` and groups results by job_id\r\n- [basequery] Optimized get_user_jobs query by using JOIN instead of IN operator\r\n- [basequery] Loaded only some columns with Load ORM object\r\n\r\n\r\n- [utils] Added ``utils.Command`` class to run subprocess commands with a timeout option\r\n- [utils] Moved ``JSONEncoder`` class from oar-rest-api to oar-lib\r\n- [utils] Removed unsed ``IterStream`` class\r\n- [utils] Added ``utils.row2dict`` function helpers to convert a RowProxy to a dict\r\n\r\n- [compat] Used simplejson if available\r\n\r\nVersion 0.2.0\r\n-------------\r\n\r\nReleased on June 23rd 2015\r\n\r\n- [config] Added clear parameter to clear the config before loading a new file\r\n- [config] only one default configuration file\r\n- [config] Made load file configuration atomic\r\n- [config] Warned user when configuration loading failed\r\n- [compat] Used iterator version of zip and range method\r\n- [compat] Removed unused string_types\r\n\r\n- [database] pg_bulk_insert that use COPY clause to perform batch inserts\r\n- [database] Added db.queries object that included all oar-lib sql queries\r\n- [database] Workaround to support table inheritance and __table_args__\r\n- [database] Moved the BaseQuery class to the basequery module\r\n\r\n- [models] Added missings relations between tables as dicts\r\n- [models] Used BigInteger type on Accounting fields\r\n- [models] Added all_tables method to get all tables\r\n\r\n- [basequery] make models module easier to read\r\n- [basequery] Added get_job_resources query\r\n- [basequery] Added filter_jobs_for_user method to build jobs query\r\n- [basequery] Added get_resources\r\n- [basequery] Added get_jobs_for_user query\r\n\r\n- [utils] Added IterStream class that give a stream like interface for any iterator\r\n\r\n- Added alembic and sqlalchemy-utils requirements\r\n\r\nVersion 0.1.1\r\n-------------\r\n\r\nReleased on April 30th 2015\r\n\r\n- Minor bugfixes\r\n\r\nVersion 0.1.0\r\n-------------\r\n\r\nReleased on April 21st 2015\r\n\r\nFirst public release of oar-lib", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/oar-team/python-oar-lib", "keywords": "oar-lib", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "oar-lib", "package_url": "https://pypi.org/project/oar-lib/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/oar-lib/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/oar-team/python-oar-lib" }, "release_url": "https://pypi.org/project/oar-lib/0.4.1/", "requires_dist": null, "requires_python": null, "summary": "Python OAR Library", "version": "0.4.1" }, "last_serial": 1746707, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "e45df8c97c913e0651396af60c4a67ba", "sha256": "d5170d53f5939af0856d63eb74df131a838c94c99d773f424d1f9deecba823c1" }, "downloads": -1, "filename": "oar-lib-0.1.0-1.tar.gz", "has_sig": false, "md5_digest": "e45df8c97c913e0651396af60c4a67ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12644, "upload_time": "2015-09-30T14:43:37", "url": "https://files.pythonhosted.org/packages/1e/77/75f96b0640ca9ca1b068d6dc06ed1e4ae21fe52ef4955f1f5f0ca950e1fc/oar-lib-0.1.0-1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "f792b2b45f8a60b1345f3dedb8b95223", "sha256": "4e1d14272ec186740a287a62112ac51325871a104b99732e5fd2cafcf89fd920" }, "downloads": -1, "filename": "oar-lib-0.1.1-1.tar.gz", "has_sig": false, "md5_digest": "f792b2b45f8a60b1345f3dedb8b95223", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12412, "upload_time": "2015-09-30T14:55:31", "url": "https://files.pythonhosted.org/packages/1d/fd/89eb7c3ccf31efbc8575bafa8a629e58c7e6518c35c7860cee5740f175b5/oar-lib-0.1.1-1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "20f643a77e499b140abc38e736d67f2c", "sha256": "46dea50ea68af6b38bdff778d4973b55d601f38b3c2fd9eff4df8e62f7b4faf4" }, "downloads": -1, "filename": "oar-lib-0.2.0-1.tar.gz", "has_sig": false, "md5_digest": "20f643a77e499b140abc38e736d67f2c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16033, "upload_time": "2015-09-30T14:57:54", "url": "https://files.pythonhosted.org/packages/c0/e9/4f5c88b4b77c02744715171f491b50b0aec08ec0a08e0ea9ee9a093f6f03/oar-lib-0.2.0-1.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "15aa4333c87954a29374a018bcde9ad5", "sha256": "accc06d23b509b51d07fc5770ffe4b3dfe658562ca4667bd5a62e8a3f3940bed" }, "downloads": -1, "filename": "oar-lib-0.3.0-1.tar.gz", "has_sig": false, "md5_digest": "15aa4333c87954a29374a018bcde9ad5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19241, "upload_time": "2015-09-30T15:00:39", "url": "https://files.pythonhosted.org/packages/67/25/a168197868dca023f38437cfe837f550c0805a81146cebc99189fc59c323/oar-lib-0.3.0-1.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "0f50ef0c57821f9174d8f28e3984435e", "sha256": "60156fe81c51cf7b57ee2c09dac1ff94c2a1f3a58e000f6fc75c925fbe86076b" }, "downloads": -1, "filename": "oar_lib-0.4.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0f50ef0c57821f9174d8f28e3984435e", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 29965, "upload_time": "2015-09-30T15:07:10", "url": "https://files.pythonhosted.org/packages/45/c1/5cb3acf5519b6075145d540ba411f1a2d230f2918b9cca945380e454e2a6/oar_lib-0.4.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c80ed46f631696b99c3d07b7009c09a2", "sha256": "285e930f09abb55d0984d4fdf93bde67d7615959e7fc1b15a8112973e578f2f6" }, "downloads": -1, "filename": "oar-lib-0.4.1.tar.gz", "has_sig": false, "md5_digest": "c80ed46f631696b99c3d07b7009c09a2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 38383, "upload_time": "2015-09-30T15:07:01", "url": "https://files.pythonhosted.org/packages/99/17/459398eae3446bee8053b01e9f27218bc734949ed0ab79d9f581a7422c15/oar-lib-0.4.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0f50ef0c57821f9174d8f28e3984435e", "sha256": "60156fe81c51cf7b57ee2c09dac1ff94c2a1f3a58e000f6fc75c925fbe86076b" }, "downloads": -1, "filename": "oar_lib-0.4.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0f50ef0c57821f9174d8f28e3984435e", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 29965, "upload_time": "2015-09-30T15:07:10", "url": "https://files.pythonhosted.org/packages/45/c1/5cb3acf5519b6075145d540ba411f1a2d230f2918b9cca945380e454e2a6/oar_lib-0.4.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c80ed46f631696b99c3d07b7009c09a2", "sha256": "285e930f09abb55d0984d4fdf93bde67d7615959e7fc1b15a8112973e578f2f6" }, "downloads": -1, "filename": "oar-lib-0.4.1.tar.gz", "has_sig": false, "md5_digest": "c80ed46f631696b99c3d07b7009c09a2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 38383, "upload_time": "2015-09-30T15:07:01", "url": "https://files.pythonhosted.org/packages/99/17/459398eae3446bee8053b01e9f27218bc734949ed0ab79d9f581a7422c15/oar-lib-0.4.1.tar.gz" } ] }