Giter VIP home page Giter VIP logo

interface-flume-agent's Introduction

Overview

This interface layer handles the communication between the Flume HDFS service and the Flume agents (eg, syslog, tweeter). The provider end of the relation provides the sink service where mesages are persisted. The other end requires the existence of the provider to function.

Usage

Provides

Charms providing the sink service can make use of the provides interface.

This interface layer will set the following states, as appropriate:

  • {relation_name}.connected The relation to a Flume agent has been established, though the service list may not be available yet. At this point the provider should broadcast the connection properties using:

    • send_configuration(self, port, protocol = 'avro')
  • {relation_name}.available The connection to the agent is now available and correctly setup.

Flume-HDFS is a charm that persists data from various agents. As soon a an agent get connected the charm provides the connection details (port):

@when('hadoop.ready', 'flume-agent.connected')
@when_not('flume-agent.available')
def waiting_availuable_flume(hadoop, flume_agent):
    flume_agent.send_configuration(hookenv.config()['source_port'])
    hookenv.status_set('waiting', 'Waiting for a Flume agent to become available')

When the agent becomes available, the Flume sink service is started.

@when('flumehdfs.installed', 'hadoop.ready', 'flume-agent.available')
@when_not('flumehdfs.started')
def configure_flume(hdfs, flume_agent_rel):
    hookenv.status_set('maintenance', 'Setting up Flume')
    flume = Flume(get_dist_config())
    flume.configure_flume()
    flume.restart()
    set_state('flumehdfs.started')
    hookenv.status_set('active', 'Ready')

Requires

A Flume agent charm acting as a source of information requires a Flume sink. The Flume agent makes use of the requires part of the interface to connect to the Flume sink.

This interface layer will set the following states, as appropriate:

  • {relation_name}.connected The charm has connected to the Flume sink. At this point the requires interface waits for connection details (port, ip, protocol).

  • {relation_name}.available The connection has been established, and the agent charm can get the connection details via the following calls:

    • get_flume_ip()
    • get_flume_port()
    • get_flume_protocol()

Example:

@when('flumesyslog.installed', 'flume-agent.connected')
@when_not('flume-agent.available')
def waiting_for_flume_available(flume):
    hookenv.status_set('waiting', 'Waiting for availability of Flume HDFS')


@when('flumesyslog.installed', 'flume-agent.available')
@when_not('flumesyslog.started')
def configure_flume(flumehdfs):
    port = flumehdfs.get_flume_port()
    ip = flumehdfs.get_flume_ip()
    protocol = flumehdfs.get_flume_protocol()

Contact Information

interface-flume-agent's People

Contributors

ktsakalozos avatar johnsca avatar kwmonroe avatar

Watchers

James Cloos avatar  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.