Code Monkey home page Code Monkey logo

aop2yarnclient's Introduction

Aop2YarnClient

Description

Sometimes, we might execute a yarn job in a SHELL script using 'yarn jar myYarnJob.jar mainClass [args]'. If we want to get the submitted application id in the SHELL script, we have to parse the logs by regex 'application_\d+_\d+'.

However, it's a little ugly and has performance issues. The Aop2YarnClient give a better solution to achieve it, which registers an aspect when executing 'yarn jar' command, and weaves a join point to org.apache.hadoop.yarn.client.api.impl.YarnClientImpl.submitApplication, where we can get the submitted application id & tracking URL, then output them into a local file.

Usage

yarn jar

export YARN_CLIENT_OPTS="-javaagent:~/aspectjweaver-1.9.6.jar"

export YARN_USER_CLASSPATH=~/Aop2YarnClient-1.0-SNAPSHOT.jar

export YARN_CLIENT_ASPECTJ_FILE_PATH=~/appInfo.txt

export PARA_NAME_ASPECTJ_DEBUG=true

yarn jar /apache/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.1.2.4.2.66-4.jar pi 1 100000

you will find the application id and tracking url in the ~/appInfo.txt file

hive -e

export HADOOP_CLIENT_OPTS="-javaagent:~/aspectjweaver-1.9.6.jar"

export HIVE_AUX_JARS_PATH=~/Aop2YarnClient-1.0-SNAPSHOT.jar

export YARN_CLIENT_ASPECTJ_FILE_PATH=~/appInfo.txt

export PARA_NAME_ASPECTJ_DEBUG=true

hive -e "select count(1) from tableName"

you will also find the application id and tracking url in the ~/appInfo.txt file

others

you can use Aop2YarnClient in any tools and system, which submits a yarn job. What you should to do is to adding the "-javaagent:~/aspectjweaver-1.9.6.jar" option to java, and adding Aop2YarnClient-1.0-SNAPSHOT.jar to CLASSPATH. YARN_CLIENT_ASPECTJ_FILE_PATH env indicates the file location storing the application id and tracking url

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.