Ejemplo n.º 1
0
def install_pig():
    pig = Pig(get_dist_config())
    if pig.verify_resources():
        hookenv.status_set('maintenance', 'installing pig')
        hookenv.log('Installing Apache Pig')
        pig.install()
        pig.initial_config()
        set_state('pig.installed')
        hookenv.status_set('waiting', 'waiting to configure pig')
        hookenv.log('Apache Pig is installed and ready to be configured')
Ejemplo n.º 2
0
def configure_pig():
    pig = Pig(get_dist_config())
    hadoop_ready = is_state('hadoop.ready')
    if hadoop_ready:
        hookenv.status_set('maintenance', 'configuring pig (mapreduce)')
        hookenv.log('YARN is ready, configuring Apache Pig in MapReduce mode')
        pig.configure_yarn()
        remove_state('pig.configured.local')
        set_state('pig.configured.yarn')
        hookenv.status_set('active', 'ready (mapreduce)')
        hookenv.log('Apache Pig is ready in MapReduce mode')
    else:
        hookenv.status_set('maintenance', 'configuring pig (local)')
        hookenv.log('YARN is not ready, configuring Pig in local mode')
        pig.configure_local()
        remove_state('pig.configured.yarn')
        set_state('pig.configured.local')
        hookenv.status_set('active', 'ready (local)')
        hookenv.log('Apache Pig is ready in local mode')