code: public static UserGroupInformation getUGI(Configuration conf)
    throws LoginException {
      UserGroupInformation ugi = null;
      if (conf.getBoolean(UGI_SOURCE, true)) {
        // get the ugi from configuration
       ugi = UnixUserGroupInformation.readFromConf(conf,
          UnixUserGroupInformation.UGI_PROPERTY_NAME);
      } else {
        // get the ugi from Subject
        ugi = UserGroupInformation.getCurrentUGI();
      }
      // get the ugi from unix
      if (ugi == null) {
        ugi = UnixUserGroupInformation.login();
        UnixUserGroupInformation.saveToConf(conf, 
            UnixUserGroupInformation.UGI_PROPERTY_NAME,
            (UnixUserGroupInformation)ugi);
      }
      return ugi;
    }
docs: get the current user id