Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Genie Python Client.

Project description

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 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 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

Project details


Release history Release notifications

This version
History Node

3.5.7

History Node

3.5.6

History Node

3.5.5

History Node

3.5.4

History Node

3.5.3

History Node

3.5.2

History Node

3.5.1

History Node

3.5.0

History Node

3.4.11

History Node

3.4.10

History Node

3.4.9

History Node

3.4.8

History Node

3.4.7

History Node

3.4.6

History Node

3.4.5

History Node

3.4.4

History Node

3.4.3

History Node

3.4.2

History Node

3.4.1

History Node

3.4.0

History Node

3.3.3

History Node

3.3.2

History Node

3.3.1

History Node

3.2.3

History Node

3.2.2

History Node

3.2.1

History Node

3.2.0

History Node

3.1.0

History Node

3.0.48

History Node

3.0.47

History Node

3.0.46

History Node

3.0.45

History Node

3.0.44

History Node

3.0.43

History Node

3.0.42

History Node

3.0.41

History Node

3.0.40

History Node

3.0.39

History Node

3.0.38

History Node

3.0.37

History Node

3.0.36

History Node

3.0.35

History Node

3.0.34

History Node

3.0.33

History Node

3.0.32

History Node

3.0.31

History Node

3.0.30

History Node

3.0.29

History Node

3.0.28

History Node

3.0.27

History Node

3.0.26

History Node

3.0.25

History Node

3.0.24

History Node

3.0.23

History Node

3.0.22

History Node

3.0.21

History Node

3.0.20

History Node

3.0.19

History Node

3.0.18

History Node

3.0.17

History Node

3.0.16

History Node

3.0.15

History Node

3.0.14

History Node

3.0.13

History Node

3.0.12

History Node

3.0.11

History Node

3.0.10

History Node

3.0.9

History Node

3.0.8

History Node

3.0.7

History Node

3.0.6

History Node

3.0.5

History Node

3.0.4

History Node

3.0.3

History Node

3.0.2

History Node

3.0.1

History Node

3.0.0

History Node

2.2.0

History Node

2.1.2

History Node

2.1.1

History Node

2.1.0

History Node

2.0.0

History Node

2.0.0rc4

History Node

2.0.0rc3

History Node

2.0.0rc2

History Node

2.0.0rc1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
nflx-genie-client-3.5.7.tar.gz (45.3 kB) Copy SHA256 hash SHA256 Source None May 31, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page