public class TempletonUtils extends Object
Modifier and Type | Field and Description |
---|---|
static Pattern |
HIVE_COMPLETE |
static Pattern[] |
ID_PATTERNS |
static Pattern |
JAR_COMPLETE |
static Pattern |
JAR_ID |
static Pattern |
PIG_COMPLETE |
static Pattern |
PIG_ID |
static Pattern |
TEZ_COMPLETE
Hive on Tez produces progress report that looks like this
Map 1: -/- Reducer 2: 0/1
Map 1: -/- Reducer 2: 0(+1)/1
Map 1: -/- Reducer 2: 1/1
-/- means there are no tasks (yet)
0/1 means 1 total tasks, 0 completed
1(+2)/3 means 3 total, 1 completed and 2 running
HIVE-8495, in particular https://issues.apache.org/jira/secure/attachment/12675504/Screen%20Shot%202014-10-16%20at%209.35.26%20PM.png
has more examples.
|
static Pattern |
TEZ_COUNTERS |
Constructor and Description |
---|
TempletonUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addCmdForWindows(ArrayList<String> args) |
static String |
addUserHomeDirectoryIfApplicable(String origPathStr,
String user) |
static String[] |
decodeArray(String s)
Take an encode strings and decode it into an array of strings.
|
static StringBuilder |
dumpPropMap(String header,
Map<String,String> map) |
static StringBuilder |
dumpPropMap(String header,
Properties props) |
static String |
encodeArray(List<String> list)
Encode a List into a string.
|
static String |
encodeArray(String[] plain)
Take an array of strings and encode it into one string.
|
static String |
extractChildJobId(String line)
Extract the job id from jar jobs.
|
static String |
extractPercentComplete(String line)
Extract the percent complete line from Pig or Jar jobs.
|
static int |
fetchUrl(URL url)
GET the given url.
|
static String |
findContainingJar(Class<?> clazz,
String fileNamePattern)
Find a jar that contains a class of the same name and which
file name matches the given pattern.
|
static String |
hadoopFsFilename(String fname,
org.apache.hadoop.conf.Configuration conf,
String user) |
static boolean |
hadoopFsIsMissing(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path p) |
static String[] |
hadoopFsListAsArray(String files,
org.apache.hadoop.conf.Configuration conf,
String user) |
static String |
hadoopFsListAsString(String files,
org.apache.hadoop.conf.Configuration conf,
String user) |
static List<org.apache.hadoop.fs.Path> |
hadoopFsListChildren(String dirName,
org.apache.hadoop.conf.Configuration conf,
String user)
Returns all files (non-recursive) in
dirName |
static org.apache.hadoop.fs.Path |
hadoopFsPath(String fname,
org.apache.hadoop.conf.Configuration conf,
String user) |
static Map<String,String> |
hadoopUserEnv(String user,
String overrideClasspath)
Set the environment variables to specify the hadoop user.
|
static boolean |
isset(char ch)
Is the object non-empty?
|
static <T> boolean |
isset(Collection<T> col)
Is the object non-empty?
|
static <K,V> boolean |
isset(Map<K,V> col)
Is the object non-empty?
|
static boolean |
isset(String s)
Is the object non-empty?
|
static <T> boolean |
isset(T[] a)
Is the object non-empty?
|
static String |
quoteForWindows(String param) |
static String |
unEscapeString(String s)
replaces all occurrences of "\," with ","; returns
s if no modifications needed |
public static final Pattern JAR_COMPLETE
public static final Pattern PIG_COMPLETE
public static final Pattern HIVE_COMPLETE
public static final Pattern TEZ_COMPLETE
public static final Pattern TEZ_COUNTERS
public static final Pattern JAR_ID
public static final Pattern PIG_ID
public static final Pattern[] ID_PATTERNS
public static boolean isset(String s)
public static boolean isset(char ch)
public static <T> boolean isset(T[] a)
public static <T> boolean isset(Collection<T> col)
public static <K,V> boolean isset(Map<K,V> col)
public static String extractPercentComplete(String line)
public static String extractChildJobId(String line)
public static String encodeArray(String[] plain)
public static String[] decodeArray(String s)
public static String[] hadoopFsListAsArray(String files, org.apache.hadoop.conf.Configuration conf, String user) throws URISyntaxException, FileNotFoundException, IOException, InterruptedException
public static String hadoopFsListAsString(String files, org.apache.hadoop.conf.Configuration conf, String user) throws URISyntaxException, FileNotFoundException, IOException, InterruptedException
public static String hadoopFsFilename(String fname, org.apache.hadoop.conf.Configuration conf, String user) throws URISyntaxException, FileNotFoundException, IOException, InterruptedException
public static List<org.apache.hadoop.fs.Path> hadoopFsListChildren(String dirName, org.apache.hadoop.conf.Configuration conf, String user) throws URISyntaxException, IOException, InterruptedException
dirName
public static boolean hadoopFsIsMissing(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path p)
public static String addUserHomeDirectoryIfApplicable(String origPathStr, String user) throws IOException, URISyntaxException
IOException
URISyntaxException
public static org.apache.hadoop.fs.Path hadoopFsPath(String fname, org.apache.hadoop.conf.Configuration conf, String user) throws URISyntaxException, IOException, InterruptedException
public static int fetchUrl(URL url) throws IOException
IOException
public static Map<String,String> hadoopUserEnv(String user, String overrideClasspath)
public static String unEscapeString(String s)
s
if no modifications neededpublic static String findContainingJar(Class<?> clazz, String fileNamePattern)
clazz
- the class to find.fileNamePattern
- regex pattern that must match the jar full pathpublic static StringBuilder dumpPropMap(String header, Properties props)
public static StringBuilder dumpPropMap(String header, Map<String,String> map)
Copyright © 2017 The Apache Software Foundation. All rights reserved.