{ "info": { "author": "clintval", "author_email": "valentine.clint@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# pendant\n\n[![Testing Status](https://travis-ci.org/clintval/pendant.svg?branch=master)](https://travis-ci.org/clintval/pendant)\n[![codecov](https://codecov.io/gh/clintval/pendant/branch/master/graph/badge.svg)](https://codecov.io/gh/clintval/pendant)\n[![Documentation Build Status](https://readthedocs.org/projects/pendant/badge/?version=latest)](https://pendant.readthedocs.io/en/latest/?badge=latest)\n[![PyPi Release](https://badge.fury.io/py/pendant.svg)](https://badge.fury.io/py/pendant)\n[![Python Versions](https://img.shields.io/pypi/pyversions/pendant.svg)](https://pypi.python.org/pypi/pendant/)\n[![MyPy Checked](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n\nPython 3.6+ library for submitting to AWS Batch interactively.\n\n```bash\n\u276f pip install pendant\n```\n\nFeatures:\n\n- Submit Batch jobs\n\nRead the documentation at: [pendant.readthedocs.io](https://pendant.readthedocs.io/en/latest/)\n\n\n## End-to-end Example\n\nThe principle object for deploying jobs to AWS Batch is the Batch job definition.\nEvery Batch job definition has a name, parameters, and some form of optional parameter validation.\n\n```python\n>>> from pendant.aws.batch import BatchJob, JobDefinition\n>>> from pendant.aws.s3 import S3Uri\n>>> from pendant.aws.exception import S3ObjectNotFoundError\n\n>>> class DemoJobDefinition(JobDefinition):\n... def __init__(self, input_object: S3Uri) -> None:\n... self.input_object = input_object\n... \n... @property\n... def name(self) -> str:\n... return 'demo-job'\n... \n... def validate(self) -> None:\n... if not self.input_object.object_exists():\n... raise S3ObjectNotFoundError(f'S3 object does not exist: {self.input_object}')\n```\n\nLet's instantiate the definition at a specific revision and validate it.\n\n```python\n>>> definition = DemoJobDefinition(input_object=S3Uri('s3://bucket/object')).at_revision('6')\n>>> definition.validate()\nNone\n```\n\nValidation is also performed when a job definition is wrapped by a `BatchJob` so the call to `.validate()` above was redundant.\nWrapping a job definition into a Batch job is achieved with the following, but no useful work will happen until the job is submitted.\n\n```python\n>>> job = BatchJob(definition)\n```\n\nNow we are ready to submit this job to AWS Batch!\nSubmitting this Batch job is easy, and introspection can be performed immediately:\n\n```python\n>>> response = job.submit(queue='prod')\n>>> job.is_submitted()\nTrue\n```\n\nWhen the job is in a `RUNNING` state we can access the job's Cloudwatch logs.\nThe log events are returned as objects which have useful properties such as `timestamp` and `message`.\n\n```python\n>>> for log_event in job.log_stream_events():\n... print(log_event)\nLogEvent(timestamp=\"1543809952329\", message=\"You have started up this demo job\", ingestion_time=\"1543809957080\")\nLogEvent(timestamp=\"1543809955437\", message=\"Configuration, we are loading from...\", ingestion_time=\"1543809957080\")\nLogEvent(timestamp=\"1543809955437\", message=\"Defaulting to approximate values\", ingestion_time=\"1543809957080\")\nLogEvent(timestamp=\"1543809955437\", message=\"Setting up logger, nothing to see here\", ingestion_time=\"1543809957080\")\n```\n\nAnd if we must, we can cancel the job as long as we provide a reason:\n\n```python\n>>> response = job.terminate(reason='I was just testing!')\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/clintval/pendant/archive/v0.4.1.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/clintval/pendant", "keywords": "AWS Batch job submission", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pendant", "package_url": "https://pypi.org/project/pendant/", "platform": "", "project_url": "https://pypi.org/project/pendant/", "project_urls": { "Documentation": "https://pendant.readthedocs.io", "Download": "https://github.com/clintval/pendant/archive/v0.4.1.tar.gz", "Homepage": "https://github.com/clintval/pendant", "Issue-Tracker": "https://github.com/clintval/pendant/issues" }, "release_url": "https://pypi.org/project/pendant/0.4.1/", "requires_dist": null, "requires_python": "", "summary": "Python 3.6+ library for submitting to AWS Batch interactively.", "version": "0.4.1" }, "last_serial": 4582241, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "ab984e055e04f6766f4d1a9c1e6b281d", "sha256": "2dc9870a8aa241944ce685f55f18062405b51112ea71e5ff8770090e6ffbe3c0" }, "downloads": -1, "filename": "pendant-0.2.0.tar.gz", "has_sig": false, "md5_digest": "ab984e055e04f6766f4d1a9c1e6b281d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5762, "upload_time": "2018-12-03T18:50:21", "url": "https://files.pythonhosted.org/packages/c8/aa/42b1fdca40f2fb6c580337729aeed4d45448f101d82802f728b303466a7e/pendant-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "5486f8946e80fc81d6057bf115e3df28", "sha256": "91a200b0a0cc855f6e92a34c1a21b0994baddb0e98b71fdaf6f27de3ef4de90a" }, "downloads": -1, "filename": "pendant-0.3.0.tar.gz", "has_sig": false, "md5_digest": "5486f8946e80fc81d6057bf115e3df28", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11274, "upload_time": "2018-12-03T21:38:29", "url": "https://files.pythonhosted.org/packages/9e/9a/de287a24ee32422fda8d4443e11a584243510edaab0a1ee59acaf2977af4/pendant-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "e545d2a2a4804e7b22f648726a6c6c2c", "sha256": "10146699b8c517ade2614aa32355c6d1ab7ba613011ff32d6a43ac4f251c7741" }, "downloads": -1, "filename": "pendant-0.4.0.tar.gz", "has_sig": false, "md5_digest": "e545d2a2a4804e7b22f648726a6c6c2c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11028, "upload_time": "2018-12-04T04:13:01", "url": "https://files.pythonhosted.org/packages/69/c5/f9a7cea422750325e89e0b576da1572f9a99792daae87d874e5c9906413b/pendant-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "0e645b6619844f334c4737685b04b6e8", "sha256": "b24dd3465afd26356b20872cce98b9215a4d42725f8010cdde7f74030b0d5727" }, "downloads": -1, "filename": "pendant-0.4.1.tar.gz", "has_sig": false, "md5_digest": "0e645b6619844f334c4737685b04b6e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11176, "upload_time": "2018-12-10T19:32:40", "url": "https://files.pythonhosted.org/packages/fa/6e/669b012462a5e03e3e29c79b9a7477cb4be830457e3dd942a4210374e89a/pendant-0.4.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0e645b6619844f334c4737685b04b6e8", "sha256": "b24dd3465afd26356b20872cce98b9215a4d42725f8010cdde7f74030b0d5727" }, "downloads": -1, "filename": "pendant-0.4.1.tar.gz", "has_sig": false, "md5_digest": "0e645b6619844f334c4737685b04b6e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11176, "upload_time": "2018-12-10T19:32:40", "url": "https://files.pythonhosted.org/packages/fa/6e/669b012462a5e03e3e29c79b9a7477cb4be830457e3dd942a4210374e89a/pendant-0.4.1.tar.gz" } ] }