You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2017/02/17 22:06:21 UTC
[22/50] [abbrv] ambari git commit: AMBARI-19823. If by any case
Migration Is hampered Then No message is shown in UI Hue-Ambari Migration
view. (Ishan Bhatt via gauravn7)
AMBARI-19823. If by any case Migration Is hampered Then No message is shown in UI Hue-Ambari Migration view. (Ishan Bhatt via gauravn7)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4aa0f623
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4aa0f623
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4aa0f623
Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 4aa0f6234e42b2328e2b0b3f435a1b13d27412a9
Parents: d4c1ace
Author: Gaurav Nagar <gr...@gmail.com>
Authored: Thu Feb 16 10:47:22 2017 +0530
Committer: Gaurav Nagar <gr...@gmail.com>
Committed: Thu Feb 16 10:47:22 2017 +0530
----------------------------------------------------------------------
.../HiveHistoryMigrationUtility.java | 26 +-
...HiveHistoryQueryMigrationImplementation.java | 2 +-
.../HiveSavedQueryMigrationImplementation.java | 4 +-
.../HiveSavedQueryMigrationUtility.java | 29 +-
.../pigjob/PigJobMigrationImplementation.java | 5 +-
.../pig/pigjob/PigJobMigrationUtility.java | 377 ++++++++++---------
.../PigScriptMigrationImplementation.java | 5 +-
.../pigscript/PigScriptMigrationUtility.java | 27 +-
.../pigudf/PigUdfMigrationImplementation.java | 5 +-
.../pig/pigudf/PigUdfMigrationUtility.java | 286 +++++++-------
.../scripts/models/MigrationResponse.java | 6 +
.../app/models/checkprogress.js | 3 +-
.../app/routes/home-page/hive-history.js | 7 +-
.../app/routes/home-page/hive-saved-query.js | 8 +-
.../app/routes/home-page/pig-job.js | 7 +-
.../app/routes/home-page/pig-script.js | 8 +-
.../app/routes/home-page/pig-udf.js | 8 +-
.../app/templates/home-page/hive-history.hbs | 8 +
.../templates/home-page/hive-saved-query.hbs | 8 +
.../app/templates/home-page/pig-job.hbs | 8 +
.../app/templates/home-page/pig-script.hbs | 8 +
.../app/templates/home-page/pig-udf.hbs | 187 ++++-----
22 files changed, 578 insertions(+), 454 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryMigrationUtility.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryMigrationUtility.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryMigrationUtility.java
index bab2084..7c3b2c2 100755
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryMigrationUtility.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryMigrationUtility.java
@@ -69,6 +69,7 @@ public class HiveHistoryMigrationUtility {
Connection connectionHuedb = null;
Connection connectionAmbaridb = null;
+
logger.info(System.getProperty("java.class.path"));
logger.info("--------------------------------------");
@@ -121,7 +122,7 @@ public class HiveHistoryMigrationUtility {
try {
String[] usernames = username.split(",");
int totalQueries = 0;
- for(int k=0; k<usernames.length; k++) {
+ 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();
username = usernames[k];
migrationresult.setProgressPercentage(0);
@@ -137,7 +138,7 @@ public class HiveHistoryMigrationUtility {
/* if No migration query selected from Hue Database according to our search criteria */
if (dbpojoHiveHistoryQuery.size() == 0) {
- logger.info("No queries has been selected for the user " + username + " between dates: " + startDate +" - "+endDate);
+ logger.info("No queries has been selected for the user " + username + " between dates: " + startDate + " - " + endDate);
} else {
/* If hive queries are selected based on our search criteria */
@@ -158,7 +159,7 @@ public class HiveHistoryMigrationUtility {
float calc = ((float) (i + 1)) / dbpojoHiveHistoryQuery.size() * 100;
int progressPercentage = Math.round(calc);
migrationresult.setProgressPercentage(progressPercentage);
- migrationresult.setNumberOfQueryTransfered(i+1);
+ migrationresult.setNumberOfQueryTransfered(i + 1);
getResourceManager(view).update(migrationresult, jobid);
logger.info("_____________________");
@@ -182,7 +183,7 @@ public class HiveHistoryMigrationUtility {
epochTime = hiveHistoryQueryImpl.getEpochTime();// getting system time as epoch format
- if(usernames[k].equals("all")) {
+ if (usernames[k].equals("all")) {
username = dbpojoHiveHistoryQuery.get(i).getOwnerName();
}
@@ -219,7 +220,7 @@ public class HiveHistoryMigrationUtility {
}
logger.info("Migration Completed");
migrationresult.setFlag(1);
- if(totalQueries==0) {
+ if (totalQueries == 0) {
migrationresult.setNumberOfQueryTransfered(0);
migrationresult.setTotalNoQuery(0);
} else {
@@ -230,30 +231,41 @@ public class HiveHistoryMigrationUtility {
getResourceManager(view).update(migrationresult, jobid);
} catch (SQLException e) {
logger.error("Sql exception in ambari database: ", e);
+ migrationresult.setError("SQL Exception: " + e.getMessage());
try {
connectionAmbaridb.rollback();
model.setIfSuccess(false);
logger.error("Sql statement are Rolledback");
} catch (SQLException e1) {
logger.error("Sql rollback exception in ambari database",
- e1);
+ e1);
}
} catch (ClassNotFoundException e) {
logger.error("Class not found :- ", e);
+ migrationresult.setError("Class Not Found: " + e.getMessage());
} catch (ParseException e) {
logger.error("Parse Exception : ", e);
+ migrationresult.setError("Parse Exception: " + e.getMessage());
} catch (URISyntaxException e) {
logger.error("URI Syntax Exception: ", e);
+ migrationresult.setError("URI Syntax Exception: " + e.getMessage());
} catch (PropertyVetoException e) {
logger.error("PropertyVetoException: ", e);
+ migrationresult.setError("Property Veto Exception: " + e.getMessage());
} catch (ItemNotFound itemNotFound) {
itemNotFound.printStackTrace();
+ migrationresult.setError("Item Not Found: " + itemNotFound.getMessage());
+ } catch (Exception e) {
+ logger.error("Generic Exception: ", e);
+ migrationresult.setError("Exception: " + e.getMessage());
} finally {
if (connectionAmbaridb != null) try {
connectionAmbaridb.close();
} catch (SQLException e) {
logger.error("Exception in closing the connection :", e);
+ migrationresult.setError("Exception in closing the connection: " + e.getMessage());
}
+ getResourceManager(view).update(migrationresult, jobid);
}
//deleteing the temprary files that are created while execution
hiveHistoryQueryImpl.deleteFileQueryhql(ConfigurationCheckImplementation.getHomeDir());
@@ -274,4 +286,4 @@ public class HiveHistoryMigrationUtility {
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryQueryMigrationImplementation.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryQueryMigrationImplementation.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryQueryMigrationImplementation.java
index 33d57b4..1a5b742 100644
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryQueryMigrationImplementation.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/historyquery/HiveHistoryQueryMigrationImplementation.java
@@ -260,7 +260,7 @@ public class HiveHistoryQueryMigrationImplementation {
}
- public ArrayList<HiveModel> fetchFromHue(String username, String startdate, String endtime, Connection connection, QuerySetHueDB huedatabase) throws ClassNotFoundException, SQLException {
+ public ArrayList<HiveModel> fetchFromHue(String username, String startdate, String endtime, Connection connection, QuerySetHueDB huedatabase) throws ClassNotFoundException, SQLException, IOException {
int id = 0;
int i = 0;
ArrayList<HiveModel> hiveArrayList = new ArrayList<HiveModel>();
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/savedquery/HiveSavedQueryMigrationImplementation.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/savedquery/HiveSavedQueryMigrationImplementation.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/savedquery/HiveSavedQueryMigrationImplementation.java
index c08455d..af493ba 100644
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/savedquery/HiveSavedQueryMigrationImplementation.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/savedquery/HiveSavedQueryMigrationImplementation.java
@@ -351,7 +351,7 @@ public class HiveSavedQueryMigrationImplementation {
}
public ArrayList<HiveModel> fetchFromHuedb(String username, String startdate, String endtime, Connection connection, QuerySetHueDb huedatabase)
- throws ClassNotFoundException, IOException {
+ throws ClassNotFoundException, SQLException, IOException {
int id = 0;
int i = 0;
String[] query = new String[100];
@@ -474,9 +474,11 @@ public class HiveSavedQueryMigrationImplementation {
hiveArrayList.add(hivepojo);
i++;
}
+ connection.commit();
} catch (SQLException e2) {
e2.printStackTrace();
+ connection.rollback();
} finally
{
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/savedquery/HiveSavedQueryMigrationUtility.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/savedquery/HiveSavedQueryMigrationUtility.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/savedquery/HiveSavedQueryMigrationUtility.java
index 5fc171c..ddfff5e 100644
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/savedquery/HiveSavedQueryMigrationUtility.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/hive/savedquery/HiveSavedQueryMigrationUtility.java
@@ -73,7 +73,7 @@ public class HiveSavedQueryMigrationUtility {
Connection connectionAmbaridb = null;
Connection connectionHuedb = null;
- int i = 0, j=0;
+ int i = 0, j = 0;
String sequenceName = "";
logger.info("-------------------------------------");
@@ -117,7 +117,7 @@ public class HiveSavedQueryMigrationUtility {
logger.info("Ambari database is Oracle");
}
- int maxCountforFileResourceAmbaridb=0, maxCountforUdfAmbaridb=0, maxCountforSavequeryAmbaridb = 0;
+ int maxCountforFileResourceAmbaridb = 0, maxCountforUdfAmbaridb = 0, maxCountforSavequeryAmbaridb = 0;
String time = null;
Long epochtime = null;
String dirNameforHiveSavedquery;
@@ -128,7 +128,7 @@ public class HiveSavedQueryMigrationUtility {
try {
String[] usernames = username.split(",");
int totalQueries = 0;
- for(int l=0; l<usernames.length; l++) {
+ for (int l = 0; l < usernames.length; l++) {
connectionHuedb = DataSourceHueDatabase.getInstance(view.getProperties().get("huedrivername"), view.getProperties().get("huejdbcurl"), view.getProperties().get("huedbusername"), view.getProperties().get("huedbpassword")).getConnection(); /* fetching connection to hue DB */
logger.info("Hue database connection successful");
@@ -148,7 +148,7 @@ public class HiveSavedQueryMigrationUtility {
if (dbpojoHiveSavedQuery.size() == 0) /* if no data has been fetched from hue db according to search criteria */ {
- logger.info("No queries has been selected for the user " + username + " between dates: " + startDate +" - "+endDate);
+ 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 */
@@ -191,7 +191,7 @@ public class HiveSavedQueryMigrationUtility {
time = hivesavedqueryimpl.getTime();/* getting system time */
- if(usernames[l].equals("all")) {
+ if (usernames[l].equals("all")) {
username = dbpojoHiveSavedQuery.get(i).getOwnerName();
}
@@ -251,7 +251,7 @@ public class HiveSavedQueryMigrationUtility {
}
logger.info("Migration Completed");
migrationresult.setFlag(1);
- if(totalQueries==0) {
+ if (totalQueries == 0) {
migrationresult.setNumberOfQueryTransfered(0);
migrationresult.setTotalNoQuery(0);
} else {
@@ -261,8 +261,8 @@ public class HiveSavedQueryMigrationUtility {
}
getResourceManager(view).update(migrationresult, jobid);
} catch (SQLException e) {
-
logger.error("SQL exception: ", e);
+ migrationresult.setError("SQL Exception: " + e.getMessage());
try {
connectionAmbaridb.rollback();
logger.info("roll back done");
@@ -272,19 +272,28 @@ public class HiveSavedQueryMigrationUtility {
}
} catch (ClassNotFoundException e1) {
logger.error("Class not found : ", e1);
+ migrationresult.setError("Class not found Exception: " + e1.getMessage());
} catch (ParseException e) {
logger.error("ParseException: ", e);
+ migrationresult.setError("Parse Exception: " + e.getMessage());
} catch (URISyntaxException e) {
logger.error("URISyntaxException: ", e);
+ migrationresult.setError("URI Syntax Exception: " + e.getMessage());
} catch (PropertyVetoException e) {
logger.error("PropertyVetoException:", e);
+ migrationresult.setError("Property Veto Exception: " + e.getMessage());
+ } catch (Exception e) {
+ logger.error("Generic Exception: ", e);
+ migrationresult.setError("Exception: " + e.getMessage());
} finally {
if (null != connectionAmbaridb)
try {
connectionAmbaridb.close();
} catch (SQLException e) {
logger.error("Error in connection close", e);
+ migrationresult.setError("Error in closing connection: " + e.getMessage());
}
+ getResourceManager(view).update(migrationresult, jobid);
}
@@ -308,8 +317,4 @@ public class HiveSavedQueryMigrationUtility {
return model;
}
-}
-
-
-
-
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigjob/PigJobMigrationImplementation.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigjob/PigJobMigrationImplementation.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigjob/PigJobMigrationImplementation.java
index 1cb0471..9767deb 100644
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigjob/PigJobMigrationImplementation.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigjob/PigJobMigrationImplementation.java
@@ -261,7 +261,7 @@ public class PigJobMigrationImplementation {
return strDate;
}
- public ArrayList<PigModel> fetchFromHueDB(String username, String startdate, String endtime, Connection connection, QuerySetHueDb huedatabase) throws ClassNotFoundException, IOException {
+ public ArrayList<PigModel> fetchFromHueDB(String username, String startdate, String endtime, Connection connection, QuerySetHueDb huedatabase) throws ClassNotFoundException, SQLException, IOException {
int id = 0;
int i = 0;
String[] query = new String[100];
@@ -359,10 +359,11 @@ public class PigJobMigrationImplementation {
i++;
}
-
+ connection.commit();
} catch (SQLException e) {
logger.error("Sqlexception: ", e);
+ connection.rollback();
} finally {
try {
if (connection != null)
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigjob/PigJobMigrationUtility.java
----------------------------------------------------------------------
diff --git a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigjob/PigJobMigrationUtility.java b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigjob/PigJobMigrationUtility.java
index 7bd36ea..b935bad 100644
--- a/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigjob/PigJobMigrationUtility.java
+++ b/contrib/views/hueambarimigration/src/main/java/org/apache/ambari/view/huetoambarimigration/migration/pig/pigjob/PigJobMigrationUtility.java
@@ -1,230 +1,239 @@
- /**
- * 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.pigjob;
-
- 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;
-
- import org.apache.ambari.view.ViewContext;
-
- 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.huetoambarimigration.datasource.DataSourceAmbariDatabase;
- import org.apache.ambari.view.huetoambarimigration.datasource.DataSourceHueDatabase;
- import org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.jobqueryset.*;
- import org.apache.ambari.view.huetoambarimigration.datasource.queryset.ambariqueryset.pig.jobqueryset.*;
-
- public class PigJobMigrationUtility {
-
- protected MigrationResourceManager resourceManager = null;
-
- public synchronized PersonalCRUDResourceManager<MigrationResponse> getResourceManager(ViewContext view) {
- if (resourceManager == null) {
- resourceManager = new MigrationResourceManager(view);
- }
- return resourceManager;
+/**
+ * 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.pigjob;
+
+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;
+
+import org.apache.ambari.view.ViewContext;
+
+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.huetoambarimigration.datasource.DataSourceAmbariDatabase;
+import org.apache.ambari.view.huetoambarimigration.datasource.DataSourceHueDatabase;
+import org.apache.ambari.view.huetoambarimigration.datasource.queryset.huequeryset.pig.jobqueryset.*;
+import org.apache.ambari.view.huetoambarimigration.datasource.queryset.ambariqueryset.pig.jobqueryset.*;
+
+public class PigJobMigrationUtility {
+
+ protected MigrationResourceManager resourceManager = null;
+
+ public synchronized PersonalCRUDResourceManager<MigrationResponse> getResourceManager(ViewContext view) {
+ if (resourceManager == null) {
+ resourceManager = new MigrationResourceManager(view);
}
+ return resourceManager;
+ }
- public void pigJobMigration(String username, String instance, String startDate, String endDate, ViewContext view, MigrationResponse migrationresult, String jobid) throws IOException, ItemNotFound {
+ public void pigJobMigration(String username, String instance, String startDate, String endDate, ViewContext view, MigrationResponse migrationresult, String jobid) throws IOException, ItemNotFound {
- long startTime = System.currentTimeMillis();
+ long startTime = System.currentTimeMillis();
- final Logger logger = Logger.getLogger(PigJobMigrationUtility.class);
- Connection connectionHuedb = null;
- Connection connectionAmbaridb = null;
+ final Logger logger = Logger.getLogger(PigJobMigrationUtility.class);
+ Connection connectionHuedb = null;
+ Connection connectionAmbaridb = null;
- logger.info("------------------------------");
- logger.info("pig Jobs Migration started");
- logger.info("------------------------------");
- logger.info("start date: " + startDate);
- logger.info("enddate date: " + endDate);
- logger.info("instance is: " + username);
- logger.info("hue username is : " + instance);
+ logger.info("------------------------------");
+ logger.info("pig Jobs Migration started");
+ logger.info("------------------------------");
+ logger.info("start date: " + startDate);
+ logger.info("enddate date: " + endDate);
+ logger.info("instance is: " + username);
+ logger.info("hue username is : " + instance);
- PigJobMigrationImplementation pigjobimpl = new PigJobMigrationImplementation();// creating the implementation object
+ PigJobMigrationImplementation pigjobimpl = new PigJobMigrationImplementation();// creating the implementation object
- QuerySetHueDb huedatabase = null;
+ QuerySetHueDb huedatabase = null;
- if (view.getProperties().get("huedrivername").contains("mysql")) {
- huedatabase = new MysqlQuerySetHueDb();
- } else if (view.getProperties().get("huedrivername").contains("postgresql")) {
- huedatabase = new PostgressQuerySetHueDb();
- } else if (view.getProperties().get("huedrivername").contains("sqlite")) {
- huedatabase = new SqliteQuerySetHueDb();
- } else if (view.getProperties().get("huedrivername").contains("oracle")) {
- huedatabase = new OracleQuerySetHueDb();
- }
+ if (view.getProperties().get("huedrivername").contains("mysql")) {
+ huedatabase = new MysqlQuerySetHueDb();
+ } else if (view.getProperties().get("huedrivername").contains("postgresql")) {
+ huedatabase = new PostgressQuerySetHueDb();
+ } else if (view.getProperties().get("huedrivername").contains("sqlite")) {
+ huedatabase = new SqliteQuerySetHueDb();
+ } else if (view.getProperties().get("huedrivername").contains("oracle")) {
+ huedatabase = new OracleQuerySetHueDb();
+ }
- QuerySetAmbariDB ambaridatabase = null;
+ 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 maxCountforPigScript = 0, i = 0;
+ 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 maxCountforPigScript = 0, i = 0;
- String time = null, timeIndorder = null;
- Long epochtime = null;
- String pigJobDirName;
- ArrayList<PigModel> pigJobDbPojo = new ArrayList<PigModel>();
+ String time = null, timeIndorder = null;
+ Long epochtime = null;
+ String pigJobDirName;
+ ArrayList<PigModel> pigJobDbPojo = new ArrayList<PigModel>();
- try {
+ try {
- String[] usernames = username.split(",");
- int totalQueries = 0;
- for(int k=0; k<usernames.length; k++) {
+ 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();//connecting to hue database
- username = usernames[k];
- migrationresult.setProgressPercentage(0);
- logger.info("Migration started for user " + username);
- pigJobDbPojo = pigjobimpl.fetchFromHueDB(username, startDate, endDate, connectionHuedb, huedatabase);// fetching the PigJobs details from hue
- totalQueries += pigJobDbPojo.size();
- for (int j = 0; j < pigJobDbPojo.size(); j++) {
- logger.info("the query fetched from hue=" + pigJobDbPojo.get(i).getScript());
+ connectionHuedb = DataSourceHueDatabase.getInstance(view.getProperties().get("huedrivername"), view.getProperties().get("huejdbcurl"), view.getProperties().get("huedbusername"), view.getProperties().get("huedbpassword")).getConnection();//connecting to hue database
+ username = usernames[k];
+ migrationresult.setProgressPercentage(0);
+ logger.info("Migration started for user " + username);
+ pigJobDbPojo = pigjobimpl.fetchFromHueDB(username, startDate, endDate, connectionHuedb, huedatabase);// fetching the PigJobs details from hue
+ totalQueries += pigJobDbPojo.size();
+ for (int j = 0; j < pigJobDbPojo.size(); j++) {
+ logger.info("the query fetched from hue=" + pigJobDbPojo.get(i).getScript());
- }
+ }
/*No pig Job details has been fetched accordring to search criteria*/
- if (pigJobDbPojo.size() == 0) {
+ if (pigJobDbPojo.size() == 0) {
- logger.info("No queries has been selected for the user " + username + " between dates: " + startDate +" - "+endDate);
- } else {
+ 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();
- connectionAmbaridb.setAutoCommit(false);
+ connectionAmbaridb = DataSourceAmbariDatabase.getInstance(view.getProperties().get("ambaridrivername"), view.getProperties().get("ambarijdbcurl"), view.getProperties().get("ambaridbusername"), view.getProperties().get("ambaridbpassword")).getConnection();
+ connectionAmbaridb.setAutoCommit(false);
- int fetchPigTablenameInstance = pigjobimpl.fetchInstanceTablename(connectionAmbaridb, instance, ambaridatabase);
- int sequence = pigjobimpl.fetchSequenceno(connectionAmbaridb, fetchPigTablenameInstance, ambaridatabase);
+ int fetchPigTablenameInstance = pigjobimpl.fetchInstanceTablename(connectionAmbaridb, instance, ambaridatabase);
+ int sequence = pigjobimpl.fetchSequenceno(connectionAmbaridb, fetchPigTablenameInstance, ambaridatabase);
- for (i = 0; i < pigJobDbPojo.size(); i++) {
+ for (i = 0; i < pigJobDbPojo.size(); i++) {
- float calc = ((float) (i + 1)) / pigJobDbPojo.size() * 100;
- int progressPercentage = Math.round(calc);
+ float calc = ((float) (i + 1)) / pigJobDbPojo.size() * 100;
+ int progressPercentage = Math.round(calc);
- migrationresult.setProgressPercentage(progressPercentage);
- migrationresult.setNumberOfQueryTransfered(i+1);
- getResourceManager(view).update(migrationresult, jobid);
+ 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 " + pigJobDbPojo.get(i).getTitle());
+ logger.info("Loop No." + (i + 1));
+ logger.info("________________");
+ logger.info("the title of script " + pigJobDbPojo.get(i).getTitle());
- maxCountforPigScript = i + sequence + 1;
+ maxCountforPigScript = i + sequence + 1;
- time = pigjobimpl.getTime();
- timeIndorder = pigjobimpl.getTimeInorder();
- epochtime = pigjobimpl.getEpochTime();
+ time = pigjobimpl.getTime();
+ timeIndorder = pigjobimpl.getTimeInorder();
+ epochtime = pigjobimpl.getEpochTime();
- if(usernames[k].equals("all")) {
- username = pigJobDbPojo.get(i).getUserName();
- }
+ if (usernames[k].equals("all")) {
+ username = pigJobDbPojo.get(i).getUserName();
+ }
- pigJobDirName = "/user/" + username + "/pig/jobs/" + pigJobDbPojo.get(i).getTitle() + "_" + time + "/";
+ pigJobDirName = "/user/" + username + "/pig/jobs/" + pigJobDbPojo.get(i).getTitle() + "_" + time + "/";
- pigjobimpl.insertRowPigJob(pigJobDirName, maxCountforPigScript, time, timeIndorder, epochtime, pigJobDbPojo.get(i).getTitle(), connectionAmbaridb, fetchPigTablenameInstance, pigJobDbPojo.get(i).getStatus(), instance, i, ambaridatabase, username);
+ pigjobimpl.insertRowPigJob(pigJobDirName, maxCountforPigScript, time, timeIndorder, epochtime, pigJobDbPojo.get(i).getTitle(), connectionAmbaridb, fetchPigTablenameInstance, pigJobDbPojo.get(i).getStatus(), instance, i, ambaridatabase, username);
- if (view.getProperties().get("KerberoseEnabled").equals("y")) {
- pigjobimpl.createDirPigJobSecured(pigJobDirName, view.getProperties().get("namenode_URI_Ambari"), username, view.getProperties().get("PrincipalUserName"));
- pigjobimpl.copyFileBetweenHdfsSecured(pigJobDbPojo.get(i).getDir() + "/script.pig", pigJobDirName, view.getProperties().get("namenode_URI_Ambari"), view.getProperties().get("namenode_URI_Hue"), username, view.getProperties().get("PrincipalUserName"));
- pigjobimpl.copyFileBetweenHdfsSecured(pigJobDbPojo.get(i).getDir() + "/stderr", pigJobDirName, view.getProperties().get("namenode_URI_Ambari"), view.getProperties().get("namenode_URI_Hue"), username, view.getProperties().get("PrincipalUserName"));
- pigjobimpl.copyFileBetweenHdfsSecured(pigJobDbPojo.get(i).getDir() + "/stdout", pigJobDirName, view.getProperties().get("namenode_URI_Ambari"), view.getProperties().get("namenode_URI_Hue"), username, view.getProperties().get("PrincipalUserName"));
+ if (view.getProperties().get("KerberoseEnabled").equals("y")) {
+ pigjobimpl.createDirPigJobSecured(pigJobDirName, view.getProperties().get("namenode_URI_Ambari"), username, view.getProperties().get("PrincipalUserName"));
+ pigjobimpl.copyFileBetweenHdfsSecured(pigJobDbPojo.get(i).getDir() + "/script.pig", pigJobDirName, view.getProperties().get("namenode_URI_Ambari"), view.getProperties().get("namenode_URI_Hue"), username, view.getProperties().get("PrincipalUserName"));
+ pigjobimpl.copyFileBetweenHdfsSecured(pigJobDbPojo.get(i).getDir() + "/stderr", pigJobDirName, view.getProperties().get("namenode_URI_Ambari"), view.getProperties().get("namenode_URI_Hue"), username, view.getProperties().get("PrincipalUserName"));
+ pigjobimpl.copyFileBetweenHdfsSecured(pigJobDbPojo.get(i).getDir() + "/stdout", pigJobDirName, view.getProperties().get("namenode_URI_Ambari"), view.getProperties().get("namenode_URI_Hue"), username, view.getProperties().get("PrincipalUserName"));
- } else {
+ } else {
- pigjobimpl.createDirPigJob(pigJobDirName, view.getProperties().get("namenode_URI_Ambari"), username);
- pigjobimpl.copyFileBetweenHdfs(pigJobDbPojo.get(i).getDir() + "/script.pig", pigJobDirName, view.getProperties().get("namenode_URI_Ambari"), view.getProperties().get("namenode_URI_Hue"), username);
- pigjobimpl.copyFileBetweenHdfs(pigJobDbPojo.get(i).getDir() + "/stderr", pigJobDirName, view.getProperties().get("namenode_URI_Ambari"), view.getProperties().get("namenode_URI_Hue"), username);
- pigjobimpl.copyFileBetweenHdfs(pigJobDbPojo.get(i).getDir() + "/stdout", pigJobDirName, view.getProperties().get("namenode_URI_Ambari"), view.getProperties().get("namenode_URI_Hue"), username);
+ pigjobimpl.createDirPigJob(pigJobDirName, view.getProperties().get("namenode_URI_Ambari"), username);
+ pigjobimpl.copyFileBetweenHdfs(pigJobDbPojo.get(i).getDir() + "/script.pig", pigJobDirName, view.getProperties().get("namenode_URI_Ambari"), view.getProperties().get("namenode_URI_Hue"), username);
+ pigjobimpl.copyFileBetweenHdfs(pigJobDbPojo.get(i).getDir() + "/stderr", pigJobDirName, view.getProperties().get("namenode_URI_Ambari"), view.getProperties().get("namenode_URI_Hue"), username);
+ pigjobimpl.copyFileBetweenHdfs(pigJobDbPojo.get(i).getDir() + "/stdout", pigJobDirName, view.getProperties().get("namenode_URI_Ambari"), view.getProperties().get("namenode_URI_Hue"), username);
- }
+ }
- logger.info(pigJobDbPojo.get(i).getTitle() + "has been migrated to Ambari");
+ logger.info(pigJobDbPojo.get(i).getTitle() + "has been migrated to Ambari");
- }
- pigjobimpl.updateSequenceno(connectionAmbaridb, maxCountforPigScript, fetchPigTablenameInstance, ambaridatabase);
- connectionAmbaridb.commit();
}
- logger.info("Migration completed for user " + username);
+ pigjobimpl.updateSequenceno(connectionAmbaridb, maxCountforPigScript, fetchPigTablenameInstance, ambaridatabase);
+ connectionAmbaridb.commit();
}
- 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);
+ 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);
+ migrationresult.setError("SQL Exception: " + e.getMessage());
+ try {
+ connectionAmbaridb.rollback();
+ logger.info("roll back done");
+ } catch (SQLException e1) {
+ logger.error("roll back exception:", e1);
+ }
+ } catch (ClassNotFoundException e2) {
+ logger.error("class not found exception:", e2);
+ migrationresult.setError("Class Not Found Exception: " + e2.getMessage());
+ } catch (ParseException e) {
+ logger.error("ParseException: ", e);
+ migrationresult.setError("ParseException: " + e.getMessage());
+ } catch (URISyntaxException e) {
+ logger.error("URISyntaxException", e);
+ migrationresult.setError("URI Syntax Exception: " + e.getMessage());
+ } catch (PropertyVetoException e) {
+ logger.error("PropertyVetoException", e);
+ migrationresult.setError("Property Veto Exception: " + e.getMessage());
+ } catch (Exception e) {
+ logger.error("Generic Exception: ", e);
+ migrationresult.setError("Exception: " + e.getMessage());
+ } finally {
+ if (null != connectionAmbaridb)
try {
- connectionAmbaridb.rollback();
- logger.info("roll back done");
- } catch (SQLException e1) {
- logger.error("roll back exception:", e1);
+ connectionAmbaridb.close();
+ } catch (SQLException e) {
+ logger.error("connection closing exception ", e);
+ migrationresult.setError("Error closing connection: " + e.getMessage());
}
- } catch (ClassNotFoundException e2) {
- logger.error("class not found exception:", e2);
- } catch (ParseException e) {
- logger.error("ParseException: ", e);
- } catch (URISyntaxException e) {
- logger.error("URISyntaxException", e);
- } catch (PropertyVetoException e) {
- logger.error("PropertyVetoException", e);
- } finally {
- if (null != connectionAmbaridb)
- try {
- connectionAmbaridb.close();
- } catch (SQLException e) {
- logger.error("connection closing exception ", e);
- }
- }
-
- logger.info("------------------------------");
- logger.info("pig Job Migration End");
- logger.info("------------------------------");
+ getResourceManager(view).update(migrationresult, jobid);
+ }
- long stopTime = System.currentTimeMillis();
- long elapsedTime = stopTime - startTime;
+ logger.info("------------------------------");
+ logger.info("pig Job Migration End");
+ logger.info("------------------------------");
- migrationresult.setJobtype("hivehistoryquerymigration");
- migrationresult.setTotalTimeTaken(String.valueOf(elapsedTime));
- getResourceManager(view).update(migrationresult, jobid);
+ long stopTime = System.currentTimeMillis();
+ long elapsedTime = stopTime - startTime;
+ migrationresult.setJobtype("pigjobmigration");
+ migrationresult.setTotalTimeTaken(String.valueOf(elapsedTime));
+ getResourceManager(view).update(migrationresult, jobid);
- }
}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/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 82461ca..1325a45 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
@@ -287,7 +287,7 @@ public class PigScriptMigrationImplementation {
}
- public ArrayList<PigModel> fetchFromHueDatabase(String username, String startdate, String endtime, Connection connection, QuerySetHueDb huedatabase) throws ClassNotFoundException, IOException {
+ public ArrayList<PigModel> fetchFromHueDatabase(String username, String startdate, String endtime, Connection connection, QuerySetHueDb huedatabase) throws ClassNotFoundException, SQLException, IOException {
int id = 0;
int i = 0;
ResultSet rs1 = null;
@@ -370,10 +370,11 @@ public class PigScriptMigrationImplementation {
pigArrayList.add(pojopig);
i++;
}
-
+ connection.commit();
} catch (SQLException e) {
logger.error("SQLException", e);
+ connection.rollback();
} finally {
try {
if (connection != null)
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/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 5e9f0d1..8ed13fb 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
@@ -110,7 +110,7 @@ public class PigScriptMigrationUtility {
try {
String[] usernames = username.split(",");
int totalQueries = 0;
- for(int k=0; k<usernames.length; k++) {
+ 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);
@@ -128,7 +128,7 @@ public class PigScriptMigrationUtility {
/* If No pig Script has been fetched from Hue db according to our search criteria*/
if (dbpojoPigSavedscript.size() == 0) {
- logger.info("No queries has been selected for the user " + username + " between dates: " + startDate +" - "+endDate);
+ 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
@@ -148,7 +148,7 @@ public class PigScriptMigrationUtility {
float calc = ((float) (i + 1)) / dbpojoPigSavedscript.size() * 100;
int progressPercentage = Math.round(calc);
migrationresult.setProgressPercentage(progressPercentage);
- migrationresult.setNumberOfQueryTransfered(i+1);
+ migrationresult.setNumberOfQueryTransfered(i + 1);
getResourceManager(view).update(migrationresult, jobid);
logger.info("Loop No." + (i + 1));
@@ -163,7 +163,7 @@ public class PigScriptMigrationUtility {
maxcountforpigsavedscript = i + sequence + 1;
- if(usernames[k].equals("all")) {
+ if (usernames[k].equals("all")) {
username = dbpojoPigSavedscript.get(i).getUserName();
}
@@ -200,7 +200,7 @@ public class PigScriptMigrationUtility {
}
logger.info("Migration Completed");
migrationresult.setFlag(1);
- if(totalQueries==0) {
+ if (totalQueries == 0) {
migrationresult.setNumberOfQueryTransfered(0);
migrationresult.setTotalNoQuery(0);
} else {
@@ -211,34 +211,44 @@ public class PigScriptMigrationUtility {
getResourceManager(view).update(migrationresult, jobid);
} catch (SQLException e) {
logger.error("Sql exception in ambari database", e);
+ migrationresult.setError("SQL Exception: " + e.getMessage());
try {
connectionAmbaridb.rollback();
logger.info("rollback done");
} catch (SQLException e1) {
- logger.error("Sql exception while doing roll back", e);
+ logger.error("Sql exception while doing roll back", e1);
}
} catch (ClassNotFoundException e2) {
logger.error("class not found exception", e2);
+ migrationresult.setError("Class Not Found Exception: " + e2.getMessage());
} catch (ParseException e) {
logger.error("ParseException: ", e);
+ migrationresult.setError("Parse Exception: " + e.getMessage());
} catch (PropertyVetoException e) {
logger.error("PropertyVetoException: ", e);
+ migrationresult.setError("Property Veto Exception: " + e.getMessage());
} catch (URISyntaxException e) {
e.printStackTrace();
+ migrationresult.setError("URISyntaxException: " + e.getMessage());
+ } catch (Exception e) {
+ logger.error("Generic Exception: ", e);
+ migrationresult.setError("Exception: " + e.getMessage());
} finally {
if (null != connectionAmbaridb)
try {
connectionAmbaridb.close();
} catch (SQLException e) {
logger.error("connection close exception: ", e);
+ migrationresult.setError("Error Closing Connection: " + e.getMessage());
}
+ getResourceManager(view).update(migrationresult, jobid);
}
long stopTime = System.currentTimeMillis();
long elapsedTime = stopTime - startTime;
- migrationresult.setJobtype("hivehistoryquerymigration");
+ migrationresult.setJobtype("pigsavedscriptmigration");
migrationresult.setTotalTimeTaken(String.valueOf(elapsedTime));
getResourceManager(view).update(migrationresult, jobid);
@@ -249,5 +259,4 @@ public class PigScriptMigrationUtility {
}
-
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/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
index a7728a8..351d5e1 100644
--- 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
@@ -125,7 +125,7 @@ public class PigUdfMigrationImplementation {
}
- public ArrayList<PigModel> fetchFromHueDatabase(String username, Connection connection, QuerySet huedatabase) throws ClassNotFoundException, IOException {
+ public ArrayList<PigModel> fetchFromHueDatabase(String username, Connection connection, QuerySet huedatabase) throws ClassNotFoundException, SQLException, IOException {
int id = 0;
int i = 0;
ResultSet rs1;
@@ -178,10 +178,11 @@ public class PigUdfMigrationImplementation {
pigArrayList.add(pojopig);
i++;
}
-
+ connection.commit();
} catch (SQLException e) {
logger.error("SQLException", e);
+ connection.rollback();
} finally {
try {
if (connection != null)
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/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
index d6a69fc..9656ad6 100644
--- 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
@@ -45,191 +45,199 @@ import java.util.ArrayList;
public class PigUdfMigrationUtility {
- protected MigrationResourceManager resourceManager = null;
+ protected MigrationResourceManager resourceManager = null;
- public synchronized PersonalCRUDResourceManager<MigrationResponse> getResourceManager(ViewContext view) {
- if (resourceManager == null) {
- resourceManager = new MigrationResourceManager(view);
- }
- return resourceManager;
+ 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;
+ public void pigUdfMigration(String username, String instance, ViewContext view, MigrationResponse migrationresult, String jobid) throws IOException, ItemNotFound {
- logger.info("-------------------------------------");
- logger.info("pig udf Migration started");
- logger.info("-------------------------------------");
+ long startTime = System.currentTimeMillis();
+ final Logger logger = Logger.getLogger(PigUdfMigrationUtility.class);
+ Connection connectionHuedb = null;
+ Connection connectionAmbaridb = null;
- int i = 0;
-
- logger.info("instance is: " + username);
- logger.info("hue username is : " + instance);
+ logger.info("-------------------------------------");
+ logger.info("pig udf Migration started");
+ logger.info("-------------------------------------");
- //Reading the configuration file
- PigUdfMigrationImplementation pigudfmigration = new PigUdfMigrationImplementation();
- QuerySet huedatabase = null;
+ int i = 0;
- 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")) {
+ logger.info("instance is: " + username);
+ logger.info("hue username is : " + instance);
- huedatabase = new SqliteQuerySet();
- } else if (view.getProperties().get("huedrivername").contains("oracle")) {
- huedatabase = new OracleQuerySet();
- }
+ //Reading the configuration file
+ PigUdfMigrationImplementation pigudfmigration = new PigUdfMigrationImplementation();
- QuerySetAmbariDB ambaridatabase = null;
+ 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")) {
- 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();
- }
+ huedatabase = new SqliteQuerySet();
+ } else if (view.getProperties().get("huedrivername").contains("oracle")) {
+ huedatabase = new OracleQuerySet();
+ }
- int maxcountforpigudf = 0;
- String dirNameForPigUdf = "";
- int pigInstanceTableId, sequence;
+ QuerySetAmbariDB ambaridatabase = null;
- 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();
+ 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();
+ }
- for (int j = 0; j < dbpojoPigUdf.size(); j++) {
- logger.info("jar fetched from hue=" + dbpojoPigUdf.get(j).getFileName());
+ 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();
- /* If No pig Script has been fetched from Hue db according to our search criteria*/
- if (dbpojoPigUdf.size() == 0) {
+ for (int j = 0; j < dbpojoPigUdf.size(); j++) {
+ logger.info("jar fetched from hue=" + dbpojoPigUdf.get(j).getFileName());
- 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");
+ /* If No pig Script has been fetched from Hue db according to our search criteria*/
+ if (dbpojoPigUdf.size() == 0) {
- //for each pig udf found in Hue Database
+ logger.info("No queries has been selected for the user " + username);
+ } else {
- pigInstanceTableId = pigudfmigration.fetchInstanceTablenamePigUdf(connectionAmbaridb, instance, ambaridatabase);// finding the table name in ambari from the given instance
+ 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);
- sequence = pigudfmigration.fetchSequenceno(connectionAmbaridb, pigInstanceTableId, ambaridatabase);
+ logger.info("loop will continue for " + dbpojoPigUdf.size() + "times");
- for (i = 0; i < dbpojoPigUdf.size(); i++) {
+ //for each pig udf found in Hue Database
+ pigInstanceTableId = pigudfmigration.fetchInstanceTablenamePigUdf(connectionAmbaridb, instance, ambaridatabase);// finding the table name in ambari from the given instance
- 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);
+ sequence = pigudfmigration.fetchSequenceno(connectionAmbaridb, pigInstanceTableId, ambaridatabase);
- logger.info("Loop No." + (i + 1));
- logger.info("________________");
- logger.info("jar name: " + dbpojoPigUdf.get(i).getFileName());
+ for (i = 0; i < dbpojoPigUdf.size(); i++) {
- maxcountforpigudf = i + sequence + 1;
+ 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);
- 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;
+ logger.info("Loop No." + (i + 1));
+ logger.info("________________");
+ logger.info("jar name: " + dbpojoPigUdf.get(i).getFileName());
- 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);
- }
+ maxcountforpigudf = i + sequence + 1;
- 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);
+ 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();
}
- migrationresult.setFlag(1);
- if(totalQueries==0) {
- migrationresult.setNumberOfQueryTransfered(0);
- migrationresult.setTotalNoQuery(0);
+ 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 {
- migrationresult.setNumberOfQueryTransfered(totalQueries);
- migrationresult.setTotalNoQuery(totalQueries);
- migrationresult.setProgressPercentage(100);
+ pigudfmigration.createDirPigUdf(dirNameForPigUdf, ambariNameNodeUri, ownerName);
+ pigudfmigration.copyFileBetweenHdfs(filePath, dirNameForPigUdf, ambariNameNodeUri, ownerName);
}
- getResourceManager(view).update(migrationresult, jobid);
+
+ 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);
+ migrationresult.setError("SQL Exception: " + e.getMessage());
+ try {
+ connectionAmbaridb.rollback();
+ logger.info("rollback done");
+ } catch (SQLException e1) {
+ logger.error("Sql exception while doing roll back", e1);
+ }
+ } catch (ClassNotFoundException e2) {
+ logger.error("class not found exception", e2);
+ migrationresult.setError("Class Not Found Exception: " + e2.getMessage());
+ } catch (PropertyVetoException e) {
+ logger.error("PropertyVetoException: ", e);
+ migrationresult.setError("Property Veto Exception: " + e.getMessage());
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ migrationresult.setError("URI Syntax Exception: " + e.getMessage());
+ } catch (Exception e) {
+ logger.error("Generic Exception: ", e);
+ migrationresult.setError("Exception: " + e.getMessage());
+ } finally {
+ if (null != connectionAmbaridb)
+ try {
+ connectionAmbaridb.close();
} 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);
- }
+ logger.error("connection close exception: ", e);
+ migrationresult.setError("Error in closing connection: " + e.getMessage());
}
+ getResourceManager(view).update(migrationresult, jobid);
+ }
- long stopTime = System.currentTimeMillis();
- long elapsedTime = stopTime - startTime;
+ long stopTime = System.currentTimeMillis();
+ long elapsedTime = stopTime - startTime;
- migrationresult.setJobtype("hivehistoryquerymigration");
- migrationresult.setTotalTimeTaken(String.valueOf(elapsedTime));
- getResourceManager(view).update(migrationresult, jobid);
+ migrationresult.setJobtype("pigudfmigration");
+ migrationresult.setTotalTimeTaken(String.valueOf(elapsedTime));
+ getResourceManager(view).update(migrationresult, jobid);
- logger.info("----------------------------------");
- logger.info("pig udf Migration ends");
- logger.info("----------------------------------");
+ logger.info("----------------------------------");
+ logger.info("pig udf Migration ends");
+ logger.info("----------------------------------");
- }
+ }
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/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 3581149..612f73b 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
@@ -45,6 +45,7 @@ public class MigrationResponse implements Serializable,PersonalResource{
private String jobtype="";
private String isNoQuerySelected="";
private int flag;
+ private String error;
public String getTotalTimeTaken() {
return totalTimeTaken;
@@ -144,4 +145,9 @@ public class MigrationResponse implements Serializable,PersonalResource{
public int getFlag() { return flag; }
public void setFlag(int flag) { this.flag = flag; }
+
+ public String getError() { return error; }
+
+ public void setError(String error) { this.error = error; }
+
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/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 a65e367..877be99 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
@@ -27,5 +27,6 @@ export default Model.extend({
totalTimeTaken: DS.attr('string'),
jobtype: DS.attr('string'),
isNoQuerySelected: DS.attr('string'),
- flag: DS.attr('string')
+ flag: DS.attr('string'),
+ error: DS.attr('string')
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/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 52716f2..746049d 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
@@ -97,10 +97,15 @@ export default Ember.Route.extend({
var progressPercentage = progress.get('progressPercentage');
var numberOfQueryTransfered = progress.get('numberOfQueryTransfered');
var flagForCompletion = parseInt(progress.get('flag'));
+ var error = progress.get('error');
console.log("the progress percentage is="+progressPercentage);
console.log("flag status is "+flagForCompletion);
+ console.log("error is "+error);
+ if(error) {
+ control.set('error', error);
+ control.set('jobstatus', null);
- if (flagForCompletion === 1) {
+ } else if (flagForCompletion === 1) {
var totalNoQuery = progress.get('totalNoQuery');
var intanceName = progress.get('intanceName');
var userNameofhue = progress.get('userNameofhue');
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/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 ed90469..43653e7 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
@@ -92,9 +92,15 @@ export default Ember.Route.extend({
var progressPercentage = progress.get('progressPercentage');
var numberOfQueryTransfered = progress.get('numberOfQueryTransfered');
var flagForCompletion = parseInt(progress.get('flag'));
+ var error = progress.get('error');
console.log("the progress percentage is="+progressPercentage);
+ console.log("flag status is "+flagForCompletion);
+ console.log("error is "+error);
+ if(error) {
+ control.set('error', error);
+ control.set('jobstatus', null);
- if (flagForCompletion === 1) {
+ } else if (flagForCompletion === 1) {
var totalNoQuery = progress.get('totalNoQuery');
var intanceName = progress.get('intanceName');
var userNameofhue = progress.get('userNameofhue');
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/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 225f7ee..a5409da 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
@@ -94,10 +94,15 @@ export default Ember.Route.extend({
var progressPercentage = progress.get('progressPercentage');
var numberOfQueryTransfered = progress.get('numberOfQueryTransfered');
var flagForCompletion = parseInt(progress.get('flag'));
+ var error = progress.get('error');
console.log("the progress percentage is="+progressPercentage);
console.log("flag completion status is "+flagForCompletion);
+ console.log("error is "+error);
+ if(error) {
+ control.set('error', error);
+ control.set('jobstatus', null);
- if (flagForCompletion === 1) {
+ } else if (flagForCompletion === 1) {
var totalNoQuery = progress.get('totalNoQuery');
var intanceName = progress.get('intanceName');
var userNameofhue = progress.get('userNameofhue');
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/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 cc6c631..b1fa481 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
@@ -94,9 +94,15 @@ export default Ember.Route.extend({
var progressPercentage = progress.get('progressPercentage');
var numberOfQueryTransfered = progress.get('numberOfQueryTransfered');
var flagForCompletion = parseInt(progress.get('flag'));
+ var error = progress.get('error');
console.log("the progress percentage is="+progressPercentage);
+ console.log("flag status is "+flagForCompletion);
+ console.log("error is "+error);
+ if(error) {
+ control.set('error', error);
+ control.set('jobstatus', null);
- if (flagForCompletion === 1) {
+ } else if (flagForCompletion === 1) {
var totalNoQuery = progress.get('totalNoQuery');
var intanceName = progress.get('intanceName');
var userNameofhue = progress.get('userNameofhue');
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/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
index 83e316f..0894702 100644
--- 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
@@ -90,9 +90,15 @@ export default Ember.Route.extend({
var progressPercentage = progress.get('progressPercentage');
var numberOfQueryTransfered = progress.get('numberOfQueryTransfered');
var flagForCompletion = parseInt(progress.get('flag'));
+ var error = progress.get('error');
console.log("the progress percentage is="+progressPercentage);
+ console.log("flag status is "+flagForCompletion);
+ console.log("error is "+error);
+ if(error) {
+ control.set('error', error);
+ control.set('jobstatus', null);
- if (flagForCompletion === 1) {
+ } else if (flagForCompletion === 1) {
var totalNoQuery = progress.get('totalNoQuery');
var intanceName = progress.get('intanceName');
var userNameofhue = progress.get('userNameofhue');
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/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 7a0fd6c..4b63d68 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
@@ -86,6 +86,14 @@ limitations under the License.
</div>
<div class="row">
<div class="col-sm-9">
+ {{#if error}}
+ <h3>Error Occured during migration</h3>
+ <p><span class="alert-danger">{{error}}</span></p>
+ {{/if}}
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-sm-9">
{{#if completionStatus}}
<h2>Migration Report
</h2>
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/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 3b285e7..28963aa 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
@@ -86,6 +86,14 @@ limitations under the License.
</div>
<div class="row">
<div class="col-sm-9">
+ {{#if error}}
+ <h3>Error Occured during migration</h3>
+ <p><span class="alert-danger">{{error}}</span></p>
+ {{/if}}
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-sm-9">
{{#if completionStatus}}
<h2>Migration Report
</h2>
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/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 b273995..1f5cce0 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
@@ -87,6 +87,14 @@ limitations under the License.
</div>
<div class="row">
<div class="col-sm-9">
+ {{#if error}}
+ <h3>Error Occured during migration</h3>
+ <p><span class="alert-danger">{{error}}</span></p>
+ {{/if}}
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-sm-9">
{{#if completionStatus}}
<h2>Migration Report
</h2>
http://git-wip-us.apache.org/repos/asf/ambari/blob/4aa0f623/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 d88ab21..113ad6e 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
@@ -87,6 +87,14 @@ limitations under the License.
</div>
<div class="row">
<div class="col-sm-9">
+ {{#if error}}
+ <h3>Error Occured during migration</h3>
+ <p><span class="alert-danger">{{error}}</span></p>
+ {{/if}}
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-sm-9">
{{#if completionStatus}}
<h2>Migration Report
</h2>