http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigscript/PigScriptMigrationImplementation.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigscript/PigScriptMigrationImplementation.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigscript/PigScriptMigrationImplementation.java index b259cfb..263b137 100644 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigscript/PigScriptMigrationImplementation.java +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigscript/PigScriptMigrationImplementation.java @@ -19,11 +19,10 @@ package org.apache.ambari.view.huetoambarimigration.migration.pig.pigscript; -import org.apache.ambari.view.huetoambarimigration.migration.pig.pigjob.PigJobMigrationImplementation; import org.apache.ambari.view.huetoambarimigration.migration.configuration.ConfigurationCheckImplementation; import org.apache.ambari.view.huetoambarimigration.resources.scripts.models.PigModel; import org.apache.ambari.view.huetoambarimigration.datasource.queryset.ambariqueryset.pig.savedscriptqueryset.QuerySetAmbariDB; -import org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.savedscriptqueryset.QuerySet; +import org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.savedscriptqueryset.QuerySetHueDb; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileSystem; @@ -48,11 +47,12 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; +import java.net.URI; public class PigScriptMigrationImplementation { - static final Logger logger = Logger.getLogger(PigJobMigrationImplementation.class); + static final Logger logger = Logger.getLogger(PigScriptMigrationImplementation.class); private static String readAll(Reader rd) throws IOException { StringBuilder sb = new StringBuilder(); @@ -286,7 +286,7 @@ public class PigScriptMigrationImplementation { } - public ArrayList<PigModel> fetchFromHueDatabase(String username, String startdate, String endtime, Connection connection, QuerySet huedatabase) throws ClassNotFoundException, IOException { + public ArrayList<PigModel> fetchFromHueDatabase(String username, String startdate, String endtime, Connection connection, QuerySetHueDb huedatabase) throws ClassNotFoundException, IOException { int id = 0; int i = 0; ResultSet rs1 = null; @@ -297,6 +297,8 @@ public class PigScriptMigrationImplementation { connection.setAutoCommit(false); PreparedStatement prSt = null; ResultSet rs; + int ownerId; + String ownerName=""; if (username.equals("all")) { } else { @@ -348,9 +350,18 @@ public class PigScriptMigrationImplementation { // rs1 = statement.executeQuery("select pig_script,title,date_created,saved,arguments from pig_pigscript where saved=1 AND user_id ="+id+" AND date_created BETWEEN '"+ startdate +"' AND '" +endtime +"';"); while (rs1.next()) { PigModel pojopig = new PigModel(); + ownerId = rs1.getInt("user_id"); + if(username.equals("all")) { + prSt = huedatabase.getUserName(connection, ownerId); + ResultSet resultSet = prSt.executeQuery(); + while(resultSet.next()) { + ownerName = resultSet.getString("username"); + } + } String script = rs1.getString("pig_script"); String title = rs1.getString("title"); Date created_data = rs1.getDate("date_created"); + pojopig.setUserName(ownerName); pojopig.setDt(created_data); pojopig.setScript(script); pojopig.setTitle(title); @@ -436,10 +447,10 @@ public class PigScriptMigrationImplementation { ugi.doAs(new PrivilegedExceptionAction<Boolean>() { public Boolean run() throws Exception { - FileSystem fs = FileSystem.get(conf); + URI uri = new URI(dir); + FileSystem fs = FileSystem.get(uri, conf, username); Path src = new Path(dir); Boolean b = fs.mkdirs(src); - fs.setOwner(src,username,"hadoop"); return b; } }); @@ -471,10 +482,10 @@ public class PigScriptMigrationImplementation { public Void run() throws Exception { - FileSystem fs = FileSystem.get(conf); + URI uri = new URI(dir); + FileSystem fs = FileSystem.get(uri, conf, username); Path src = new Path(dir); fs.mkdirs(src); - fs.setOwner(src,username,"hadoop"); return null; } }); @@ -518,9 +529,7 @@ public class PigScriptMigrationImplementation { } Path path = new Path(dest1); - if (fileSystem.exists(path)) { - } FSDataOutputStream out = fileSystem.create(path); InputStream in = new BufferedInputStream( @@ -533,7 +542,7 @@ public class PigScriptMigrationImplementation { } in.close(); out.close(); - fileSystem.setOwner(path,username,"hadoop"); + fileSystem.setOwner(path, username, "hadoop"); fileSystem.close(); return null; } @@ -579,9 +588,6 @@ public class PigScriptMigrationImplementation { } Path path = new Path(dest1); - if (fileSystem.exists(path)) { - - } FSDataOutputStream out = fileSystem.create(path); @@ -595,7 +601,7 @@ public class PigScriptMigrationImplementation { } in.close(); out.close(); - fileSystem.setOwner(path,username,"hadoop"); + fileSystem.setOwner(path, username, "hadoop"); fileSystem.close(); return null; }
http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigscript/PigScriptMigrationUtility.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigscript/PigScriptMigrationUtility.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigscript/PigScriptMigrationUtility.java index 00e1c6c..5e9f0d1 100644 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigscript/PigScriptMigrationUtility.java +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigscript/PigScriptMigrationUtility.java @@ -69,23 +69,23 @@ public class PigScriptMigrationUtility { logger.info("start date: " + startDate); logger.info("enddate date: " + endDate); - logger.info("instance is: " + username); - logger.info("hue username is : " + instance); + logger.info("instance is: " + instance); + logger.info("hue username is : " + username); //Reading the configuration file PigScriptMigrationImplementation pigsavedscriptmigration = new PigScriptMigrationImplementation(); - QuerySet huedatabase = null; + QuerySetHueDb huedatabase = null; if (view.getProperties().get("huedrivername").contains("mysql")) { - huedatabase = new MysqlQuerySet(); + huedatabase = new MysqlQuerySetHueDb(); } else if (view.getProperties().get("huedrivername").contains("postgresql")) { - huedatabase = new PostgressQuerySet(); + huedatabase = new PostgressQuerySetHueDb(); } else if (view.getProperties().get("huedrivername").contains("sqlite")) { - huedatabase = new SqliteQuerySet(); + huedatabase = new SqliteQuerySetHueDb(); } else if (view.getProperties().get("huedrivername").contains("oracle")) { - huedatabase = new OracleQuerySet(); + huedatabase = new OracleQuerySetHueDb(); } QuerySetAmbariDB ambaridatabase = null; @@ -108,95 +108,107 @@ public class PigScriptMigrationUtility { ArrayList<PigModel> dbpojoPigSavedscript = new ArrayList<PigModel>(); try { - connectionHuedb = DataSourceHueDatabase.getInstance(view.getProperties().get("huedrivername"), view.getProperties().get("huejdbcurl"), view.getProperties().get("huedbusername"), view.getProperties().get("huedbpassword")).getConnection();//connection to Hue DB - dbpojoPigSavedscript = pigsavedscriptmigration.fetchFromHueDatabase(username, startDate, endDate, connectionHuedb, huedatabase);// Fetching pig script details from Hue DB + String[] usernames = username.split(","); + int totalQueries = 0; + for(int k=0; k<usernames.length; k++) { + connectionHuedb = DataSourceHueDatabase.getInstance(view.getProperties().get("huedrivername"), view.getProperties().get("huejdbcurl"), view.getProperties().get("huedbusername"), view.getProperties().get("huedbpassword")).getConnection();//connection to Hue DB + username = usernames[k]; + migrationresult.setProgressPercentage(0); + logger.info("Migration started for user " + username); - for (int j = 0; j < dbpojoPigSavedscript.size(); j++) { - logger.info("the query fetched from hue=" + dbpojoPigSavedscript.get(j).getScript()); + dbpojoPigSavedscript = pigsavedscriptmigration.fetchFromHueDatabase(username, startDate, endDate, connectionHuedb, huedatabase);// Fetching pig script details from Hue DB + totalQueries += dbpojoPigSavedscript.size(); - } + for (int j = 0; j < dbpojoPigSavedscript.size(); j++) { + logger.info("the query fetched from hue=" + dbpojoPigSavedscript.get(j).getScript()); + } - /* If No pig Script has been fetched from Hue db according to our search criteria*/ - if (dbpojoPigSavedscript.size() == 0) { - migrationresult.setIsNoQuerySelected("yes"); - migrationresult.setProgressPercentage(0); - migrationresult.setNumberOfQueryTransfered(0); - migrationresult.setTotalNoQuery(dbpojoPigSavedscript.size()); - getResourceManager(view).update(migrationresult, jobid); + /* If No pig Script has been fetched from Hue db according to our search criteria*/ + if (dbpojoPigSavedscript.size() == 0) { - logger.info("no pig script has been selected from hue according to your criteria of searching"); + logger.info("No queries has been selected for the user " + username + " between dates: " + startDate +" - "+endDate); + } else { + connectionAmbaridb = DataSourceAmbariDatabase.getInstance(view.getProperties().get("ambaridrivername"), view.getProperties().get("ambarijdbcurl"), view.getProperties().get("ambaridbusername"), view.getProperties().get("ambaridbpassword")).getConnection();// connecting to ambari db + connectionAmbaridb.setAutoCommit(false); - } else { + logger.info("loop will continue for " + dbpojoPigSavedscript.size() + "times"); - connectionAmbaridb = DataSourceAmbariDatabase.getInstance(view.getProperties().get("ambaridrivername"), view.getProperties().get("ambarijdbcurl"), view.getProperties().get("ambaridbusername"), view.getProperties().get("ambaridbpassword")).getConnection();// connecting to ambari db - connectionAmbaridb.setAutoCommit(false); + //for each pig script found in Hue Database - logger.info("loop will continue for " + dbpojoPigSavedscript.size() + "times"); + pigInstanceTableName = pigsavedscriptmigration.fetchInstanceTablenamePigScript(connectionAmbaridb, instance, ambaridatabase);// finding the table name in ambari from the given instance - //for each pig script found in Hue Database + sequence = pigsavedscriptmigration.fetchSequenceno(connectionAmbaridb, pigInstanceTableName, ambaridatabase); - pigInstanceTableName = pigsavedscriptmigration.fetchInstanceTablenamePigScript(connectionAmbaridb, instance, ambaridatabase);// finding the table name in ambari from the given instance + for (i = 0; i < dbpojoPigSavedscript.size(); i++) { - sequence = pigsavedscriptmigration.fetchSequenceno(connectionAmbaridb, pigInstanceTableName, ambaridatabase); - for (i = 0; i < dbpojoPigSavedscript.size(); i++) { + float calc = ((float) (i + 1)) / dbpojoPigSavedscript.size() * 100; + int progressPercentage = Math.round(calc); + migrationresult.setProgressPercentage(progressPercentage); + migrationresult.setNumberOfQueryTransfered(i+1); + getResourceManager(view).update(migrationresult, jobid); + logger.info("Loop No." + (i + 1)); + logger.info("________________"); + logger.info("the title of script: " + dbpojoPigSavedscript.get(i).getTitle()); - float calc = ((float) (i + 1)) / dbpojoPigSavedscript.size() * 100; - int progressPercentage = Math.round(calc); - migrationresult.setIsNoQuerySelected("no"); - migrationresult.setProgressPercentage(progressPercentage); - migrationresult.setNumberOfQueryTransfered(i + 1); - migrationresult.setTotalNoQuery(dbpojoPigSavedscript.size()); - getResourceManager(view).update(migrationresult, jobid); + time = pigsavedscriptmigration.getTime(); - logger.info("Loop No." + (i + 1)); - logger.info("________________"); - logger.info("the title of script: " + dbpojoPigSavedscript.get(i).getTitle()); + timetobeInorder = pigsavedscriptmigration.getTimeInorder(); - time = pigsavedscriptmigration.getTime(); + epochTime = pigsavedscriptmigration.getEpochTime(); - timetobeInorder = pigsavedscriptmigration.getTimeInorder(); + maxcountforpigsavedscript = i + sequence + 1; - epochTime = pigsavedscriptmigration.getEpochTime(); + if(usernames[k].equals("all")) { + username = dbpojoPigSavedscript.get(i).getUserName(); + } - maxcountforpigsavedscript = i + sequence + 1; + dirNameForPigScript = "/user/" + username + "/pig/scripts/"; - dirNameForPigScript = "/user/"+username+"/pig/scripts/"; + pigscriptFilename = dbpojoPigSavedscript.get(i).getTitle() + "-" + time + ".pig"; - pigscriptFilename = dbpojoPigSavedscript.get(i).getTitle() + "-" + time + ".pig"; + completeDirandFilePath = dirNameForPigScript + pigscriptFilename; - completeDirandFilePath = dirNameForPigScript + pigscriptFilename; + pigsavedscriptmigration.writetPigScripttoLocalFile(dbpojoPigSavedscript.get(i).getScript(), dbpojoPigSavedscript.get(i).getTitle(), dbpojoPigSavedscript.get(i).getDt(), ConfigurationCheckImplementation.getHomeDir(), pigscriptFilename); - pigsavedscriptmigration.writetPigScripttoLocalFile(dbpojoPigSavedscript.get(i).getScript(), dbpojoPigSavedscript.get(i).getTitle(), dbpojoPigSavedscript.get(i).getDt(), ConfigurationCheckImplementation.getHomeDir(), pigscriptFilename); + pigsavedscriptmigration.insertRowForPigScript(completeDirandFilePath, maxcountforsavequery, maxcountforpigsavedscript, time, timetobeInorder, epochTime, dbpojoPigSavedscript.get(i).getTitle(), connectionAmbaridb, pigInstanceTableName, instance, i, ambaridatabase, username); - pigsavedscriptmigration.insertRowForPigScript(completeDirandFilePath, maxcountforsavequery, maxcountforpigsavedscript, time, timetobeInorder, epochTime, dbpojoPigSavedscript.get(i).getTitle(), connectionAmbaridb, pigInstanceTableName, instance, i, ambaridatabase, username); + if (view.getProperties().get("KerberoseEnabled").equals("y")) { - if (view.getProperties().get("KerberoseEnabled").equals("y")) { + pigsavedscriptmigration.createDirPigScriptSecured(dirNameForPigScript, view.getProperties().get("namenode_URI_Ambari"), username, view.getProperties().get("PrincipalUserName")); + pigsavedscriptmigration.putFileinHdfsSecured(ConfigurationCheckImplementation.getHomeDir() + pigscriptFilename, dirNameForPigScript, view.getProperties().get("namenode_URI_Ambari"), username, view.getProperties().get("PrincipalUserName")); + } else { - pigsavedscriptmigration.createDirPigScriptSecured(dirNameForPigScript, view.getProperties().get("namenode_URI_Ambari"),username,view.getProperties().get("PrincipalUserName")); - pigsavedscriptmigration.putFileinHdfsSecured(ConfigurationCheckImplementation.getHomeDir() + pigscriptFilename, dirNameForPigScript, view.getProperties().get("namenode_URI_Ambari"),username,view.getProperties().get("PrincipalUserName")); - } else { + pigsavedscriptmigration.createDirPigScript(dirNameForPigScript, view.getProperties().get("namenode_URI_Ambari"), username); + pigsavedscriptmigration.putFileinHdfs(ConfigurationCheckImplementation.getHomeDir() + pigscriptFilename, dirNameForPigScript, view.getProperties().get("namenode_URI_Ambari"), username); + } - pigsavedscriptmigration.createDirPigScript(dirNameForPigScript, view.getProperties().get("namenode_URI_Ambari"),username); - pigsavedscriptmigration.putFileinHdfs(ConfigurationCheckImplementation.getHomeDir() + pigscriptFilename, dirNameForPigScript, view.getProperties().get("namenode_URI_Ambari"),username); - } + logger.info(dbpojoPigSavedscript.get(i).getTitle() + "Migrated to Ambari"); - logger.info(dbpojoPigSavedscript.get(i).getTitle() + "Migrated to Ambari"); + pigsavedscriptmigration.deletePigScriptLocalFile(ConfigurationCheckImplementation.getHomeDir(), pigscriptFilename); - pigsavedscriptmigration.deletePigScriptLocalFile(ConfigurationCheckImplementation.getHomeDir(), pigscriptFilename); + } + pigsavedscriptmigration.updateSequenceno(connectionAmbaridb, maxcountforpigsavedscript, pigInstanceTableName, ambaridatabase); + connectionAmbaridb.commit(); } - pigsavedscriptmigration.updateSequenceno(connectionAmbaridb, maxcountforpigsavedscript, pigInstanceTableName, ambaridatabase); - connectionAmbaridb.commit(); - - + logger.info("Migration completed for user " + username); } - - + logger.info("Migration Completed"); + migrationresult.setFlag(1); + if(totalQueries==0) { + migrationresult.setNumberOfQueryTransfered(0); + migrationresult.setTotalNoQuery(0); + } else { + migrationresult.setNumberOfQueryTransfered(totalQueries); + migrationresult.setTotalNoQuery(totalQueries); + migrationresult.setProgressPercentage(100); + } + getResourceManager(view).update(migrationresult, jobid); } catch (SQLException e) { logger.error("Sql exception in ambari database", e); try { http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigudf/PigUdfMigrationImplementation.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigudf/PigUdfMigrationImplementation.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigudf/PigUdfMigrationImplementation.java new file mode 100644 index 0000000..ce51bf1 --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigudf/PigUdfMigrationImplementation.java @@ -0,0 +1,387 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.huetoambarimigration.migration.pig.pigudf; + +import org.apache.ambari.view.huetoambarimigration.datasource.queryset.ambariqueryset.pig.udfqueryset.QuerySetAmbariDB; +import org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.udfqueryset.QuerySet; +import org.apache.ambari.view.huetoambarimigration.resources.scripts.models.PigModel; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FSDataInputStream; +import org.apache.hadoop.fs.FSDataOutputStream; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.security.UserGroupInformation; +import org.apache.log4j.Logger; +import org.jdom.Attribute; +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.JDOMException; +import org.jdom.input.SAXBuilder; +import org.jdom.output.Format; +import org.jdom.output.XMLOutputter; + +import java.io.*; +import java.net.URISyntaxException; +import java.security.PrivilegedExceptionAction; +import java.sql.*; +import java.util.ArrayList; +import java.net.URI; + + +public class PigUdfMigrationImplementation { + static final Logger logger = Logger.getLogger(PigUdfMigrationImplementation.class); + + private static String readAll(Reader rd) throws IOException { + StringBuilder sb = new StringBuilder(); + int cp; + while ((cp = rd.read()) != -1) { + sb.append((char) cp); + } + return sb.toString(); + } + + public int fetchSequenceno(Connection c, int id, QuerySetAmbariDB ambaridatabase) throws SQLException { + + String ds_id = new String(); + Statement stmt = null; + PreparedStatement prSt = null; + int sequencevalue=0; + + + ResultSet rs = null; + + + prSt = ambaridatabase.getSequenceNoFromAmbariSequence(c, id); + + logger.info("sql statement to fetch is from ambari instance:= = " + prSt); + + rs = prSt.executeQuery(); + + while (rs.next()) { + sequencevalue = rs.getInt("sequence_value"); + } + return sequencevalue; + } + + public int fetchInstanceTablenamePigUdf(Connection c, String instance, QuerySetAmbariDB ambaridatabase) throws SQLException { + + String ds_id = new String(); + int id = 0; + Statement stmt = null; + PreparedStatement prSt = null; + + + ResultSet rs = null; + + + prSt = ambaridatabase.getTableIdFromInstanceName(c, instance); + + logger.info("sql statement to fetch is from ambari instance:= = " + prSt); + + rs = prSt.executeQuery(); + + while (rs.next()) { + id = rs.getInt("id"); + } + return id; + + } + + + public void updateSequenceno(Connection c, int seqNo, int id, QuerySetAmbariDB ambaridatabase) throws SQLException, IOException { + + PreparedStatement prSt; + prSt = ambaridatabase.updateSequenceNoInAmbariSequence(c, seqNo, id); + logger.info("The actual insert statement is " + prSt); + prSt.executeUpdate(); + logger.info("adding revert sql hive history"); + } + + public void insertRowForPigUdf(int maxcount, String path, String fileName, Connection c, int tableId, QuerySetAmbariDB ambaridatabase, String username) throws SQLException, IOException { + + + PreparedStatement prSt = null; + prSt = ambaridatabase.insertToPigUdf(c, tableId, Integer.toString(maxcount), fileName, username, path); + prSt.executeUpdate(); + + } + + + public ArrayList<PigModel> fetchFromHueDatabase(String username, Connection connection, QuerySet huedatabase) throws ClassNotFoundException, IOException { + int id = 0; + int i = 0; + ResultSet rs1; + + ArrayList<PigModel> pigArrayList = new ArrayList<PigModel>(); + try { + connection.setAutoCommit(false); + PreparedStatement prSt = null; + ResultSet rs; + if (username.equals("all")) { + } else { + + prSt = huedatabase.getUseridfromUserName(connection, username); + + rs = prSt.executeQuery(); + + while (rs.next()) { + id = rs.getInt("id"); + } + } + + + if (username.equals("all")) { + prSt = huedatabase.getAllQueries(connection); + } else { + prSt = huedatabase.getUserQueries(connection, id); + } + + rs1 = prSt.executeQuery(); + + + // rs1 = statement.executeQuery("select url, file_name, owner_id from pig_udf"); + while (rs1.next()) { + + PigModel pojopig = new PigModel(); + String url = rs1.getString("url"); + String fileName = rs1.getString("file_name"); + int ownerId = rs1.getInt("owner_id"); + String ownerName = username; + if(username.equals("all")){ + ResultSet rs2 = huedatabase.getUserNamefromUserId(connection, ownerId).executeQuery(); + while (rs2.next()) { + ownerName = rs2.getString("username"); + } + } + logger.info("UDF ownwer name is "+ownerName); + pojopig.setUrl(url); + pojopig.setFileName(fileName); + pojopig.setUserName(ownerName); + pigArrayList.add(pojopig); + i++; + } + + + } catch (SQLException e) { + logger.error("SQLException", e); + } finally { + try { + if (connection != null) + connection.close(); + } catch (SQLException e) { + logger.error("SQLException", e); + } + } + + return pigArrayList; + + } + + public void createDirPigUdfSecured(final String dir, final String namenodeuri,final String username,final String principalName) + throws IOException, URISyntaxException { + try { + final Configuration conf = new Configuration(); + + conf.set("fs.hdfs.impl", + org.apache.hadoop.hdfs.DistributedFileSystem.class.getName() + ); + conf.set("fs.file.impl", + org.apache.hadoop.fs.LocalFileSystem.class.getName() + ); + conf.set("fs.defaultFS", namenodeuri); + conf.set("hadoop.security.authentication", "Kerberos"); + UserGroupInformation.setConfiguration(conf); + UserGroupInformation proxyUser ; + proxyUser = UserGroupInformation.createRemoteUser(principalName); + UserGroupInformation ugi = UserGroupInformation.createProxyUser("hdfs", proxyUser); + ugi.doAs(new PrivilegedExceptionAction<Boolean>() { + + public Boolean run() throws Exception { + URI uri = new URI(dir); + FileSystem fs = FileSystem.get(uri, conf, dir); + Path src = new Path(dir); + Boolean b = fs.mkdirs(src); + fs.setOwner(src,username,"hadoop"); + return b; + } + }); + } catch (Exception e) { + logger.error("Exception in Webhdfs", e); + } + } + + + public void createDirPigUdf(final String dir, final String namenodeuri,final String username) + throws IOException, URISyntaxException { + + try { + final Configuration conf = new Configuration(); + + conf.set("fs.hdfs.impl", + org.apache.hadoop.hdfs.DistributedFileSystem.class.getName() + ); + conf.set("fs.file.impl", + org.apache.hadoop.fs.LocalFileSystem.class.getName() + ); + conf.set("fs.defaultFS", namenodeuri); + conf.set("hadoop.job.ugi", "hdfs"); + conf.set("hadoop.security.authentication", "Kerberos"); + + UserGroupInformation.setConfiguration(conf); + UserGroupInformation ugi = UserGroupInformation.createRemoteUser("hdfs"); + + ugi.doAs(new PrivilegedExceptionAction<Void>() { + + public Void run() throws Exception { + + URI uri = new URI(dir); + FileSystem fs = FileSystem.get(uri, conf, username); + Path src = new Path(dir); + fs.mkdirs(src); + return null; + } + }); + } catch (Exception e) { + logger.error("Webhdfs: ", e); + } + } + + + public void copyFileBetweenHdfs(final String source, final String dest, final String nameNodeuriAmbari,final String username) + throws IOException { + + try { + UserGroupInformation ugi = UserGroupInformation + .createRemoteUser("hdfs"); + + ugi.doAs(new PrivilegedExceptionAction<Void>() { + + public Void run() throws Exception { + + Configuration confAmbari = new Configuration(); + confAmbari.set("fs.defaultFS", nameNodeuriAmbari); + confAmbari.set("hadoop.job.ugi", "hdfs"); + FileSystem fileSystemAmbari = FileSystem.get(confAmbari); + + Configuration confHue = new Configuration(); + confHue.set("fs.defaultFS", nameNodeuriAmbari); + confHue.set("hadoop.job.ugi", "hdfs"); + FileSystem fileSystemHue = FileSystem.get(confHue); + + String filename = source.substring( + source.lastIndexOf('/') + 1, source.length()); + String dest1; + if (dest.charAt(dest.length() - 1) != '/') { + dest1 = dest + "/" + filename; + } else { + dest1 = dest + filename; + } + + Path path1 = new Path(source); + FSDataInputStream in1 = fileSystemHue.open(path1); + + Path path = new Path(dest1); + + FSDataOutputStream out = fileSystemAmbari.create(path); + + byte[] b = new byte[1024]; + int numBytes = 0; + while ((numBytes = in1.read(b)) > 0) { + out.write(b, 0, numBytes); + } + in1.close(); + out.close(); + fileSystemAmbari.setOwner(path, username, "hadoop"); + fileSystemHue.close(); + fileSystemAmbari.close(); + return null; + } + }); + } catch (Exception e) { + logger.error("Webhdfs exception: ", e); + } + + } + + public void copyFileBetweenHdfsSecured(final String source, final String dest, final String nameNodeuriAmbari, final String username,final String pricipalName) + throws IOException { + + try { + + final Configuration confAmbari = new Configuration(); + confAmbari.set("fs.defaultFS", nameNodeuriAmbari); + confAmbari.set("hadoop.job.ugi", "hdfs"); + + final Configuration confHue = new Configuration(); + confHue.set("fs.defaultFS", nameNodeuriAmbari); + confHue.set("hadoop.job.ugi", "hdfs"); + + confAmbari.set("hadoop.security.authentication", "Kerberos"); + confHue.set("hadoop.security.authentication", "Kerberos"); + + UserGroupInformation.setConfiguration(confAmbari); + UserGroupInformation proxyUser ; + proxyUser = UserGroupInformation.createRemoteUser(pricipalName); + UserGroupInformation ugi = UserGroupInformation.createProxyUser("hdfs", proxyUser); + + ugi.doAs(new PrivilegedExceptionAction<Void>() { + + public Void run() throws Exception { + + FileSystem fileSystemAmbari = FileSystem.get(confAmbari); + + FileSystem fileSystemHue = FileSystem.get(confHue); + + String filename = source.substring( + source.lastIndexOf('/') + 1, source.length()); + String dest1; + if (dest.charAt(dest.length() - 1) != '/') { + dest1 = dest + "/" + filename; + } else { + dest1 = dest + filename; + } + + Path path1 = new Path(source); + FSDataInputStream in1 = fileSystemHue.open(path1); + + Path path = new Path(dest1); + + FSDataOutputStream out = fileSystemAmbari.create(path); + byte[] b = new byte[1024]; + int numBytes = 0; + while ((numBytes = in1.read(b)) > 0) { + out.write(b, 0, numBytes); + } + in1.close(); + out.close(); + fileSystemAmbari.setOwner(path, username, "hadoop"); + fileSystemHue.close(); + fileSystemAmbari.close(); + return null; + } + }); + } catch (Exception e) { + logger.error("Webhdfs exception: ", e); + } + + } + + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigudf/PigUdfMigrationUtility.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigudf/PigUdfMigrationUtility.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigudf/PigUdfMigrationUtility.java new file mode 100644 index 0000000..d6a69fc --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigudf/PigUdfMigrationUtility.java @@ -0,0 +1,235 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.view.huetoambarimigration.migration.pig.pigudf; + +import org.apache.ambari.view.huetoambarimigration.datasource.DataSourceAmbariDatabase; +import org.apache.ambari.view.huetoambarimigration.datasource.DataSourceHueDatabase; +import org.apache.ambari.view.huetoambarimigration.datasource.queryset.ambariqueryset.pig.udfqueryset.MysqlQuerySetAmbariDB; +import org.apache.ambari.view.huetoambarimigration.datasource.queryset.ambariqueryset.pig.udfqueryset.OracleQuerySetAmbariDB; +import org.apache.ambari.view.huetoambarimigration.datasource.queryset.ambariqueryset.pig.udfqueryset.PostgressQuerySetAmbariDB; +import org.apache.ambari.view.huetoambarimigration.datasource.queryset.ambariqueryset.pig.udfqueryset.QuerySetAmbariDB; +import org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.udfqueryset.*; +import org.apache.ambari.view.huetoambarimigration.migration.pig.pigudf.PigUdfMigrationImplementation; +import org.apache.ambari.view.huetoambarimigration.persistence.utils.ItemNotFound; +import org.apache.ambari.view.huetoambarimigration.resources.PersonalCRUDResourceManager; +import org.apache.ambari.view.huetoambarimigration.resources.scripts.MigrationResourceManager; +import org.apache.ambari.view.huetoambarimigration.resources.scripts.models.MigrationResponse; +import org.apache.ambari.view.huetoambarimigration.resources.scripts.models.PigModel; +import org.apache.log4j.Logger; +import org.apache.ambari.view.ViewContext; + +import java.beans.PropertyVetoException; +import java.io.IOException; +import java.net.URISyntaxException; +import java.sql.Connection; +import java.sql.SQLException; +import java.text.ParseException; +import java.util.ArrayList; + + +public class PigUdfMigrationUtility { + + protected MigrationResourceManager resourceManager = null; + + public synchronized PersonalCRUDResourceManager<MigrationResponse> getResourceManager(ViewContext view) { + if (resourceManager == null) { + resourceManager = new MigrationResourceManager(view); + } + return resourceManager; + } + + + public void pigUdfMigration(String username, String instance, ViewContext view, MigrationResponse migrationresult, String jobid) throws IOException, ItemNotFound { + + long startTime = System.currentTimeMillis(); + + final Logger logger = Logger.getLogger(PigUdfMigrationUtility.class); + Connection connectionHuedb = null; + Connection connectionAmbaridb = null; + + logger.info("-------------------------------------"); + logger.info("pig udf Migration started"); + logger.info("-------------------------------------"); + + + int i = 0; + + logger.info("instance is: " + username); + logger.info("hue username is : " + instance); + + //Reading the configuration file + PigUdfMigrationImplementation pigudfmigration = new PigUdfMigrationImplementation(); + + QuerySet huedatabase = null; + + if (view.getProperties().get("huedrivername").contains("mysql")) { + huedatabase = new MysqlQuerySet(); + } else if (view.getProperties().get("huedrivername").contains("postgresql")) { + huedatabase = new PostgressQuerySet(); + } else if (view.getProperties().get("huedrivername").contains("sqlite")) { + + huedatabase = new SqliteQuerySet(); + } else if (view.getProperties().get("huedrivername").contains("oracle")) { + huedatabase = new OracleQuerySet(); + } + + QuerySetAmbariDB ambaridatabase = null; + + + if (view.getProperties().get("ambaridrivername").contains("mysql")) { + ambaridatabase = new MysqlQuerySetAmbariDB(); + } else if (view.getProperties().get("ambaridrivername").contains("postgresql")) { + ambaridatabase = new PostgressQuerySetAmbariDB(); + } else if (view.getProperties().get("ambaridrivername").contains("oracle")) { + ambaridatabase = new OracleQuerySetAmbariDB(); + } + + int maxcountforpigudf = 0; + String dirNameForPigUdf = ""; + int pigInstanceTableId, sequence; + + ArrayList<PigModel> dbpojoPigUdf = new ArrayList<PigModel>(); + + try { + String[] usernames = username.split(","); + int totalQueries = 0; + for(int k=0; k<usernames.length; k++) { + connectionHuedb = DataSourceHueDatabase.getInstance(view.getProperties().get("huedrivername"), view.getProperties().get("huejdbcurl"), view.getProperties().get("huedbusername"), view.getProperties().get("huedbpassword")).getConnection();//connection to Hue DB + username = usernames[k]; + migrationresult.setProgressPercentage(0); + logger.info("Migration started for user " + username); + dbpojoPigUdf = pigudfmigration.fetchFromHueDatabase(username, connectionHuedb, huedatabase);// Fetching pig script details from Hue DB + totalQueries += dbpojoPigUdf.size(); + + for (int j = 0; j < dbpojoPigUdf.size(); j++) { + logger.info("jar fetched from hue=" + dbpojoPigUdf.get(j).getFileName()); + + } + + + /* If No pig Script has been fetched from Hue db according to our search criteria*/ + if (dbpojoPigUdf.size() == 0) { + + logger.info("No queries has been selected for the user " + username); + } else { + + connectionAmbaridb = DataSourceAmbariDatabase.getInstance(view.getProperties().get("ambaridrivername"), view.getProperties().get("ambarijdbcurl"), view.getProperties().get("ambaridbusername"), view.getProperties().get("ambaridbpassword")).getConnection();// connecting to ambari db + connectionAmbaridb.setAutoCommit(false); + + logger.info("loop will continue for " + dbpojoPigUdf.size() + "times"); + + //for each pig udf found in Hue Database + + pigInstanceTableId = pigudfmigration.fetchInstanceTablenamePigUdf(connectionAmbaridb, instance, ambaridatabase);// finding the table name in ambari from the given instance + + sequence = pigudfmigration.fetchSequenceno(connectionAmbaridb, pigInstanceTableId, ambaridatabase); + + for (i = 0; i < dbpojoPigUdf.size(); i++) { + + + float calc = ((float) (i + 1)) / dbpojoPigUdf.size() * 100; + int progressPercentage = Math.round(calc); + migrationresult.setProgressPercentage(progressPercentage); + migrationresult.setNumberOfQueryTransfered(i + 1); + getResourceManager(view).update(migrationresult, jobid); + + logger.info("Loop No." + (i + 1)); + logger.info("________________"); + logger.info("jar name: " + dbpojoPigUdf.get(i).getFileName()); + + maxcountforpigudf = i + sequence + 1; + + + String ownerName = dbpojoPigUdf.get(i).getUserName(); + String filePath = dbpojoPigUdf.get(i).getUrl(); + String fileName = dbpojoPigUdf.get(i).getFileName(); + if(usernames[k].equals("all")) { + username = dbpojoPigUdf.get(i).getUserName(); + } + dirNameForPigUdf = "/user/" + username + "/pig/udf/"; + String ambariNameNodeUri = view.getProperties().get("namenode_URI_Ambari"); + String dirAndFileName = ambariNameNodeUri + dirNameForPigUdf + fileName; + + if (view.getProperties().get("KerberoseEnabled").equals("y")) { + pigudfmigration.createDirPigUdfSecured(dirNameForPigUdf, ambariNameNodeUri, ownerName, view.getProperties().get("PrincipalUserName")); + pigudfmigration.copyFileBetweenHdfsSecured(filePath, dirNameForPigUdf, ambariNameNodeUri, ownerName, view.getProperties().get("PrincipalUserName")); + } else { + pigudfmigration.createDirPigUdf(dirNameForPigUdf, ambariNameNodeUri, ownerName); + pigudfmigration.copyFileBetweenHdfs(filePath, dirNameForPigUdf, ambariNameNodeUri, ownerName); + } + + pigudfmigration.insertRowForPigUdf(maxcountforpigudf, dirAndFileName, fileName, connectionAmbaridb, pigInstanceTableId, ambaridatabase, ownerName); + logger.info(dbpojoPigUdf.get(i).getFileName() + "Migrated to Ambari"); + + } + pigudfmigration.updateSequenceno(connectionAmbaridb, maxcountforpigudf, pigInstanceTableId, ambaridatabase); + connectionAmbaridb.commit(); + } + logger.info("Migration completed for user " + username); + } + migrationresult.setFlag(1); + if(totalQueries==0) { + migrationresult.setNumberOfQueryTransfered(0); + migrationresult.setTotalNoQuery(0); + } else { + migrationresult.setNumberOfQueryTransfered(totalQueries); + migrationresult.setTotalNoQuery(totalQueries); + migrationresult.setProgressPercentage(100); + } + getResourceManager(view).update(migrationresult, jobid); + } catch (SQLException e) { + logger.error("Sql exception in ambari database", e); + try { + connectionAmbaridb.rollback(); + logger.info("rollback done"); + } catch (SQLException e1) { + logger.error("Sql exception while doing roll back", e); + } + } catch (ClassNotFoundException e2) { + logger.error("class not found exception", e2); + + } catch (PropertyVetoException e) { + logger.error("PropertyVetoException: ", e); + } catch (URISyntaxException e) { + e.printStackTrace(); + } finally { + if (null != connectionAmbaridb) + try { + connectionAmbaridb.close(); + } catch (SQLException e) { + logger.error("connection close exception: ", e); + } + } + + long stopTime = System.currentTimeMillis(); + long elapsedTime = stopTime - startTime; + + + migrationresult.setJobtype("hivehistoryquerymigration"); + migrationresult.setTotalTimeTaken(String.valueOf(elapsedTime)); + getResourceManager(view).update(migrationresult, jobid); + + + logger.info("----------------------------------"); + logger.info("pig udf Migration ends"); + logger.info("----------------------------------"); + + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigudf/PigUdfStartJob.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigudf/PigUdfStartJob.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigudf/PigUdfStartJob.java new file mode 100644 index 0000000..23a85be --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigudf/PigUdfStartJob.java @@ -0,0 +1,69 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.view.huetoambarimigration.migration.pig.pigudf; + +import org.apache.ambari.view.ViewContext; +import org.apache.ambari.view.huetoambarimigration.persistence.utils.ItemNotFound; +import org.apache.ambari.view.huetoambarimigration.resources.scripts.models.MigrationResponse; +import org.json.simple.JSONObject; + +import java.io.IOException; + + +public class PigUdfStartJob extends Thread{ + + String username; + String instance; + String startdate; + String enddate; + String jobid; + ViewContext view; + + public PigUdfStartJob(String username, String instance, String jobid, ViewContext view) { + this.username = username; + this.instance=instance; + this.startdate=startdate; + this.enddate=enddate; + this.jobid=jobid; + this.view=view; + } + + @Override + public void run() { + + MigrationResponse migrationresult=new MigrationResponse(); + + migrationresult.setId(jobid); + migrationresult.setIntanceName(instance); + migrationresult.setUserNameofhue(username); + migrationresult.setProgressPercentage(0); + migrationresult.setFlag(0); + + PigUdfMigrationUtility pigudfmigration=new PigUdfMigrationUtility(); + try { + pigudfmigration.pigUdfMigration(username,instance,view,migrationresult,jobid); + } + catch (IOException e) { + e.printStackTrace(); + } catch (ItemNotFound itemNotFound) { + itemNotFound.printStackTrace(); + } + + } + +} http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/HiveModel.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/HiveModel.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/HiveModel.java index fb9496a..d467fb0 100644 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/HiveModel.java +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/HiveModel.java @@ -18,11 +18,18 @@ package org.apache.ambari.view.huetoambarimigration.resources.scripts.models; +import java.util.ArrayList; + public class HiveModel { private String database; - private String owner; private String query; + private String queryTitle; + private ArrayList<String> filePaths; + private ArrayList<String> udfClasses; + private ArrayList<String> udfNames; + private String ownerName; + public String getDatabase() { return database; @@ -32,20 +39,43 @@ public class HiveModel { this.database = database; } - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - public String getQuery() { return query; } + public String getQueryTitle() { return queryTitle; } + + public void setQueryTitle(String queryTitle) { this.queryTitle = queryTitle; } + public void setQuery(String query) { this.query = query; } + public ArrayList<String> getFilePaths() { + return filePaths; + } + + public void setFilePaths(ArrayList<String> filePaths) { + this.filePaths = filePaths; + } + + public ArrayList<String> getUdfClasses() { + return udfClasses; + } + + public void setUdfClasses(ArrayList<String> udfClasses) { + this.udfClasses = udfClasses; + } + + public ArrayList<String> getUdfNames() { + return udfNames; + } + + public void setUdfNames(ArrayList<String> udfNames) { + this.udfNames = udfNames; + } + + public String getOwnerName() { return ownerName; } + + public void setOwnerName(String ownerName) { this.ownerName = ownerName; } } http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/MigrationResponse.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/MigrationResponse.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/MigrationResponse.java index d3cd5b9..8e7a7ad 100644 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/MigrationResponse.java +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/MigrationResponse.java @@ -33,7 +33,6 @@ import java.util.Map; public class MigrationResponse implements Serializable,PersonalResource{ - private String id; private int numberOfQueryTransfered; @@ -45,6 +44,7 @@ public class MigrationResponse implements Serializable,PersonalResource{ private String totalTimeTaken=""; private String jobtype=""; private String isNoQuerySelected=""; + private int flag; public String getTotalTimeTaken() { return totalTimeTaken; @@ -140,4 +140,8 @@ public class MigrationResponse implements Serializable,PersonalResource{ public void setOwner(String owner) { this.owner = owner; } + + public int getFlag() { return flag; } + + public void setFlag(int flag) { this.flag = flag; } } http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/PigModel.java ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/PigModel.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/PigModel.java index 5bf6499..8339ce3 100644 --- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/PigModel.java +++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/resources/scripts/models/PigModel.java @@ -27,6 +27,26 @@ public class PigModel { private String Status; private String title; private String dir; + private String url; + private String fileName; + private String userName; + + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getFileName() { return fileName; } + + public void setFileName(String fileName) { this.fileName = fileName; } + + public String getUrl() { return url; } + + public void setUrl(String url) { this.url = url; } public Date getDt() { return dt; http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/models/checkprogress.js ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/models/checkprogress.js b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/models/checkprogress.js index e6e466f..a65e367 100644 --- a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/models/checkprogress.js +++ b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/models/checkprogress.js @@ -26,5 +26,6 @@ export default Model.extend({ userNameofhue: DS.attr('string'), totalTimeTaken: DS.attr('string'), jobtype: DS.attr('string'), - isNoQuerySelected: DS.attr('string') + isNoQuerySelected: DS.attr('string'), + flag: DS.attr('string') }); http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/router.js ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/router.js b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/router.js index 6d99750..d4e3324 100644 --- a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/router.js +++ b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/router.js @@ -30,9 +30,9 @@ Router.map(function() { this.route('pig-script'); this.route('pig-job'); this.route('revert-change'); + this.route('pig-udf'); }); - }); export default Router; http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/hive-history.js ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/hive-history.js b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/hive-history.js index 158a154..52716f2 100644 --- a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/hive-history.js +++ b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/hive-history.js @@ -21,20 +21,33 @@ import Ember from 'ember'; export default Ember.Route.extend({ + usernames: [], + model: function() { var store = this.store; return Ember.RSVP.hash({ usersdetail: store.findAll('usersdetail'), - hiveinstancedetail: store.findAll('hiveinstancedetail') + hiveinstancedetail: store.findAll('hiveinstancedetail'), + selections: [] }); }, actions: { - submitResult: function() { + addSelection: function(value) { + this.usernames.push(value); + }, + + removeSelection: function(value) { + var index = this.usernames.indexOf(value); + if(index > -1) { + this.usernames.splice(index,1); + } + }, - if(this.controller.get('usernamehue')===undefined || this.controller.get('instancename') ===undefined){ + submitResult: function() { + if(this.usernames.length === 0 || this.controller.get('instancename') ===undefined){ alert("Mandatory fields can not left blank"); } else{ @@ -42,7 +55,7 @@ export default Ember.Route.extend({ this.controller.set('progressBar', null); this.controller.set('completionStatus', null); var migration = this.store.queryRecord('returnjobid', { - username: this.controller.get('usernamehue'), + username: this.usernames.toString(), instance: this.controller.get('instancename'), startdate: this.controller.get('startdate'), enddate: this.controller.get('enddate'), @@ -56,7 +69,7 @@ export default Ember.Route.extend({ var jobid = migration.get('idforJob'); console.log("jobid is " + jobid); var hivehistoryqueryjobstart = store.queryRecord('startmigration', { - username: control.get('usernamehue'), + username: repeat.usernames.toString(), instance: control.get('instancename'), startdate: control.get('startdate'), enddate: control.get('enddate'), @@ -68,7 +81,7 @@ export default Ember.Route.extend({ repeat.progresscheck(jobid); }); }); - } + } } }, progresscheck: function(jobid) { @@ -83,18 +96,15 @@ export default Ember.Route.extend({ // control.set('jobstatus',null); var progressPercentage = progress.get('progressPercentage'); var numberOfQueryTransfered = progress.get('numberOfQueryTransfered'); - var totalNoQuery = progress.get('totalNoQuery'); - var intanceName = progress.get('intanceName'); - var userNameofhue = progress.get('userNameofhue'); - var totalTimeTaken = progress.get('totalTimeTaken'); - var isNoQuerySelected = progress.get('isNoQuerySelected'); + var flagForCompletion = parseInt(progress.get('flag')); console.log("the progress percentage is="+progressPercentage); + console.log("flag status is "+flagForCompletion); - if (progressPercentage !== '100' && isNoQuerySelected === 'no') { - control.set('progressBar', progressPercentage); - repeat.progresscheck(jobid); - } - if (progressPercentage === '100' || isNoQuerySelected === 'yes') { + if (flagForCompletion === 1) { + var totalNoQuery = progress.get('totalNoQuery'); + var intanceName = progress.get('intanceName'); + var userNameofhue = progress.get('userNameofhue'); + var totalTimeTaken = progress.get('totalTimeTaken'); control.set('jobstatus', null); control.set('completionStatus', progressPercentage); control.set('progressBar', progressPercentage); @@ -108,6 +118,9 @@ export default Ember.Route.extend({ control.set('Username', userNameofhue); control.set('totalTimeTaken', totalTimeTaken); + } else { + control.set('progressBar', progressPercentage); + repeat.progresscheck(jobid); } }); }, 500); http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/hive-saved-query.js ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/hive-saved-query.js b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/hive-saved-query.js index 2006e8d..ed90469 100644 --- a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/hive-saved-query.js +++ b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/hive-saved-query.js @@ -19,20 +19,33 @@ import Ember from 'ember'; export default Ember.Route.extend({ + usernames: [], + model: function() { var store = this.store; return Ember.RSVP.hash({ usersdetail: store.findAll('usersdetail'), - hiveinstancedetail: store.findAll('hiveinstancedetail') - + hiveinstancedetail: store.findAll('hiveinstancedetail'), + selections: [] }); }, actions: { + addSelection: function(value) { + this.usernames.push(value); + }, + + removeSelection: function(value) { + var index = this.usernames.indexOf(value); + if(index > -1) { + this.usernames.splice(index,1); + } + }, + submitResult: function() { - if(this.controller.get('usernamehue')===undefined || this.controller.get('instancename') ===undefined){ + if(this.usernames.length === 0 || this.controller.get('instancename') ===undefined){ alert("Mandatory fields can not left blank"); } else{ @@ -40,7 +53,7 @@ export default Ember.Route.extend({ this.controller.set('progressBar', null); this.controller.set('completionStatus', null); var migration = this.store.queryRecord('returnjobid', { - username: this.controller.get('usernamehue'), + username: this.usernames.toString(), instance: this.controller.get('instancename'), startdate: this.controller.get('startdate'), enddate: this.controller.get('enddate'), @@ -53,7 +66,7 @@ export default Ember.Route.extend({ migration.then(function() { var jobid = migration.get('idforJob'); var hivehistoryqueryjobstart = store.queryRecord('startmigration', { - username: control.get('usernamehue'), + username: repeat.usernames.toString(), instance: control.get('instancename'), startdate: control.get('startdate'), enddate: control.get('enddate'), @@ -78,16 +91,14 @@ export default Ember.Route.extend({ progress.then(function() { var progressPercentage = progress.get('progressPercentage'); var numberOfQueryTransfered = progress.get('numberOfQueryTransfered'); - var totalNoQuery = progress.get('totalNoQuery'); - var intanceName = progress.get('intanceName'); - var userNameofhue = progress.get('userNameofhue'); - var totalTimeTaken = progress.get('totalTimeTaken'); - var isNoQuerySelected = progress.get('isNoQuerySelected'); - if (progressPercentage !== '100' && isNoQuerySelected === 'no') { - control.set('progressBar', progressPercentage); - repeat.progresscheck(jobid); - } - if (progressPercentage === '100' || isNoQuerySelected === 'yes') { + var flagForCompletion = parseInt(progress.get('flag')); + console.log("the progress percentage is="+progressPercentage); + + if (flagForCompletion === 1) { + var totalNoQuery = progress.get('totalNoQuery'); + var intanceName = progress.get('intanceName'); + var userNameofhue = progress.get('userNameofhue'); + var totalTimeTaken = progress.get('totalTimeTaken'); control.set('jobstatus', null); control.set('completionStatus', progressPercentage); control.set('progressBar', progressPercentage); @@ -101,6 +112,9 @@ export default Ember.Route.extend({ control.set('Username', userNameofhue); control.set('totalTimeTaken', totalTimeTaken); + } else { + control.set('progressBar', progressPercentage); + repeat.progresscheck(jobid); } }); }, 500); http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/pig-job.js ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/pig-job.js b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/pig-job.js index d2dfd39..225f7ee 100644 --- a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/pig-job.js +++ b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/pig-job.js @@ -19,20 +19,35 @@ import Ember from 'ember'; export default Ember.Route.extend({ + usernames: [], + model: function() { var store = this.store; return Ember.RSVP.hash({ usersdetail: store.findAll('usersdetail'), - piginstancedetail: store.findAll('piginstancedetail') + piginstancedetail: store.findAll('piginstancedetail'), + selections: [] }); }, actions: { + + addSelection: function(value) { + this.usernames.push(value); + }, + + removeSelection: function(value) { + var index = this.usernames.indexOf(value); + if(index > -1) { + this.usernames.splice(index,1); + } + }, + submitResult: function() { - if(this.controller.get('usernamehue')===undefined || this.controller.get('instancename') ===undefined){ + if(this.usernames.length === 0 || this.controller.get('instancename') ===undefined){ alert("Mandatory fields can not left blank"); } else{ @@ -40,7 +55,7 @@ export default Ember.Route.extend({ this.controller.set('progressBar', null); this.controller.set('completionStatus', null); var migration = this.store.queryRecord('returnjobid', { - username: this.controller.get('usernamehue'), + username: this.usernames.toString(), instance: this.controller.get('instancename'), startdate: this.controller.get('startdate'), enddate: this.controller.get('enddate'), @@ -53,7 +68,7 @@ export default Ember.Route.extend({ migration.then(function() { var jobid = migration.get('idforJob'); var hivehistoryqueryjobstart = store.queryRecord('startmigration', { - username: control.get('usernamehue'), + username: repeat.usernames.toString(), instance: control.get('instancename'), startdate: control.get('startdate'), enddate: control.get('enddate'), @@ -78,16 +93,15 @@ export default Ember.Route.extend({ progress.then(function() { var progressPercentage = progress.get('progressPercentage'); var numberOfQueryTransfered = progress.get('numberOfQueryTransfered'); - var totalNoQuery = progress.get('totalNoQuery'); - var intanceName = progress.get('intanceName'); - var userNameofhue = progress.get('userNameofhue'); - var totalTimeTaken = progress.get('totalTimeTaken'); - var isNoQuerySelected = progress.get('isNoQuerySelected'); - if (progressPercentage !== '100' && isNoQuerySelected === 'no') { - control.set('progressBar', progressPercentage); - repeat.progresscheck(jobid); - } - if (progressPercentage === '100' || isNoQuerySelected === 'yes') { + var flagForCompletion = parseInt(progress.get('flag')); + console.log("the progress percentage is="+progressPercentage); + console.log("flag completion status is "+flagForCompletion); + + if (flagForCompletion === 1) { + var totalNoQuery = progress.get('totalNoQuery'); + var intanceName = progress.get('intanceName'); + var userNameofhue = progress.get('userNameofhue'); + var totalTimeTaken = progress.get('totalTimeTaken'); control.set('jobstatus', null); control.set('completionStatus', progressPercentage); control.set('progressBar', progressPercentage); @@ -101,6 +115,9 @@ export default Ember.Route.extend({ control.set('Username', userNameofhue); control.set('totalTimeTaken', totalTimeTaken); + } else { + control.set('progressBar', progressPercentage); + repeat.progresscheck(jobid); } }); }, 500); http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/pig-script.js ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/pig-script.js b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/pig-script.js index c121f63..cc6c631 100644 --- a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/pig-script.js +++ b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/pig-script.js @@ -19,19 +19,33 @@ import Ember from 'ember'; export default Ember.Route.extend({ + usernames: [], + model: function() { var store = this.store; return Ember.RSVP.hash({ usersdetail: store.findAll('usersdetail'), - piginstancedetail: store.findAll('piginstancedetail') - + piginstancedetail: store.findAll('piginstancedetail'), + selections: [] }); }, actions: { + + addSelection: function(value) { + this.usernames.push(value); + }, + + removeSelection: function(value) { + var index = this.usernames.indexOf(value); + if(index > -1) { + this.usernames.splice(index,1); + } + }, + submitResult: function() { - if(this.controller.get('usernamehue')===undefined || this.controller.get('instancename') ===undefined){ + if(this.usernames.length === 0 || this.controller.get('instancename') ===undefined){ alert("Mandatory fields can not left blank"); } else @@ -40,7 +54,7 @@ export default Ember.Route.extend({ this.controller.set('progressBar', null); this.controller.set('completionStatus', null); var migration = this.store.queryRecord('returnjobid', { - username: this.controller.get('usernamehue'), + username: this.usernames.toString(), instance: this.controller.get('instancename'), startdate: this.controller.get('startdate'), enddate: this.controller.get('enddate'), @@ -53,7 +67,7 @@ export default Ember.Route.extend({ migration.then(function() { var jobid = migration.get('idforJob'); var hivehistoryqueryjobstart = store.queryRecord('startmigration', { - username: control.get('usernamehue'), + username: repeat.usernames.toString(), instance: control.get('instancename'), startdate: control.get('startdate'), enddate: control.get('enddate'), @@ -79,16 +93,14 @@ export default Ember.Route.extend({ // control.set('jobstatus',null); var progressPercentage = progress.get('progressPercentage'); var numberOfQueryTransfered = progress.get('numberOfQueryTransfered'); - var totalNoQuery = progress.get('totalNoQuery'); - var intanceName = progress.get('intanceName'); - var userNameofhue = progress.get('userNameofhue'); - var totalTimeTaken = progress.get('totalTimeTaken'); - var isNoQuerySelected = progress.get('isNoQuerySelected'); - if (progressPercentage !== '100' && isNoQuerySelected === 'no') { - control.set('progressBar', progressPercentage); - repeat.progresscheck(jobid); - } - if (progressPercentage === '100' || isNoQuerySelected === 'yes') { + var flagForCompletion = parseInt(progress.get('flag')); + console.log("the progress percentage is="+progressPercentage); + + if (flagForCompletion === 1) { + var totalNoQuery = progress.get('totalNoQuery'); + var intanceName = progress.get('intanceName'); + var userNameofhue = progress.get('userNameofhue'); + var totalTimeTaken = progress.get('totalTimeTaken'); control.set('jobstatus', null); control.set('completionStatus', progressPercentage); control.set('progressBar', progressPercentage); @@ -102,6 +114,9 @@ export default Ember.Route.extend({ control.set('Username', userNameofhue); control.set('totalTimeTaken', totalTimeTaken); + } else { + control.set('progressBar', progressPercentage); + repeat.progresscheck(jobid); } }); }, 500); http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/pig-udf.js ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/pig-udf.js b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/pig-udf.js new file mode 100644 index 0000000..83e316f --- /dev/null +++ b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/routes/home-page/pig-udf.js @@ -0,0 +1,121 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ember from 'ember'; + +export default Ember.Route.extend({ + + usernames: [], + + model: function() { + var store = this.store; + return Ember.RSVP.hash({ + usersdetail: store.findAll('usersdetail'), + piginstancedetail: store.findAll('piginstancedetail'), + selections: [] + + }); + + }, + + actions: { + + addSelection: function(value) { + this.usernames.push(value); + }, + + removeSelection: function(value) { + var index = this.usernames.indexOf(value); + if(index > -1) { + this.usernames.splice(index,1); + } + }, + + submitResult: function() { + + if(this.usernames.length === 0 || this.controller.get('instancename') ===undefined){ + alert("Mandatory fields can not left blank"); + } + else{ + this.controller.set('jobstatus', null); + this.controller.set('progressBar', null); + this.controller.set('completionStatus', null); + var migration = this.store.queryRecord('returnjobid', { + username: this.usernames.toString(), + instance: this.controller.get('instancename'), + jobtype: "pigudfmigration" + }); + var control = this.controller; + var store = this.store; + var repeat = this; + + migration.then(function() { + var jobid = migration.get('idforJob'); + var hivehistoryqueryjobstart = store.queryRecord('startmigration', { + username: repeat.usernames.toString(), + instance: control.get('instancename'), + jobid: jobid, + jobtype: "pigudfmigration" + }); + hivehistoryqueryjobstart.then(function() { + control.set('jobstatus', "0"); + repeat.progresscheck(jobid); + }); + }); + } + } + }, + progresscheck: function(jobid) { + var repeat = this; + var control = this.controller; + Ember.run.later(this, function() { + var progress = this.store.queryRecord('checkprogress', { + jobid: jobid + }); + progress.then(function() { + var progressPercentage = progress.get('progressPercentage'); + var numberOfQueryTransfered = progress.get('numberOfQueryTransfered'); + var flagForCompletion = parseInt(progress.get('flag')); + console.log("the progress percentage is="+progressPercentage); + + if (flagForCompletion === 1) { + var totalNoQuery = progress.get('totalNoQuery'); + var intanceName = progress.get('intanceName'); + var userNameofhue = progress.get('userNameofhue'); + var totalTimeTaken = progress.get('totalTimeTaken'); + control.set('jobstatus', null); + control.set('completionStatus', progressPercentage); + control.set('progressBar', progressPercentage); + if (numberOfQueryTransfered === "0") { + control.set('numberOfQueryTransfered', "No Queries selected according to your criteria"); + } else { + control.set('numberOfQueryTransfered', numberOfQueryTransfered); + } + control.set('totalNoQuery', totalNoQuery); + control.set('instanceName', intanceName); + control.set('Username', userNameofhue); + control.set('totalTimeTaken', totalTimeTaken); + + } else { + control.set('progressBar', progressPercentage); + repeat.progresscheck(jobid); + } + + }); + }, 500); + } +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page.hbs b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page.hbs index 60fccf3..90be5ea 100644 --- a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page.hbs +++ b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page.hbs @@ -26,8 +26,9 @@ </li> <li class="dropdown nav-tab"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Pig <span class="caret"></span></a> <ul class="dropdown-menu"> - <li>{{#link-to 'homePage.pig-script'}}PigSaved script{{/link-to}}</li> - <li>{{#link-to 'homePage.pig-job'}}PigJob{{/link-to}}</li> + <li>{{#link-to 'homePage.pig-script'}}Pig Saved Scripts{{/link-to}}</li> + <li>{{#link-to 'homePage.pig-job'}}Pig Jobs{{/link-to}}</li> + <li>{{#link-to 'homePage.pig-udf'}}Pig UDFs{{/link-to}}</li> </ul> </li> <li>{{#link-to 'homePage.revert-change'}}RevertChange{{/link-to}}</li> http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/hive-history.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/hive-history.hbs b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/hive-history.hbs index b43e49f..7a0fd6c 100644 --- a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/hive-history.hbs +++ b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/hive-history.hbs @@ -26,7 +26,7 @@ limitations under the License. </font> </div> <div class="col-sm-3"> - {{ember-selectize content=model.usersdetail optionValuePath="content.username" optionLabelPath="content.username" value=usernamehue placeholder="Select an userName" }} + {{ember-selectize content=model.usersdetail selection=model.selections optionValuePath="content.username" optionLabelPath="content.username" multiple=true add-value="addSelection" remove-value="removeSelection" placeholder="Select a User Name" }} </div> </div> <br> @@ -109,7 +109,7 @@ limitations under the License. <td>Total Time Taken</td><td>{{totalTimeTaken}}ms</td> </tr> <tr> - <td>Hue User Name(Source)</td> + <td>Hue Users</td> <td>{{Username}}</td> </tr> <tr> http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/hive-saved-query.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/hive-saved-query.hbs b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/hive-saved-query.hbs index c755446..3b285e7 100644 --- a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/hive-saved-query.hbs +++ b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/hive-saved-query.hbs @@ -26,7 +26,7 @@ limitations under the License. </font> </div> <div class="col-sm-3"> - {{ember-selectize content=model.usersdetail optionValuePath="content.username" optionLabelPath="content.username" value=usernamehue placeholder="Select an userName" }} + {{ember-selectize content=model.usersdetail selection=model.selections optionValuePath="content.username" optionLabelPath="content.username" multiple=true add-value="addSelection" remove-value="removeSelection" placeholder="Select an userName" }} </div> </div> <br> @@ -110,7 +110,7 @@ limitations under the License. <td>{{totalTimeTaken}}ms</td> </tr> <tr> - <td>Hue User Name(Source)</td> + <td>Hue Users</td> <td>{{Username}}</td> </tr> <tr> http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/pig-job.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/pig-job.hbs b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/pig-job.hbs index 4562ce3..b273995 100644 --- a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/pig-job.hbs +++ b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/pig-job.hbs @@ -26,7 +26,7 @@ limitations under the License. </font> </div> <div class="col-sm-3"> - {{ember-selectize content=model.usersdetail optionValuePath="content.username" optionLabelPath="content.username" value=usernamehue placeholder="Select an userName" }} + {{ember-selectize content=model.usersdetail selection=model.selections optionValuePath="content.username" optionLabelPath="content.username" multiple=true add-value="addSelection" remove-value="removeSelection" placeholder="Select an userName" }} </div> </div> <br> @@ -111,7 +111,7 @@ limitations under the License. <td>{{totalTimeTaken}}ms</td> </tr> <tr> - <td>Hue User Name(Source)</td> + <td>Hue Users</td> <td>{{Username}}</td> </tr> <tr> http://git-wip-us.apache.org/repos/asf/ambari/blob/672fdf06/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/pig-script.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/pig-script.hbs b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/pig-script.hbs index 425b6ea..d88ab21 100644 --- a/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/pig-script.hbs +++ b/contrib/views/hueambarimigration/src/main/resources/ui/hueambarimigration-view/app/templates/home-page/pig-script.hbs @@ -26,7 +26,7 @@ limitations under the License. </font> </div> <div class="col-sm-3"> - {{ember-selectize content=model.usersdetail optionValuePath="content.username" optionLabelPath="content.username" value=usernamehue placeholder="Select an userName" }} + {{ember-selectize content=model.usersdetail selection=model.selections optionValuePath="content.username" optionLabelPath="content.username" multiple=true add-value="addSelection" remove-value="removeSelection" placeholder="Select an userName" }} </div> </div> <br> @@ -111,7 +111,7 @@ limitations under the License. <td>{{totalTimeTaken}}ms</td> </tr> <tr> - <td>Hue User Name(Source)</td> + <td>Hue Users</td> <td>{{Username}}</td> </tr> <tr>
