GithubHelp home page GithubHelp logo

isabella232 / interface-zeppelin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from juju-solutions/interface-zeppelin

0.0 0.0 0.0 11 KB

Interface layer for interacting with charms for Apache Zeppelin

License: Other

Python 100.00%

interface-zeppelin's Introduction

Overview

This interface layer handles the communication between the Apache Zeppelin charm and other charms wishing to register a notebook with Zeppelin.

Usage

Charms Registering a Notebook

Charms that wish to register a notebook with Zeppelin should require this interface. The interface layer will set the following state when appropriate:

  • {relation_name}.joined indicates that Apache Zeppelin is present, and thus a notebook can be registered with the register_notebook method.

  • {relation_name}.notebook.accepted indicates that Apache Zeppelin has accepted one or more of the requested notebooks. You can get a list of the accepted notebook filenames with the accepted_notebooks method.

  • {relation_name}.notebook.rejected indicates that Apache Zeppelin has rejected one or more of the requested notebooks. You can get a list of the rejected notebook filenames with the rejected_notebooks method.

The register_notebook method can be passed either a filename or a contents string.

An example of how a charm would use this interface would be:

@when('zeppelin.joined')
def register_notebook(zeppelin):
    zeppelin.register_notebook(filename='files/notebook.json')


@when('zeppelin.notebook.rejected')
def report_rejected_notebook(zeppelin):
    status_set('blocked', 'Zeppelin rejected our notebook')

Zeppelin

The Zeppelin charm should provide this interface. The interface layer will set the following states when appropriate:

  • {relation_name}.notebook.registered indicates that a client has registered a notebook. The charm would then iterate over the unregistered_notebooks, handle them, and use either accept_notebook or reject_notebook methods to acknowledge them.

  • {relation_name}.notebook.removed indicates that a client has disconnected and so its notebooks should be removed. The charm would then use the unremoved_notebooks method to iterate over the notebooks to be removed and call remove_notebook to acknowledge them.

An example of how the Zeppelin charm would use this interface would be:

@when('zeppelin.installed', 'client.notebook.registered')
def register_notebook(client):
    api = ZeppelinAPI()
    for notebook in client.unregistered_notebooks():
        if api.import_notebook(notebook):
            client.accept_notebook(notebook)
        else:
            client.reject_notebook(notebook)


@when('zeppelin.installed', 'client.notebook.removed')
def remove_notebook(client):
    api = ZeppelinAPI()
    for notebook in client.unremoved_notebooks():
        notebook_id = json.loads(notebook)['id']
        api.delete_notebook(notebook_id)
        client.remove_notebook(notebook)

Contact Information

interface-zeppelin's People

Contributors

johnsca avatar kwmonroe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.