/** * Get the home path of the current user. * <p> * In an insecure cluster, the environment variable * <code>HADOOP_USER_NAME</code> is queried <i>first</i>. * <p> * This means that in a YARN container where the creator set this * environment variable to propagate their identity, the defined * user name is used in preference to the actual user. * <p> * In a secure cluster, the kerberos identity of the current user is used. * @return a path for the current user's home dir. * @throws RuntimeException if the current user identity cannot be determined * from the OS/kerberos. */ public static String homePathForCurrentUser() { String shortUserName = currentUsernameUnencoded(); return homePathForUser(shortUserName); }
/** * Get the home path of the current user. * <p> * In an insecure cluster, the environment variable * <code>HADOOP_USER_NAME</code> is queried <i>first</i>. * <p> * This means that in a YARN container where the creator set this * environment variable to propagate their identity, the defined * user name is used in preference to the actual user. * <p> * In a secure cluster, the kerberos identity of the current user is used. * @return a path for the current user's home dir. * @throws RuntimeException if the current user identity cannot be determined * from the OS/kerberos. */ public static String homePathForCurrentUser() { String shortUserName = currentUsernameUnencoded(); return homePathForUser(shortUserName); }
/** * Get the current user path formatted for the registry * <p> * In an insecure cluster, the environment variable * <code>HADOOP_USER_NAME </code> is queried <i>first</i>. * <p> * This means that in a YARN container where the creator set this * environment variable to propagate their identity, the defined * user name is used in preference to the actual user. * <p> * In a secure cluster, the kerberos identity of the current user is used. * @return the encoded shortname of the current user * @throws RuntimeException if the current user identity cannot be determined * from the OS/kerberos. * */ public static String currentUser() { String shortUserName = currentUsernameUnencoded(); return registryUser(shortUserName); }
/** * Get the current user path formatted for the registry * <p> * In an insecure cluster, the environment variable * <code>HADOOP_USER_NAME </code> is queried <i>first</i>. * <p> * This means that in a YARN container where the creator set this * environment variable to propagate their identity, the defined * user name is used in preference to the actual user. * <p> * In a secure cluster, the kerberos identity of the current user is used. * @return the encoded shortname of the current user * @throws RuntimeException if the current user identity cannot be determined * from the OS/kerberos. * */ public static String currentUser() { String shortUserName = currentUsernameUnencoded(); return encodeForRegistry(shortUserName); }