{ "info": { "author": "Xplenty", "author_email": "opensource@xplenty.com", "bugtrack_url": null, "classifiers": [], "description": "## Xplenty Python 3 Wrapper\n\nUpdated the Python 2 [xplenty.py](https://github.com/xplenty/xplenty.py) using\n[`2to3`](https://docs.python.org/2/library/2to3.html)\n\nThe Xplenty PY is a python artifact that provides a simple wrapper for the [Xplenty REST API](https://github.com/xplenty/xplenty-api-doc). To use it, create an XplentyClient object and call its methods to access the Xplenty API. This page describes the available XplentyClient methods.\n\n### Installation\n\nVia pip:\n```bash\npip install xplenty\n```\n\n### Create an Xplenty Client Object\nPass your account ID and API key to the XplentyClient constructor.\n```python\nfrom xplenty import XplentyClient\naccount_id =\"MyAccountID\"\napi_key = \"V4eyfgNqYcSasXGhzNxS\"\nclient = XplentyClient(account_id,api_key)\n```\n### Create a Cluster\n\nThis method creates a new cluster. A cluster is a group of machines (\"nodes\") allocated to your account. The number of nodes in the cluster is determined by the \"nodes\" value that you supply to the call. While the cluster is active, only your account's users can run jobs on the cluster.\nYou will need to provide an active cluster when starting a new job. Save the cluster ID value returned in the response \"id\" field. You will use the value to refer to this cluster in subsequent API calls.\n```python\ncluster_type = \"production\"\nnodes = 2\nname =\"New Cluster #199999\"\ndescription =\"New Cluster's Description\"\nterminate_on_idle = False\ntime_to_idle = 3600\ncluster = client.create_cluster(cluster_type, nodes, name, description, terminate_on_idle, time_to_idle)\nprint cluster.id\n```\n### List All Clusters\n\nThis method returns the list of clusters that were created by users in your account.\nYou can use this information to monitor and display your clusters and their statuses.\n```python\nclusters = client.clusters\nprint \"Number of clusters:\",len(clusters)\nfor cluster in clusters:\n print cluster.id, cluster.name, cluster.created_at\n```\n### Get Cluster Information\n\nThis method returns the details of the cluster with the given ID.\n```python\nid = 85\ncluster = client.get_cluster(id)\nprint cluster.name\n```\n### Terminate a Cluster\n\nThis method deactivates the given cluster, releasing its resources and terminating its runtime period. Use this method when all of the cluster's jobs are completed and it's no longer needed. The method returns the given cluster's details, including a status of \"pending_terminate\".\n```python\nid = 85\ncluster = client.terminate_cluster(id)\nprint cluster.status\n```\n### Run a Job\n\nThis method creates a new job and triggers it to run. The job performs the series of data processing tasks that are defined in the job's package. Unless the job encounters an error or is terminated by the user, it will run until it completes its tasks on all of the input data. Save the job ID value returned in the response \"id\" field. You will use the value to refer to this job in subsequent API calls.\n```python\ncluster_id = 83\npackage_id = 782\nvariables = {}\nvariables['OUTPUTPATH']=\"test/job_vars.csv\"\nvariables['Date']=\"09-10-2012\"\n\njob = client.add_job(cluster_id, package_id, variables)\n\nprint job.id\n```\n### List All Jobs\n\nThis method returns information for all the jobs that have been created under your account.\n```python\njobs = client.jobs\n\nfor job in jobs:\n print job.id , job.progress , job.status\n```\n### Get Job Information\n\nThis method retrieves information for a job, according to the given job ID.\n```python\njob_id = 235\njob = client.get_job(job_id)\nprint job.status\n```\n### Terminate a Job\n\nThis method terminates an active job. Usually it's unnecessary to request to terminate a job, because normally the job will end when its tasks are completed. You may want to actively terminate a job if you need its cluster resources for a more urgent job, or if the job is taking too long to complete.\n```python\njob_id = 235\njob = client.stop_job(job_id)\nprint job.status\n```\n\n### List All Packages\n\nThis method returns the list of packages that were created by users in your account.\nYou can use this information to display your packages and their properties.\n```python\npackages = client.packages\nprint \"Number of packages:\",len(packages)\nfor package in packages:\n print package.id, package.name, package.created_at\n```\n### Get Package Information\n\nThis method returns the details of the package with the given ID.\n```python\nid = 85\npackage = client.get_package(id)\nprint package.name\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## License\nReleased under the [MIT license](http://www.opensource.org/licenses/mit-license.php).\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/apartmentlist/xplenty3.py", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "xplenty3", "package_url": "https://pypi.org/project/xplenty3/", "platform": "", "project_url": "https://pypi.org/project/xplenty3/", "project_urls": { "Homepage": "https://github.com/apartmentlist/xplenty3.py" }, "release_url": "https://pypi.org/project/xplenty3/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "Xplenty API Python SDK", "version": "0.1.1" }, "last_serial": 3213821, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "4bb367fcd0c7273325ac01f148e2cd1f", "sha256": "0b1da8a27f5167bf01f56927f38d3a992da0a2e8f8679fef3581da76390dc22e" }, "downloads": -1, "filename": "xplenty3-0.1.0.tar.gz", "has_sig": false, "md5_digest": "4bb367fcd0c7273325ac01f148e2cd1f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7900, "upload_time": "2017-09-29T20:09:59", "url": "https://files.pythonhosted.org/packages/b3/f7/3616735dd5f29a2e982dc9f0b7a99f3428b02240ee236a210d1e2ac61947/xplenty3-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "21d1bb2b575ad6ee559bcb1228e35c86", "sha256": "34150a5466ac73958118c25881ef8c397bc4f7b6b84919c591b290e166086af2" }, "downloads": -1, "filename": "xplenty3-0.1.1.tar.gz", "has_sig": false, "md5_digest": "21d1bb2b575ad6ee559bcb1228e35c86", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7907, "upload_time": "2017-09-29T21:07:32", "url": "https://files.pythonhosted.org/packages/37/15/7b5ccdec09fd01b1ea89697757582ada275b2240647933b6fbe7841d4cad/xplenty3-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "21d1bb2b575ad6ee559bcb1228e35c86", "sha256": "34150a5466ac73958118c25881ef8c397bc4f7b6b84919c591b290e166086af2" }, "downloads": -1, "filename": "xplenty3-0.1.1.tar.gz", "has_sig": false, "md5_digest": "21d1bb2b575ad6ee559bcb1228e35c86", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7907, "upload_time": "2017-09-29T21:07:32", "url": "https://files.pythonhosted.org/packages/37/15/7b5ccdec09fd01b1ea89697757582ada275b2240647933b6fbe7841d4cad/xplenty3-0.1.1.tar.gz" } ] }