nflx-genie-client


Namenflx-genie-client JSON
Version 3.6.17 PyPI version JSON
download
home_pagehttp://netflix.github.io/genie/
SummaryGenie Python Client.
upload_time2023-07-31 20:22:35
maintainer
docs_urlNone
authorNetflix Inc.
requires_python
licenseApache 2.0
keywords genie hadoop cloud netflix client bigdata presto
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
===================
Genie Python Client
===================

This package provides a robust client for interacting with an existing Genie service. Included are modules for the
resource models (Application, Command, Cluster, Job, etc), exceptions and retry logic wrappers for API calls.

For more documentation on Genie and its available API's see the `Genie GitHub <http://netflix.github.io/genie/>`_ page.

Examples
--------

Configuration Service Example
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This example shows how to register a new application with a running Genie instance. Similar processes can be followed
for registering clusters and commands as well as relating all three to each other.

::

    import genie2.client.wrapper
    import genie2.model.Application

    # Create a Genie client which proxies API calls through wrapper which retries failures based on various return codes
    genie = genie2.client.wrapper.Genie2("http://localhost:7001/genie", genie2.client.wrapper.RetryPolicy(tries=8, none_on_404=True, no_retry_http_codes=range(400, 500)))

    # Create a new application instance and set required fields
    app = genie2.model.Application.Application()
    app.name = "exampleAppName"
    app.user = "exampleUser"
    app.version = "0.0.1"
    app.status = "ACTIVE"

    # Save the application to the service
    created_app = genie.createApplication(app)
    print created_app.id

    # Retrieve the application by ID
    got_app = genie.getApplication(created_app.id)
    print got_app.name

    # Delete the application by ID
    deleted_app = genie.deleteApplication(got_app.id)
    print deleted_app.id


Execution Service Example
~~~~~~~~~~~~~~~~~~~~~~~~~

This example shows how to execute a job on Genie. In this case it's running a `Presto <http://prestodb.io/>`_ query.
This assumes the Presto cluster has already been configured with Genie and the command registered.

::

    import genie2.client.wrapper
    import genie2.model.Job
    import genie2.model.ClusterCriteria

    # Create a Genie client which proxies API calls through wrapper which retries failures based on various return codes
    genie = genie2.client.wrapper.Genie2("http://localhost:7001/genie", genie2.client.wrapper.RetryPolicy(tries=8, none_on_404=True, no_retry_http_codes=range(400, 500)))

    # Create a job instance and fill in the required parameters
    job = genie2.model.Job.Job()
    job.name = "GeniePythonClientExampleJob"
    job.user = "tgianos"
    job.version = "0.0.1"

    # Create a list of cluster criterias which determine the cluster to run the job on
    cluster_criterias = list()
    cluster_criteria = genie2.model.ClusterCriteria.ClusterCriteria()
    criteria = set()
    criteria.add("presto")
    criteria.add("prod")
    cluster_criteria.tags = criteria
    cluster_criterias.append(cluster_criteria)
    job.clusterCriterias = cluster_criterias

    # Create the set of command criteria which will determine what command Genie executes for the job
    command_criteria = set()
    command_criteria.add("presto")
    job.commandCriteria = command_criteria

    # Any command line arguments to run along with the command. In this case it holds the actual query but this
    # could also be done via an attachment or file dependency.
    job.commandArgs = "--execute \"show tables;\""

    # Submit the job to Genie
    running_job = genie.submitJob(job)

    # Check on the status of the job
    job_status = genie.getJobStatus(running_job.id)
    print job_status



            

Raw data

            {
    "_id": null,
    "home_page": "http://netflix.github.io/genie/",
    "name": "nflx-genie-client",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "genie hadoop cloud netflix client bigdata presto",
    "author": "Netflix Inc.",
    "author_email": "genieoss@googlegroups.com",
    "download_url": "https://files.pythonhosted.org/packages/2f/f4/025f71ba6d9d1b21e2b159016c45727d9b56ebc7616b0b1e9b46cdd70058/nflx-genie-client-3.6.17.tar.gz",
    "platform": null,
    "description": "\n===================\nGenie Python Client\n===================\n\nThis package provides a robust client for interacting with an existing Genie service. Included are modules for the\nresource models (Application, Command, Cluster, Job, etc), exceptions and retry logic wrappers for API calls.\n\nFor more documentation on Genie and its available API's see the `Genie GitHub <http://netflix.github.io/genie/>`_ page.\n\nExamples\n--------\n\nConfiguration Service Example\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThis example shows how to register a new application with a running Genie instance. Similar processes can be followed\nfor registering clusters and commands as well as relating all three to each other.\n\n::\n\n    import genie2.client.wrapper\n    import genie2.model.Application\n\n    # Create a Genie client which proxies API calls through wrapper which retries failures based on various return codes\n    genie = genie2.client.wrapper.Genie2(\"http://localhost:7001/genie\", genie2.client.wrapper.RetryPolicy(tries=8, none_on_404=True, no_retry_http_codes=range(400, 500)))\n\n    # Create a new application instance and set required fields\n    app = genie2.model.Application.Application()\n    app.name = \"exampleAppName\"\n    app.user = \"exampleUser\"\n    app.version = \"0.0.1\"\n    app.status = \"ACTIVE\"\n\n    # Save the application to the service\n    created_app = genie.createApplication(app)\n    print created_app.id\n\n    # Retrieve the application by ID\n    got_app = genie.getApplication(created_app.id)\n    print got_app.name\n\n    # Delete the application by ID\n    deleted_app = genie.deleteApplication(got_app.id)\n    print deleted_app.id\n\n\nExecution Service Example\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThis example shows how to execute a job on Genie. In this case it's running a `Presto <http://prestodb.io/>`_ query.\nThis assumes the Presto cluster has already been configured with Genie and the command registered.\n\n::\n\n    import genie2.client.wrapper\n    import genie2.model.Job\n    import genie2.model.ClusterCriteria\n\n    # Create a Genie client which proxies API calls through wrapper which retries failures based on various return codes\n    genie = genie2.client.wrapper.Genie2(\"http://localhost:7001/genie\", genie2.client.wrapper.RetryPolicy(tries=8, none_on_404=True, no_retry_http_codes=range(400, 500)))\n\n    # Create a job instance and fill in the required parameters\n    job = genie2.model.Job.Job()\n    job.name = \"GeniePythonClientExampleJob\"\n    job.user = \"tgianos\"\n    job.version = \"0.0.1\"\n\n    # Create a list of cluster criterias which determine the cluster to run the job on\n    cluster_criterias = list()\n    cluster_criteria = genie2.model.ClusterCriteria.ClusterCriteria()\n    criteria = set()\n    criteria.add(\"presto\")\n    criteria.add(\"prod\")\n    cluster_criteria.tags = criteria\n    cluster_criterias.append(cluster_criteria)\n    job.clusterCriterias = cluster_criterias\n\n    # Create the set of command criteria which will determine what command Genie executes for the job\n    command_criteria = set()\n    command_criteria.add(\"presto\")\n    job.commandCriteria = command_criteria\n\n    # Any command line arguments to run along with the command. In this case it holds the actual query but this\n    # could also be done via an attachment or file dependency.\n    job.commandArgs = \"--execute \\\"show tables;\\\"\"\n\n    # Submit the job to Genie\n    running_job = genie.submitJob(job)\n\n    # Check on the status of the job\n    job_status = genie.getJobStatus(running_job.id)\n    print job_status\n\n\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "Genie Python Client.",
    "version": "3.6.17",
    "project_urls": {
        "Homepage": "http://netflix.github.io/genie/"
    },
    "split_keywords": [
        "genie",
        "hadoop",
        "cloud",
        "netflix",
        "client",
        "bigdata",
        "presto"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ffbd659c5bde40ca1c89b0fb8d6fe3b0f81f70e3831e7263112b39b6342c8675",
                "md5": "087f3c84b7c89b136235f70c63c844b1",
                "sha256": "ed3e3bb63439b15170dba6b121a726e4d1fb27a00c6d98f6895f90ca351550ca"
            },
            "downloads": -1,
            "filename": "nflx_genie_client-3.6.17-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "087f3c84b7c89b136235f70c63c844b1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 56381,
            "upload_time": "2023-07-31T20:22:33",
            "upload_time_iso_8601": "2023-07-31T20:22:33.549569Z",
            "url": "https://files.pythonhosted.org/packages/ff/bd/659c5bde40ca1c89b0fb8d6fe3b0f81f70e3831e7263112b39b6342c8675/nflx_genie_client-3.6.17-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2ff4025f71ba6d9d1b21e2b159016c45727d9b56ebc7616b0b1e9b46cdd70058",
                "md5": "c6172cec5a17ed318acc4135a2642a0c",
                "sha256": "a7f3815e9eb6a8b4884bc1f50243395134e65e9af5df7efea79b257f8aad4180"
            },
            "downloads": -1,
            "filename": "nflx-genie-client-3.6.17.tar.gz",
            "has_sig": false,
            "md5_digest": "c6172cec5a17ed318acc4135a2642a0c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 53277,
            "upload_time": "2023-07-31T20:22:35",
            "upload_time_iso_8601": "2023-07-31T20:22:35.746688Z",
            "url": "https://files.pythonhosted.org/packages/2f/f4/025f71ba6d9d1b21e2b159016c45727d9b56ebc7616b0b1e9b46cdd70058/nflx-genie-client-3.6.17.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-31 20:22:35",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "nflx-genie-client"
}
        
Elapsed time: 0.10973s