You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2014/08/14 15:19:41 UTC
[1/6] git commit: AMBARI-6859. Set HDP-UTILS 1.1.0.19 as a default
repo for Ubuntu (aonishuk)
Repository: ambari
Updated Branches:
refs/heads/branch-alerts-dev 45d4e599e -> 97775af0b
AMBARI-6859. Set HDP-UTILS 1.1.0.19 as a default repo for Ubuntu (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/97775af0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/97775af0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/97775af0
Branch: refs/heads/branch-alerts-dev
Commit: 97775af0b01ca44dc93c2350907f98cca750641f
Parents: 6eb753d
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Thu Aug 14 14:56:09 2014 +0300
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Thu Aug 14 09:19:16 2014 -0400
----------------------------------------------------------------------
.../src/main/resources/stacks/HDP/2.1/repos/repoinfo.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/97775af0/ambari-server/src/main/resources/stacks/HDP/2.1/repos/repoinfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/repos/repoinfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.1/repos/repoinfo.xml
index c7852d6..14babae 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.1/repos/repoinfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.1/repos/repoinfo.xml
@@ -60,8 +60,8 @@
<reponame>HDP</reponame>
</repo>
<repo>
- <baseurl>http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.18/repos/ubuntu12</baseurl>
- <repoid>HDP-UTILS-1.1.0.18</repoid>
+ <baseurl>http://dev.hortonworks.com.s3.amazonaws.com/HDP-UTILS-1.1.0.19/repos/ubuntu12</baseurl>
+ <repoid>HDP-UTILS-1.1.0.19</repoid>
<reponame>HDP-UTILS</reponame>
</repo>
</os>
[2/6] git commit: AMBARI-6811. API needs to expose a way to set
"notes" when creating a new service config. (mpapirkovskyy)
Posted by jo...@apache.org.
AMBARI-6811. API needs to expose a way to set "notes" when creating a new service config. (mpapirkovskyy)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/16d80930
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/16d80930
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/16d80930
Branch: refs/heads/branch-alerts-dev
Commit: 16d80930035e8752c7c05535d403c222f29822d4
Parents: 8c537a1
Author: Myroslav Papirkovskyy <mp...@hortonworks.com>
Authored: Thu Aug 14 10:15:42 2014 +0300
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Thu Aug 14 09:19:16 2014 -0400
----------------------------------------------------------------------
.../AmbariManagementControllerImpl.java | 5 ++-
.../server/controller/ConfigurationRequest.java | 9 ++++
.../controller/ServiceConfigVersionRequest.java | 8 ++++
.../ServiceConfigVersionResponse.java | 11 +++++
.../internal/AbstractResourceProvider.java | 3 ++
.../internal/ClusterResourceProvider.java | 11 +++--
.../ServiceConfigVersionResourceProvider.java | 5 ++-
.../ServiceConfigApplicationEntity.java | 12 ++++++
.../org/apache/ambari/server/state/Cluster.java | 14 ++++++-
.../server/state/cluster/ClusterImpl.java | 43 +++++++++++---------
.../main/resources/Ambari-DDL-MySQL-CREATE.sql | 2 +-
.../main/resources/Ambari-DDL-Oracle-CREATE.sql | 2 +-
.../resources/Ambari-DDL-Postgres-CREATE.sql | 2 +-
.../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql | 2 +-
.../src/main/resources/properties.json | 3 +-
15 files changed, 101 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/16d80930/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 2a9ea73..9cf5de9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -1173,7 +1173,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
Config baseConfig = cluster.getConfig(cr.getType(), cr.getVersionTag());
if (null != baseConfig) {
String authName = getAuthName();
- serviceConfigVersionResponse = cluster.addDesiredConfig(authName, baseConfig);
+ serviceConfigVersionResponse = cluster.addDesiredConfig(authName, baseConfig, cr.getServiceConfigVersionNote());
if (serviceConfigVersionResponse != null) {
Logger logger = LoggerFactory.getLogger("configchange");
logger.info("cluster '" + request.getClusterName() + "' "
@@ -1249,7 +1249,8 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
}
cluster.setServiceConfigVersion(serviceConfigVersionRequest.getServiceName(),
- serviceConfigVersionRequest.getVersion(), getAuthName());
+ serviceConfigVersionRequest.getVersion(), getAuthName(),
+ serviceConfigVersionRequest.getNote());
}
if (serviceConfigVersionResponse != null) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/16d80930/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
index 7c56eb5..0e28a86 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
@@ -31,6 +31,7 @@ public class ConfigurationRequest {
private String type;
private String tag;
private Long version;
+ private String serviceConfigVersionNote;
private Map<String, String> configs;
private boolean selected = true;
private Map<String, Map<String, String>> configsAttributes;
@@ -166,4 +167,12 @@ public class ConfigurationRequest {
public void setVersion(Long version) {
this.version = version;
}
+
+ public String getServiceConfigVersionNote() {
+ return serviceConfigVersionNote;
+ }
+
+ public void setServiceConfigVersionNote(String serviceConfigVersionNote) {
+ this.serviceConfigVersionNote = serviceConfigVersionNote;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/16d80930/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionRequest.java
index 4784970..3d51468 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionRequest.java
@@ -25,6 +25,7 @@ public class ServiceConfigVersionRequest {
private Long createTime;
private Long applyTime;
private String userName;
+ private String note;
public ServiceConfigVersionRequest() {
}
@@ -86,4 +87,11 @@ public class ServiceConfigVersionRequest {
this.clusterName = clusterName;
}
+ public String getNote() {
+ return note;
+ }
+
+ public void setNote(String note) {
+ this.note = note;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/16d80930/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
index 765e765..491f112 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
@@ -32,6 +32,7 @@ public class ServiceConfigVersionResponse {
private Long createTime;
private Long applyTime;
private String userName;
+ private String note;
private List<ConfigurationResponse> configurations;
@JsonProperty("service_name")
@@ -100,5 +101,15 @@ public class ServiceConfigVersionResponse {
public void setConfigurations(List<ConfigurationResponse> configurations) {
this.configurations = configurations;
}
+
+ @JsonProperty("service_config_version_note")
+ @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+ public String getNote() {
+ return note;
+ }
+
+ public void setNote(String note) {
+ this.note = note;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/16d80930/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java
index 53e683c..a881730 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java
@@ -363,6 +363,9 @@ public abstract class AbstractResourceProvider extends BaseProvider implements R
else if (propName.equals("selected")) {
config.setSelected(Boolean.parseBoolean(entry.getValue().toString()));
}
+ else if (propName.equals("service_config_version_note")) {
+ config.setServiceConfigVersionNote(entry.getValue().toString());
+ }
else if (absCategory.endsWith("/properties")) {
config.getProperties().put(propName, entry.getValue().toString());
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/16d80930/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
index 64cdb4d..b0e2dd4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
@@ -225,9 +225,11 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
Resource resource = new ResourceImpl(Resource.Type.ServiceConfigVersion);
ServiceConfigVersionResponse serviceConfigVersionResponse = stringServiceConfigVersionResponseEntry.getValue();
resource.setProperty(ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_SERVICE_NAME_PROPERTY_ID,
- serviceConfigVersionResponse.getServiceName());
+ serviceConfigVersionResponse.getServiceName());
resource.setProperty(ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_PROPERTY_ID,
- serviceConfigVersionResponse.getVersion());
+ serviceConfigVersionResponse.getVersion());
+ resource.setProperty(ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_NOTE_PROPERTY_ID,
+ serviceConfigVersionResponse.getNote());
if (serviceConfigVersionResponse.getConfigurations() != null) {
resource.setProperty(
ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_CONFIGURATIONS_PROPERTY_ID,
@@ -349,6 +351,9 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
serviceConfigVersionRequest.setServiceName(entry.getValue().toString());
else if (propName.equals("serviceconfigversion"))
serviceConfigVersionRequest.setVersion(Long.valueOf(entry.getValue().toString()));
+ else if (propName.equals("service_config_version_note")) {
+ serviceConfigVersionRequest.setNote(entry.getValue().toString());
+ }
}
}
@@ -698,7 +703,7 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
}
}
getManagementController().updateClusters(
- Collections.singleton(getRequest(clusterProperties)), null);
+ Collections.singleton(getRequest(clusterProperties)), null);
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/16d80930/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
index a265e73..581ed54 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
@@ -38,6 +38,7 @@ public class ServiceConfigVersionResourceProvider extends
public static final String SERVICE_CONFIG_VERSION_CREATE_TIME_PROPERTY_ID = PropertyHelper.getPropertyId(null, "createtime");
public static final String SERVICE_CONFIG_VERSION_APPLY_TIME_PROPERTY_ID = PropertyHelper.getPropertyId(null, "appliedtime");
public static final String SERVICE_CONFIG_VERSION_USER_PROPERTY_ID = PropertyHelper.getPropertyId(null, "user");
+ public static final String SERVICE_CONFIG_VERSION_NOTE_PROPERTY_ID = PropertyHelper.getPropertyId(null, "service_config_version_note");
public static final String SERVICE_CONFIG_VERSION_CONFIGURATIONS_PROPERTY_ID = PropertyHelper.getPropertyId(null, "configurations");
/**
@@ -101,6 +102,7 @@ public class ServiceConfigVersionResourceProvider extends
resource.setProperty(SERVICE_CONFIG_VERSION_CREATE_TIME_PROPERTY_ID, response.getCreateTime());
resource.setProperty(SERVICE_CONFIG_VERSION_CONFIGURATIONS_PROPERTY_ID,
convertToSubResources(response.getClusterName(), response.getConfigurations()));
+ resource.setProperty(SERVICE_CONFIG_VERSION_NOTE_PROPERTY_ID, response.getNote());
resources.add(resource);
}
@@ -130,7 +132,8 @@ public class ServiceConfigVersionResourceProvider extends
if (!propertyId.equals("cluster_name") && !propertyId.equals("serviceconfigversion") &&
!propertyId.equals("service_name") && !propertyId.equals("createtime") &&
- !propertyId.equals("appliedtime") && !propertyId.equals("user")) {
+ !propertyId.equals("appliedtime") && !propertyId.equals("user") &&
+ !propertyId.equals("service_config_version_note")) {
unsupportedProperties.add(propertyId);
http://git-wip-us.apache.org/repos/asf/ambari/blob/16d80930/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigApplicationEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigApplicationEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigApplicationEntity.java
index ba5adb5..6f2f441 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigApplicationEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigApplicationEntity.java
@@ -55,6 +55,10 @@ public class ServiceConfigApplicationEntity {
@Column(name = "user_name")
private String user = "_db";
+ @Basic
+ @Column(name = "note")
+ private String note;
+
@ManyToOne
@JoinColumn(name = "service_config_id", referencedColumnName = "service_config_id")
private ServiceConfigEntity serviceConfigEntity;
@@ -99,4 +103,12 @@ public class ServiceConfigApplicationEntity {
public void setUser(String user) {
this.user = user;
}
+
+ public String getNote() {
+ return note;
+ }
+
+ public void setNote(String note) {
+ this.note = note;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/16d80930/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
index 8c0638a..d62b0cf 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
@@ -164,14 +164,26 @@ public interface Cluster {
public ServiceConfigVersionResponse addDesiredConfig(String user, Config config);
/**
+ * Adds and sets a DESIRED configuration to be applied to a cluster. There
+ * can be only one selected config per type.
+ * @param user the user making the change for audit purposes
+ * @param config the {@link org.apache.ambari.server.state.Config} object to set as desired
+ * @param serviceConfigVersionNote note to attach to service config version if created
+ * @return <code>true</code> if the config was added, or <code>false</code>
+ * if the config is already set as the current
+ */
+ ServiceConfigVersionResponse addDesiredConfig(String user, Config config, String serviceConfigVersionNote);
+
+ /**
* Apply specified service config version (rollback)
* @param serviceName service name
* @param version service config version
* @param user the user making the change for audit purposes
+ * @param note
* @return true if service config version applied
* @throws AmbariException
*/
- boolean setServiceConfigVersion(String serviceName, Long version, String user) throws AmbariException;
+ boolean setServiceConfigVersion(String serviceName, Long version, String user, String note) throws AmbariException;
/**
* Get currently active service config versions for stack services
http://git-wip-us.apache.org/repos/asf/ambari/blob/16d80930/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
index 3daf32a..eb5d36d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
@@ -1336,6 +1336,11 @@ public class ClusterImpl implements Cluster {
@Override
public ServiceConfigVersionResponse addDesiredConfig(String user, Config config) {
+ return addDesiredConfig(user, config, null);
+ }
+
+ @Override
+ public ServiceConfigVersionResponse addDesiredConfig(String user, Config config, String serviceConfigVersionNote) {
if (null == user)
throw new NullPointerException("User must be specified.");
@@ -1351,7 +1356,7 @@ public class ClusterImpl implements Cluster {
}
ServiceConfigVersionResponse serviceConfigVersionResponse =
- applyConfig(config.getType(), config.getTag(), user);
+ applyConfig(config.getType(), config.getTag(), user, serviceConfigVersionNote);
configHelper.invalidateStaleConfigsCache();
return serviceConfigVersionResponse;
@@ -1409,7 +1414,7 @@ public class ClusterImpl implements Cluster {
}
@Override
- public boolean setServiceConfigVersion(String serviceName, Long version, String user) throws AmbariException {
+ public boolean setServiceConfigVersion(String serviceName, Long version, String user, String note) throws AmbariException {
if (null == user)
throw new NullPointerException("User must be specified.");
@@ -1417,7 +1422,7 @@ public class ClusterImpl implements Cluster {
try {
readWriteLock.writeLock().lock();
try {
- applyServiceConfigVersion(serviceName, version, user);
+ applyServiceConfigVersion(serviceName, version, user, note);
return true;
} finally {
@@ -1458,25 +1463,19 @@ public class ClusterImpl implements Cluster {
try {
List<ServiceConfigVersionResponse> serviceConfigVersionResponses = new ArrayList<ServiceConfigVersionResponse>();
for (ServiceConfigApplicationEntity applicationEntity : serviceConfigDAO.getServiceConfigApplications(getClusterId())) {
- ServiceConfigVersionResponse serviceConfigVersionResponse = new ServiceConfigVersionResponse();
-
- ServiceConfigEntity serviceConfigEntity = applicationEntity.getServiceConfigEntity();
-
+ ServiceConfigVersionResponse serviceConfigVersionResponse =
+ convertToServiceConfigVersionResponse(applicationEntity);
- serviceConfigVersionResponse.setClusterName(getClusterName());
- serviceConfigVersionResponse.setServiceName(serviceConfigEntity.getServiceName());
- serviceConfigVersionResponse.setVersion(serviceConfigEntity.getVersion());
- serviceConfigVersionResponse.setCreateTime(serviceConfigEntity.getCreateTimestamp());
- serviceConfigVersionResponse.setApplyTime(applicationEntity.getApplyTimestamp());
- serviceConfigVersionResponse.setUserName(applicationEntity.getUser());
serviceConfigVersionResponse.setConfigurations(new ArrayList<ConfigurationResponse>());
+ ServiceConfigEntity serviceConfigEntity = applicationEntity.getServiceConfigEntity();
+
List<ClusterConfigEntity> clusterConfigEntities = serviceConfigEntity.getClusterConfigEntities();
for (ClusterConfigEntity clusterConfigEntity : clusterConfigEntities) {
Config config = allConfigs.get(clusterConfigEntity.getType()).get(clusterConfigEntity.getTag());
serviceConfigVersionResponse.getConfigurations().add(new ConfigurationResponse(getClusterName(),
- config.getType(), config.getTag(), config.getVersion(), config.getProperties(),
- config.getPropertiesAttributes()));
+ config.getType(), config.getTag(), config.getVersion(), config.getProperties(),
+ config.getPropertiesAttributes()));
}
serviceConfigVersionResponses.add(serviceConfigVersionResponse);
@@ -1523,11 +1522,13 @@ public class ClusterImpl implements Cluster {
serviceConfigVersionResponse.setCreateTime(serviceConfigEntity.getCreateTimestamp());
serviceConfigVersionResponse.setApplyTime(applicationEntity.getApplyTimestamp());
serviceConfigVersionResponse.setUserName(applicationEntity.getUser());
+ serviceConfigVersionResponse.setNote(applicationEntity.getNote());
return serviceConfigVersionResponse;
}
@Transactional
- void applyServiceConfigVersion(String serviceName, Long serviceConfigVersion, String user) throws AmbariException {
+ void applyServiceConfigVersion(String serviceName, Long serviceConfigVersion, String user,
+ String serviceConfigVersionNote) throws AmbariException {
ServiceConfigEntity serviceConfigEntity = serviceConfigDAO.findByServiceAndVersion(serviceName, serviceConfigVersion);
if (serviceConfigEntity == null) {
throw new ObjectNotFoundException("Service config version with serviceName={} and version={} not found");
@@ -1550,6 +1551,7 @@ public class ClusterImpl implements Cluster {
applicationEntity.setApplyTimestamp(System.currentTimeMillis());
applicationEntity.setServiceConfigEntity(serviceConfigEntity);
applicationEntity.setUser(user);
+ applicationEntity.setNote(serviceConfigVersionNote);
serviceConfigEntity.getServiceConfigApplicationEntities().add(applicationEntity);
@@ -1582,7 +1584,7 @@ public class ClusterImpl implements Cluster {
}
@Transactional
- ServiceConfigVersionResponse applyConfig(String type, String tag, String user) {
+ ServiceConfigVersionResponse applyConfig(String type, String tag, String user, String serviceConfigVersionNote) {
selectConfig(type, tag, user);
@@ -1599,12 +1601,13 @@ public class ClusterImpl implements Cluster {
LOG.error("No service found for config type '{}', service config version not created");
return null;
} else {
- return createServiceConfigVersion(serviceName, user);
+ return createServiceConfigVersion(serviceName, user, serviceConfigVersionNote);
}
}
- private ServiceConfigVersionResponse createServiceConfigVersion(String serviceName, String user) {
+ private ServiceConfigVersionResponse createServiceConfigVersion(String serviceName, String user,
+ String serviceConfigVersionNote) {
//create next service config version
ServiceConfigEntity serviceConfigEntity = new ServiceConfigEntity();
serviceConfigEntity.setServiceName(serviceName);
@@ -1617,6 +1620,7 @@ public class ClusterImpl implements Cluster {
serviceConfigApplicationEntity.setApplyTimestamp(serviceConfigEntity.getCreateTimestamp());
serviceConfigApplicationEntity.setServiceConfigEntity(serviceConfigEntity);
serviceConfigApplicationEntity.setUser(user);
+ serviceConfigApplicationEntity.setNote(serviceConfigVersionNote);
serviceConfigEntity.getServiceConfigApplicationEntities().add(serviceConfigApplicationEntity);
List<ClusterConfigEntity> configEntities = new ArrayList<ClusterConfigEntity>();
@@ -1646,6 +1650,7 @@ public class ClusterImpl implements Cluster {
response.setServiceName(serviceConfigEntity.getServiceName());
response.setCreateTime(serviceConfigEntity.getCreateTimestamp());
response.setApplyTime(serviceConfigApplicationEntity.getApplyTimestamp());
+ response.setNote(serviceConfigApplicationEntity.getNote());
return response;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/16d80930/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
index ff6c8c0..5fc03b1 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -30,7 +30,7 @@ CREATE TABLE clusters (cluster_id BIGINT NOT NULL, resource_id BIGINT NOT NULL,
CREATE TABLE clusterconfig (config_id BIGINT NOT NULL, version_tag VARCHAR(255) NOT NULL, version BIGINT NOT NULL, type_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, config_data LONGTEXT NOT NULL, config_attributes LONGTEXT, create_timestamp BIGINT NOT NULL, PRIMARY KEY (config_id));
CREATE TABLE serviceconfig (service_config_id BIGINT NOT NULL, cluster_id BIGINT NOT NULL, service_name VARCHAR(255) NOT NULL, version BIGINT NOT NULL, create_timestamp BIGINT NOT NULL, PRIMARY KEY (service_config_id));
CREATE TABLE serviceconfigmapping (service_config_id BIGINT NOT NULL, config_id BIGINT NOT NULL, PRIMARY KEY(service_config_id, config_id));
-CREATE TABLE serviceconfigapplication (apply_id BIGINT NOT NULL, service_config_id BIGINT NOT NULL, apply_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT '_db', PRIMARY KEY(apply_id));
+CREATE TABLE serviceconfigapplication (apply_id BIGINT NOT NULL, service_config_id BIGINT NOT NULL, apply_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT '_db', note LONGTEXT, PRIMARY KEY(apply_id));
CREATE TABLE clusterservices (service_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, service_enabled INTEGER NOT NULL, PRIMARY KEY (service_name, cluster_id));
CREATE TABLE clusterstate (cluster_id BIGINT NOT NULL, current_cluster_state VARCHAR(255) NOT NULL, current_stack_version VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id));
CREATE TABLE hostcomponentdesiredstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, admin_state VARCHAR(32), maintenance_state VARCHAR(32) NOT NULL DEFAULT 'ACTIVE', restart_required TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
http://git-wip-us.apache.org/repos/asf/ambari/blob/16d80930/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
index bdb20b8..c8897f7 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -21,7 +21,7 @@ CREATE TABLE clusters (cluster_id NUMBER(19) NOT NULL, resource_id NUMBER(19) NO
CREATE TABLE clusterconfig (config_id NUMBER(19) NOT NULL, version_tag VARCHAR2(255) NOT NULL, version NUMBER(19) NOT NULL, type_name VARCHAR2(255) NOT NULL, cluster_id NUMBER(19) NOT NULL, config_data CLOB NOT NULL, config_attributes CLOB, create_timestamp NUMBER(19) NOT NULL, PRIMARY KEY (config_id));
CREATE TABLE serviceconfig (service_config_id NUMBER(19) NOT NULL, cluster_id NUMBER(19) NOT NULL, service_name VARCHAR(255) NOT NULL, version NUMBER(19) NOT NULL, create_timestamp NUMBER(19) NOT NULL, PRIMARY KEY (service_config_id));
CREATE TABLE serviceconfigmapping (service_config_id NUMBER(19) NOT NULL, config_id NUMBER(19) NOT NULL, PRIMARY KEY(service_config_id, config_id));
-CREATE TABLE serviceconfigapplication (apply_id NUMBER(19) NOT NULL, service_config_id NUMBER(19) NOT NULL, apply_timestamp NUMBER(19) NOT NULL, user_name VARCHAR(255) DEFAULT '_db' NOT NULL, PRIMARY KEY(apply_id));
+CREATE TABLE serviceconfigapplication (apply_id NUMBER(19) NOT NULL, service_config_id NUMBER(19) NOT NULL, apply_timestamp NUMBER(19) NOT NULL, user_name VARCHAR(255) DEFAULT '_db' NOT NULL, note CLOB, PRIMARY KEY(apply_id));
CREATE TABLE clusterservices (service_name VARCHAR2(255) NOT NULL, cluster_id NUMBER(19) NOT NULL, service_enabled NUMBER(10) NOT NULL, PRIMARY KEY (service_name, cluster_id));
CREATE TABLE clusterstate (cluster_id NUMBER(19) NOT NULL, current_cluster_state VARCHAR2(255) NULL, current_stack_version VARCHAR2(255) NULL, PRIMARY KEY (cluster_id));
CREATE TABLE hostcomponentdesiredstate (cluster_id NUMBER(19) NOT NULL, component_name VARCHAR2(255) NOT NULL, desired_stack_version VARCHAR2(255) NULL, desired_state VARCHAR2(255) NOT NULL, host_name VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, admin_state VARCHAR2(32) NULL, maintenance_state VARCHAR2(32) NOT NULL, restart_required NUMBER(1) DEFAULT 0 NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
http://git-wip-us.apache.org/repos/asf/ambari/blob/16d80930/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index 1f3b3e5..eb4d073 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -27,7 +27,7 @@ CREATE TABLE serviceconfig (service_config_id BIGINT NOT NULL, cluster_id BIGINT
CREATE TABLE serviceconfigmapping (service_config_id BIGINT NOT NULL, config_id BIGINT NOT NULL, PRIMARY KEY(service_config_id, config_id));
-CREATE TABLE serviceconfigapplication (apply_id BIGINT NOT NULL, service_config_id BIGINT NOT NULL, apply_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT '_db', PRIMARY KEY(apply_id));
+CREATE TABLE serviceconfigapplication (apply_id BIGINT NOT NULL, service_config_id BIGINT NOT NULL, apply_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT '_db', note TEXT, PRIMARY KEY(apply_id));
CREATE TABLE clusterservices (service_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, service_enabled INTEGER NOT NULL, PRIMARY KEY (service_name, cluster_id));
http://git-wip-us.apache.org/repos/asf/ambari/blob/16d80930/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
index 58ad54a..d775eea 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
@@ -43,7 +43,7 @@ GRANT ALL PRIVILEGES ON TABLE ambari.serviceconfig TO :username;
CREATE TABLE ambari.serviceconfigmapping (service_config_id BIGINT NOT NULL, config_id BIGINT NOT NULL, PRIMARY KEY(service_config_id, config_id));
GRANT ALL PRIVILEGES ON TABLE ambari.serviceconfigmapping TO :username;
-CREATE TABLE ambari.serviceconfigapplication (apply_id BIGINT NOT NULL, service_config_id BIGINT NOT NULL, apply_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT '_db', PRIMARY KEY(apply_id));
+CREATE TABLE ambari.serviceconfigapplication (apply_id BIGINT NOT NULL, service_config_id BIGINT NOT NULL, apply_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT '_db', note TEXT, PRIMARY KEY(apply_id));
GRANT ALL PRIVILEGES ON TABLE ambari.serviceconfigapplication TO :username;
CREATE TABLE ambari.clusterservices (service_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, service_enabled INTEGER NOT NULL, PRIMARY KEY (service_name, cluster_id));
http://git-wip-us.apache.org/repos/asf/ambari/blob/16d80930/ambari-server/src/main/resources/properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/properties.json b/ambari-server/src/main/resources/properties.json
index e80c0e6..753efeb 100644
--- a/ambari-server/src/main/resources/properties.json
+++ b/ambari-server/src/main/resources/properties.json
@@ -91,7 +91,8 @@
"ServiceConfigVersion/serviceconfigversion",
"ServiceConfigVersion/createtime",
"ServiceConfigVersion/appliedtime",
- "ServiceConfigVersion/user"
+ "ServiceConfigVersion/user",
+ "ServiceConfigVersion/service_config_version_note"
],
"ConfigGroup": [
"ConfigGroup/id",
[3/6] AMBARI-6840. Jobs View: Update Top Nav rendering for jobs
(srimanth)
Posted by jo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/views/main/jobs/hive_job_details_tez_dag_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/jobs/hive_job_details_tez_dag_view.js b/ambari-web/app/views/main/jobs/hive_job_details_tez_dag_view.js
deleted file mode 100644
index 3ce60b5..0000000
--- a/ambari-web/app/views/main/jobs/hive_job_details_tez_dag_view.js
+++ /dev/null
@@ -1,946 +0,0 @@
-/**
- * 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.
- */
-
-var App = require('app');
-var date = require('utils/date');
-var numberUtils = require('utils/number_utils');
-var stringUtils = require('utils/string_utils');
-
-App.MainHiveJobDetailsTezDagView = Em.View.extend({
- templateName : require('templates/main/jobs/hive_job_details_tez_dag'),
- selectedVertex : null,
- summaryMetricType: null,
- svgVerticesLayer : null, // The contents of the <svg> element.
- svgTezRoot: null,
- svgWidth : -1,
- svgHeight : -1,
-
- // zoomScaleFom: -1, // Bound from parent view
- // zoomScaleTo: -1, // Bound from parent view
- // zoomScale: -1, // Bound from parent view
- zoomTranslate: [0, 0],
- zoomBehavior: null,
- svgCreated: false,
-
- content : null,
-
- /**
- * Populated by #drawTezDag()
- *
- * {
- * "nodes": [
- * {
- * "id": "Map2",
- * "name": "Map 2",
- * "type": App.TezDagVertexType.MAP,
- * "operations": [
- * "TableScan",
- * "File Output"
- * ],
- * "depth": 1,
- * "parents": [],
- * "children": [],
- * "x": 0,
- * "y": 0,
- * "metricDisplay": "100MB",
- * "metricPercent": 64,
- * "metricType": "Input",
- * "selected": true,
- * "fixed": true,
- * "metrics": {
- * "input": 40022,
- * "output": 224344,
- * "recordsRead": 200,
- * "recordsWrite": 122,
- * "tezTasks": 2
- * }
- * }
- * ],
- * "links": [
- * {
- * "source": {},
- * "target": {},
- * "edgeType": "BROADCAST"
- * }
- * ]
- * }
- */
- dagVisualModel : {
- nodes : [],
- links : [],
- maxMetrics : {},
- minMetrics: {}
- },
-
- didInsertElement : function() {
- this._super();
- this.createSvg();
- },
-
- willDestroyElement : function() {
- $('.svg-tooltip').tooltip('destroy');
- },
-
- createSvg : function() {
- var self = this;
- var dagVisualModel = this.get('dagVisualModel');
- dagVisualModel.nodes.clear();
- dagVisualModel.links.clear();
- dagVisualModel.maxMetrics = {};
- dagVisualModel.minMetrics = {};
-
- this.set('content', this.get('controller.content'));
- var svg = d3.select("#tez-dag-svg");
- d3.selectAll(".tez-dag-canvas").remove();
- var tezRoot = svg.append("svg:g").attr("class", "tez-root");
- this.set('svgTezRoot', tezRoot);
- var tezRootRect = tezRoot.append("rect").attr("class", "tez-root-rect");
- this.set('svgVerticesLayer', tezRoot.append("svg:g").attr("class", "tez-dag-canvas"));
- this.adjustGraphHeight();
- var canvasSize = this.drawTezDag();
- var minScale = Math.min(this.get('svgHeight') / canvasSize.height, this.get('svgWidth') / canvasSize.width);
- if (minScale > 1) {
- minScale = 1;
- }
- tezRootRect.attr("width", canvasSize.width).attr("height", canvasSize.height);
- var zoom = d3.behavior.zoom().scaleExtent([ minScale, 2 ]).on("zoom", function() {
- tezRoot.attr("transform", "translate(" + (d3.event.translate) + ")scale(" + d3.event.scale + ")");
- self.set('zoomScale', d3.event.scale);
- self.set('zoomTranslate', d3.event.translate);
- });
- svg.call(zoom);
- this.set('zoomBehavior', zoom);
- this.set('zoomTranslate', [0, 0]);
- this.set('zoomScaleFrom', minScale);
- this.set('zoomScaleTo', 2);
- this.set('zoomScale', minScale);
- this.set('svgCreated', true);
- },
-
- zoomScaleObserver : function() {
- var tezRoot = this.get("svgTezRoot");
- var newScale = this.get('zoomScale');
- var newScaleFrom = this.get('zoomScaleFrom');
- var newScaleTo = this.get('zoomScaleTo');
- var zoomTranslate = this.get('zoomTranslate');
- var zoomBehavior = this.get('zoomBehavior');
- if (d3.event == null && this.get('svgCreated')) {
- // Values were set from actions instead of UI events
- // We need to center in on selected vertex if available.
- var selectedNode = null;
- var dagVisualModel = this.get('dagVisualModel');
- if (dagVisualModel && dagVisualModel.nodes && dagVisualModel.nodes.length > 0) {
- dagVisualModel.nodes.every(function(node) {
- if (node.selected) {
- selectedNode = node;
- return false;
- }
- return true;
- })
- }
- if (selectedNode != null) {
- var cX = selectedNode.x + selectedNode.width / 2;
- var cY = selectedNode.y + selectedNode.height / 2;
- var mX = (cX * zoomBehavior.scale()) + zoomTranslate[0];
- var mY = (cY * zoomBehavior.scale()) + zoomTranslate[1];
- var pX = (cX * newScale) + zoomTranslate[0];
- var pY = (cY * newScale) + zoomTranslate[1];
- var nX = (mX - pX);
- var nY = (mY - pY);
- zoomTranslate[0] += nX;
- zoomTranslate[1] += nY;
- this.set('zoomTranslate', zoomTranslate);
- }
- }
- console.debug("zoomScaleObserver(): New scale = " + newScale + ", Range = [" + newScaleFrom + ", " + newScaleTo + "]. Translate = ", zoomTranslate.join(','));
- zoomBehavior.scale(newScale);
- zoomBehavior.translate(zoomTranslate);
- tezRoot.attr("transform", "translate(" + zoomTranslate + ")scale(" + newScale + ")");
- }.observes('zoomScale', 'zoomScaleFrom', 'zoomScaleTo', 'zoomTranslate'),
-
- /**
- * We have to make the height of the DAG section match the height of the
- * Summary section.
- */
- adjustGraphHeight : function() {
- var rhsDiv = document.getElementById('tez-vertices-rhs');
- var lhsDiv = document.getElementById('tez-dag-section');
- if (lhsDiv && rhsDiv) {
- var rhsHeight = rhsDiv.clientHeight - 26; // box boundary
- var currentWidth = lhsDiv.clientWidth;
- var currentHeight = lhsDiv.clientHeight;
- $(lhsDiv).attr('style', "height:" + rhsHeight + "px;");
- var svgHeight = rhsHeight - 20;
- d3.select("#tez-dag-svg").attr('height', svgHeight).attr('width', '100%');
- this.set('svgWidth', currentWidth);
- this.set('svgHeight', svgHeight);
- console.log("SVG Width=", currentWidth, ", Height=", svgHeight);
- }
- },
-
- vertexSelectionUpdated : function() {
- var vertexId = this.get('selectedVertex.id');
- var zoomTranslate = [];
- var zoomBehavior = this.get('zoomBehavior');
- var selectedNode = this.get('dagVisualModel').nodes.findProperty('id', vertexId);
- var dagVisualModel = this.get('dagVisualModel');
- if (dagVisualModel && dagVisualModel.nodes && dagVisualModel.nodes.length > 0) {
- dagVisualModel.nodes.forEach(function(node) {
- node.selected = node.id == vertexId;
- console.log("vertexSelectionUpdated(): Updated ",node.id," to ",node.selected);
- })
- }
- if(!this.get('selectedVertex.notTableClick')){
- var cX = selectedNode.x + (selectedNode.width) / 2;
- var cY = selectedNode.y + (selectedNode.height) / 2;
- zoomTranslate[0] = (225 / zoomBehavior.scale() -cX) ;
- zoomTranslate[1] = (250 / zoomBehavior.scale() -cY) ;
- this.set('zoomTranslate', [0,0]);
- this.get('svgVerticesLayer').attr("transform", "translate(0,0)");
- this.get('svgVerticesLayer').attr("transform", "translate("+zoomTranslate[0]+","+zoomTranslate[1]+")");
- }
- this.refreshGraphUI();
- }.observes('selectedVertex'),
-
- summaryMetricTypeUpdated : function() {
- var summaryMetricType = this.get('summaryMetricType');
- var dagVisualModel = this.get('dagVisualModel');
- var min = dagVisualModel.minMetrics[summaryMetricType];
- var max = dagVisualModel.maxMetrics[summaryMetricType];
- dagVisualModel.nodes.forEach(function(node) {
- var value = node.metrics[summaryMetricType];
- var percent = -1;
- if (numberUtils.validateInteger(value)==null && value >= 0) {
- if (numberUtils.validateInteger(min) == null && numberUtils.validateInteger(max) == null) {
- if (max > min && value >= 0) {
- percent = Math.round((value - min) * 100 / (max - min));
- }
- }
- } else {
- value = '';
- }
- switch (summaryMetricType) {
- case "input":
- case "output":
- value = numberUtils.bytesToSize(value);
- break;
- default:
- break;
- }
- node.metricType = Em.I18n.t('jobs.hive.tez.metric.' + summaryMetricType);
- node.metricDisplay = value;
- node.metricPercent = percent;
- });
- this.refreshGraphUI();
- }.observes('summaryMetricType'),
-
- /**
- * Observes metrics of all vertices.
- */
- vertexMetricsUpdated : function() {
- var dagVisualModel = this.get('dagVisualModel');
- dagVisualModel.minMetrics = {
- input : Number.MAX_VALUE,
- output : Number.MAX_VALUE,
- recordsRead : Number.MAX_VALUE,
- recordsWrite : Number.MAX_VALUE,
- tezTasks : Number.MAX_VALUE,
- spilledRecords : Number.MAX_VALUE
- };
- dagVisualModel.maxMetrics = {
- input : 0,
- output : 0,
- recordsRead : 0,
- recordsWrite : 0,
- tezTasks : 0,
- spilledRecords : 0
- };
- if (dagVisualModel.nodes) {
- dagVisualModel.nodes.forEach(function(node) {
- var vertex = App.TezDagVertex.find(node.id);
- if (vertex) {
- node.metrics['input'] = vertex.get('fileReadBytes') + vertex.get('hdfsReadBytes');
- node.metrics['output'] = vertex.get('fileWriteBytes') + vertex.get('hdfsWriteBytes');
- node.metrics['recordsRead'] = vertex.get('recordReadCount');
- node.metrics['recordsWrite'] = vertex.get('recordWriteCount');
- node.metrics['tezTasks'] = vertex.get('tasksCount');
- node.metrics['spilledRecords'] = vertex.get('spilledRecords');
- node.state = vertex.get('state');
- // Min metrics
- dagVisualModel.minMetrics.input = Math.min(dagVisualModel.minMetrics.input, node.metrics.input);
- dagVisualModel.minMetrics.output = Math.min(dagVisualModel.minMetrics.output, node.metrics.output);
- dagVisualModel.minMetrics.recordsRead = Math.min(dagVisualModel.minMetrics.recordsRead, node.metrics.recordsRead);
- dagVisualModel.minMetrics.recordsWrite = Math.min(dagVisualModel.minMetrics.recordsWrite, node.metrics.recordsWrite);
- dagVisualModel.minMetrics.tezTasks = Math.min(dagVisualModel.minMetrics.tezTasks, node.metrics.tezTasks);
- dagVisualModel.minMetrics.spilledRecords = Math.min(dagVisualModel.minMetrics.spilledRecords, node.metrics.spilledRecords);
- // Max metrics
- dagVisualModel.maxMetrics.input = Math.max(dagVisualModel.maxMetrics.input, node.metrics.input);
- dagVisualModel.maxMetrics.output = Math.max(dagVisualModel.maxMetrics.output, node.metrics.output);
- dagVisualModel.maxMetrics.recordsRead = Math.max(dagVisualModel.maxMetrics.recordsRead, node.metrics.recordsRead);
- dagVisualModel.maxMetrics.recordsWrite = Math.max(dagVisualModel.maxMetrics.recordsWrite, node.metrics.recordsWrite);
- dagVisualModel.maxMetrics.tezTasks = Math.max(dagVisualModel.maxMetrics.tezTasks, node.metrics.tezTasks);
- dagVisualModel.maxMetrics.spilledRecords = Math.max(dagVisualModel.maxMetrics.spilledRecords, node.metrics.spilledRecords);
- }
- });
- }
- Ember.run.once(this, 'summaryMetricTypeUpdated');
- }.observes('content.tezDag.vertices.@each.fileReadBytes', 'content.tezDag.vertices.@each.fileWriteBytes',
- 'content.tezDag.vertices.@each.hdfsReadBytes', 'content.tezDag.vertices.@each.hdfsWriteBytes',
- 'content.tezDag.vertices.@each.recordReadCount', 'content.tezDag.vertices.@each.recordWriteCount',
- 'content.tezDag.vertices.@each.state', 'content.tezDag.vertices.@each.spilledRecords'),
-
- createOperationPlanObj: function (vertexName, op, opIndex) {
- var operatorPlanObj = [];
- var text = this.get('content.tezDag.vertices').findProperty('name', vertexName).get('operationPlan');
- text = text.replace(/:"/g,'"').replace(/([:,])(?=\S)/g,'$1 ');
- var jsonText = $.parseJSON(text);
- if (!opIndex) {
- opIndex = 0;
- } else {
- opIndex = parseInt(opIndex) - 1;
- }
- var jsonText = op.findIn(jsonText, opIndex);
- if (jsonText!=null) {
- for (var key in jsonText) {
- if (jsonText.hasOwnProperty(key) && typeof(jsonText[key]) == "string") {
- operatorPlanObj.push(
- {
- name: key,
- value: jsonText[key]
- }
- );
- }
- }
- }
- return operatorPlanObj;
- },
-
- /**
- * Determines layout and creates Tez graph. In the process it populates the
- * visual model into 'dagVisualModel' field.
- *
- * Terminology: 'vertices' and 'edges' are Tez terms. 'nodes' and 'links' are
- * visual (d3) terms.
- */
- drawTezDag : function() {
- var self = this;
- var width = this.get('svgWidth');
- var svgLayer = this.get('svgVerticesLayer');
- var vertices = this.get('content.tezDag.vertices');
- var edges = this.get('content.tezDag.edges');
- var constants = this.get('constants');
- var vertexIdToNode = {};
- var depthToNodes = []; // Array of id arrays
- var dagVisualModel = this.get('dagVisualModel');
- var selectedVertex = this.get('selectedVertex');
- var minVertexDuration = Number.MAX_VALUE;
- var maxVertexDuration = Number.MIN_VALUE;
-
- //
- // CALCULATE DEPTH - BFS to get correct graph depth
- //
- var visitEdges = [];
- var maxRowLength = 0;
- var maxRowDepth = 0;
- vertices.forEach(function(v) {
- if (v.get('incomingEdges.length') < 1) {
- visitEdges.push({
- depth : 0,
- parent : null,
- toVertex : v
- });
- }
- });
- function getNodeFromEdge(edgeObj) {
- var vertex = edgeObj.toVertex;
- var pName = edgeObj.parent ? edgeObj.parent.name : null;
- var cName = edgeObj.toVertex ? edgeObj.toVertex.get('name') : null;
- console.debug("Processing vertex ", edgeObj, " (",pName, " > ", cName,")");
- if(edgeObj.parent && edgeObj.depth < edgeObj.parent.depth + 1){
- console.debug("Updating child edge to " + (edgeObj.parent.depth + 1));
- edgeObj.depth = edgeObj.parent.depth + 1;
- }
- var node = vertexIdToNode[vertex.get('id')];
- for ( var k = depthToNodes.length; k <= edgeObj.depth; k++) {
- depthToNodes.push([]);
- }
- if (!node) {
- // New node
- node = {
- id : vertex.get('id'),
- name : vertex.get('name'),
- state : vertex.get('state'),
- type : vertex.get('type'),
- operations : vertex.get('operations'),
- depth : edgeObj.depth,
- parents : [],
- children : [],
- x : 0,
- y : 0,
- metricType : null,
- metricDisplay : null,
- metricPercent : -1,
- selected : selectedVertex != null ? selectedVertex.get('id') == vertex.get('id') : false,
- fixed : true,
- metrics : {
- input : -1,
- output : -1,
- recordsRead : -1,
- recordsWrite : -1,
- tezTasks : -1
- },
- duration: vertex.get('duration')
- }
- if (node.duration < minVertexDuration && node.duration > 0) {
- minVertexDuration = node.duration;
- }
- if (node.duration > maxVertexDuration && node.duration > 0) {
- maxVertexDuration = node.duration;
- }
- vertexIdToNode[vertex.get('id')] = node;
- depthToNodes[node.depth].push(node);
- } else {
- // Existing node
- if (edgeObj.depth > node.depth) {
- function moveNodeToDepth(node, newDepth) {
- console.debug("Moving " + node.name + " from depth " + node.depth + " to " + newDepth);
- var oldIndex = depthToNodes[node.depth].indexOf(node);
- depthToNodes[node.depth].splice(oldIndex, 1);
- node.depth = newDepth;
- if (!depthToNodes[node.depth]) {
- depthToNodes[node.depth] = [];
- }
- depthToNodes[node.depth].push(node);
- if (node.children) {
- // Move children down depth
- node.children.forEach(function(c) {
- moveNodeToDepth(c, node.depth + 1);
- })
- }
- }
- moveNodeToDepth(node, edgeObj.depth);
- }
- }
- if (depthToNodes[node.depth].length > maxRowLength) {
- maxRowLength = depthToNodes[node.depth].length;
- maxRowDepth = node.depth;
- }
- if (edgeObj.parent != null) {
- node.parents.push(edgeObj.parent);
- edgeObj.parent.children.push(node);
- }
- return node;
- }
- var edgeObj;
- var visitedVertexMap = {};
- while (edgeObj = visitEdges.shift()) {
- var node = getNodeFromEdge(edgeObj);
- if (!visitedVertexMap[edgeObj.toVertex.get('id')]) {
- visitedVertexMap[edgeObj.toVertex.get('id')] = true;
- var outEdges = edgeObj.toVertex.get('outgoingEdges');
- outEdges.forEach(function(oe) {
- var childVertex = oe.get('toVertex');
- visitEdges.push({
- depth : node.depth + 1,
- parent : node,
- toVertex : childVertex
- });
- });
- }
- }
- edges.forEach(function(e) {
- dagVisualModel.links.push({
- source : vertexIdToNode[e.get('fromVertex.id')],
- target : vertexIdToNode[e.get('toVertex.id')],
- edgeType : e.get('edgeType')
- });
- });
- // Sort nodes so that parents stay together
- for ( var depth = 0; depth < depthToNodes.length; depth++) {
- var nodes = depthToNodes[depth];
- nodes.sort(function(n1, n2) {
- var ck1 = '';
- var ck2 = '';
- if (n1.children) {
- n1.children.forEach(function(c) {
- ck1 += c.name;
- });
- }
- if (n2.children) {
- n2.children.forEach(function(c) {
- ck2 += c.name;
- });
- }
- if (ck1 < ck2) {
- return -1
- }
- if (ck1 > ck2) {
- return 1
- }
- return 0
- });
- depthToNodes[depth] = nodes;
- }
-
- //
- // LAYOUT - Now with correct depth, we calculate layouts
- //
- // When a node's effective width changes, all its parent nodes are updated.
- var updateNodeEffectiveWidth = function(node, newEffectiveWidth) {
- console.debug("Updating effective width of (" + node.id + ") to " + newEffectiveWidth);
- if (numberUtils.validateInteger(node.effectiveWidth) != null) {
- node.effectiveWidth = newEffectiveWidth;
- }
- var diff = newEffectiveWidth - node.effectiveWidth;
- if (diff > 0) {
- var oldEffectiveWidth = node.effectiveWidth;
- node.effectiveWidth = newEffectiveWidth;
- if (node.parents != null) {
- node.parents.forEach(function(parent) {
- updateNodeEffectiveWidth(parent, parent.effectiveWidth + diff);
- })
- }
- }
- }
- var xGap = 20;
- var yGap = 70;
- var currentY = 40;
- // First pass - calculate layout widths, and Y coordinates
- for ( var depth = 0; depth < depthToNodes.length; depth++) {
- var nodes = depthToNodes[depth];
- var maxNodeHeight = 0;
- for ( var nodeIndex = 0; nodeIndex < nodes.length; nodeIndex++) {
- var node = nodes[nodeIndex];
- var nodeDim = this.getNodeCalculatedDimensions(node, minVertexDuration, maxVertexDuration);
- node.drawWidth = nodeDim.drawWidth;
- node.drawHeight = nodeDim.drawHeight;
- node.scale = nodeDim.scale;
- node.width = nodeDim.width;
- node.height = nodeDim.height;
- if (maxNodeHeight < node.height) {
- maxNodeHeight = node.height;
- }
- if (depth == 0) {
- // Top nodes - position uniformly
- updateNodeEffectiveWidth(node, xGap + node.width);
- }
- if (node.children && node.children.length > 0) {
- // There can be dedicated or shared children.
- // Dedicated children increase effective width of parent by their
- // width.
- // Shared children increase effective width of parent only by the
- // fraction of parentage
- var childrenWidth = 0;
- node.children.forEach(function(child) {
- var childDim = self.getNodeCalculatedDimensions(child, minVertexDuration, maxVertexDuration);
- childrenWidth += ((childDim.width + xGap) / child.parents.length);
- });
- updateNodeEffectiveWidth(node, Math.max(childrenWidth, (node.width+xGap)));
- } else {
- updateNodeEffectiveWidth(node, xGap + node.width);
- }
- node.y = currentY;
- node.incomingY = node.y;
- node.outgoingY = node.incomingY + node.height;
- }
- currentY += maxNodeHeight;
- currentY += yGap;
- }
- // Second pass - determine actual X coordinates
- var maxX = 0;
- for ( var depth = 0; depth < depthToNodes.length; depth++) {
- var nodes = depthToNodes[depth];
- var currentX = -1;
- var parentCurrentXMap = {};
- for ( var nodeIndex = 0; nodeIndex < nodes.length; nodeIndex++) {
- var node = nodes[nodeIndex];
- var parentsKey = null;
- if (node.parents != null && node.parents.length > 0) {
- var parentMidX = 0;
- var parentsKey = '';
- var childrenEffectiveWidth = -1;
- node.parents.forEach(function(parent) {
- parentMidX += (parent.x + (parent.width / 2));
- parentsKey += (parent.id + '//');
- if (childrenEffectiveWidth < 0) {
- parent.children.forEach(function(c){
- childrenEffectiveWidth += (c.effectiveWidth);
- });
- }
- });
- parentMidX = parentMidX / node.parents.length;
- var parentCurrentX = parentCurrentXMap[parentsKey];
- if (parentCurrentX == null || parentCurrentX == undefined) {
- parentCurrentX = parentMidX - (childrenEffectiveWidth/2);
- parentCurrentXMap[parentsKey] = parentCurrentX;
- }
- currentX = parentCurrentX;
- } else {
- if (currentX < 0) {
- currentX = 0;
- }
- }
- node.x = (currentX + (node.effectiveWidth - node.width) / 2);
- node.outgoingX = (node.x + node.width / 2);
- node.incomingX = node.outgoingX;
- console.log("drawTezDag(). Layout Node: ", node);
- dagVisualModel.nodes.push(node);
- if (parentsKey != null) {
- parentCurrentXMap[parentsKey] = currentX + node.effectiveWidth;
- } else {
- currentX += node.effectiveWidth;
- }
- if ((node.x + node.width) > maxX) {
- maxX = node.x + node.width;
- }
- }
- }
- var canvasHeight = currentY;
- var canvasWidth = maxX + (xGap << 1);
-
- //
- // Draw SVG
- //
- var force = d3.layout.force().nodes(dagVisualModel.nodes).links(dagVisualModel.links).start();
- var nodeDragData = {
- nodeRelativeX : 0,
- nodeRelativeY : 0
- };
- var nodeDrag = d3.behavior.drag().on('dragstart', function(node){
- d3.event.sourceEvent.stopPropagation();
- var rc = d3.mouse(this);
- nodeDragData.nodeRelativeX = (rc[0] * node.scale);
- nodeDragData.nodeRelativeY = (rc[1] * node.scale);
- }).on('drag', function(node){
- var nx = d3.event.x - nodeDragData.nodeRelativeX;
- var ny = d3.event.y - nodeDragData.nodeRelativeY;
- self.dragVertex(d3.select(this), node, [nx, ny], diagonal);
- }).on('dragend', function(){
- nodeDragData.nodeRelativeX = 0;
- nodeDragData.nodeRelativeY = 0;
- });
- // Create Links
- var diagonal = d3.svg.diagonal().source(function(d) {
- return {
- x : d.source.outgoingX,
- y : d.source.outgoingY
- };
- }).target(function(d) {
- return {
- x : d.target.incomingX,
- y : d.target.incomingY - 12
- }
- });
- var link = svgLayer.selectAll(".link-g").data(dagVisualModel.links).enter().append("g").attr("class", "link-g").attr("marker-end", "url(#arrow)");
- link.append("path").attr("class", function(l) {
- var classes = "link svg-tooltip ";
- if (l.edgeType) {
- classes += ("type-" + l.edgeType.toLowerCase() + " ");
- } else {
- classes += "type-unknown ";
- }
- return classes;
- }).attr("d", diagonal).attr("title", function(l) {
- var lower = l.edgeType ? l.edgeType.toLowerCase() : '';
- return Em.I18n.t("jobs.hive.tez.edge." + lower);
- });
- // Create Nodes
- var node = svgLayer.selectAll(".node").data(dagVisualModel.nodes).enter().append("g").attr("class", "node").call(nodeDrag);
- node.append("rect").attr("class", "background").attr("width", function(n) {
- return n.drawWidth;
- }).attr("height", function(n) {
- return n.drawHeight;
- }).attr("rx", "10").attr("filter", "url(#shadow)").on('mousedown', function(n) {
- var vertex = App.TezDagVertex.find(n.id);
- if (vertex != null) {
- self.get('parentView').doSelectVertex({
- context : vertex
- }, true);
- }
- });
- node.each(function(n, nodeIndex) {
- var ops = n.operations;
- var opCount = {};
- if (ops != null && ops.length > 0) {
- var opGroups = d3.select(this).selectAll(".operation").data(ops).enter().append("g").attr("class", "operation").attr("transform", function(op, opIndex) {
- var row = Math.floor(opIndex / 3);
- var column = opIndex % 3;
- return "translate(" + (10 + column * 55) + "," + (37 + row * 20) + ")";
- }).attr("clip-path", "url(#operatorClipPath)").attr("opIndex", function(op){
- if(!opCount[op]) {
- opCount[op] = 1;
- } else {
- opCount[op] = opCount[op]+1;
- }
- return opCount[op];
- }).on('mouseover', function(op) {
- var viewContent = {
- operationName: op,
- operatorPlanObj: []
- };
- var opIndex = this.getAttribute('opIndex');
- var operatorPlanObj = self.createOperationPlanObj(n.name, op, opIndex);
- viewContent.operatorPlanObj = operatorPlanObj;
- var template = App.HoverOpTable.create({content: viewContent}) ;
- $(this).find('.svg-tooltip').attr('title', template.renderToBuffer().string()).tooltip('fixTitle').tooltip('show');
- })
-
- opGroups.append("rect").attr("class", "operation svg-tooltip ").attr("width", "50").attr("height", "16");
- opGroups.append("text").attr("x", "2").attr("dy", "1em").text(function(op) {
- return op != null ? op.split(' ')[0] : '';
- });
- }
- });
- var metricNodes = node.append("g").attr("class", "metric").attr("transform", "translate(112,7)");
- metricNodes.append("rect").attr("width", function(n) {
- if (n.type == App.TezDagVertexType.UNION) {
- return 0;
- }
- return 60;
- }).attr("height", function(n) {
- if (n.type == App.TezDagVertexType.UNION) {
- return 0;
- }
- return 18;
- }).attr("rx", "3").attr("class", "metric-title svg-tooltip");
- metricNodes.append("text").attr("class", "metric-text").attr("x", "2").attr("dy", "1em");
- node.append("text").attr("x", "1.9em").attr("dy", "1.5em").text(function(d) {
- return d.name;
- });
- var iconContainer = node.append('g').attr('class', 'vertex-icon-container').attr('transform', 'translate(10,10)');
- iconContainer.append('rect').attr('width', '1em').attr('height', '1em').attr('class', 'vertex-icon-rect svg-tooltip ');
- iconContainer.append('text').attr('dy', '10px').attr("font-family", "FontAwesome").attr('class', 'vertex-icon-text');
- node.attr("transform", function(d) {
- return "translate(" + d.x + "," + d.y + ") scale("+d.scale+") ";
- });
- this.vertexMetricsUpdated();
- $('.svg-tooltip').each(function() {
- var item = $(this);
- if (item.prop('tagName') == 'path') {
- item.hover(function(e) {
- var offset = $(this).offset();
- item.prop('offsetWidth', function() {
- return 2 * (e.pageX - offset.left);
- });
- item.prop('offsetHeight', function() {
- return 2 * (e.pageY - offset.top);
- });
- });
- };
- if (item.prop('offsetWidth') == undefined) {
- item.prop('offsetWidth', function() {
- return item.width();
- });
- };
- if (item.prop('offsetHeight') == undefined) {
- item.prop('offsetHeight', function() {
- return item.height();
- });
- };
- });
- App.tooltip($('.svg-tooltip'), {
- placement : 'left',
- template: '<div class="tooltip jobs-tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
- });
-
- if (App.supports.debugJobsDag) {
- // Draws node bounding box - for debug purposes
- node.append("rect").attr("width", function(n) {
- return n.effectiveWidth;
- }).attr("height", function(n) {
- return n.height;
- }).attr("x", function(n) {
- return -1 * ((n.effectiveWidth - n.width) / 2);
- }).attr("y", function(n) {
- return 0;
- }).attr("style", "opacity: 0.2;fill:yellow;");
- }
-
- // Position in center
- var translateX = Math.round((width - canvasWidth) / 2);
- if (translateX > 0) {
- svgLayer.attr("transform", "translate("+translateX+",0)");
- }
- return {
- width : canvasWidth,
- height : canvasHeight
- }
- },
-
- dragVertex: function(d3Vertex, node, newPosition, diagonal){
- console.debug("Dragging vertex [", node.name, "] to (", newPosition[0], ",", newPosition[1], ")");
- // Move vertex
- node.x = newPosition[0];
- node.y = newPosition[1];
- node.incomingX = newPosition[0] + (node.width/2);
- node.incomingY = newPosition[1];
- node.outgoingX = newPosition[0] + (node.width/2);
- node.outgoingY = newPosition[1] + node.height;
- d3Vertex.attr('transform', 'translate(' + newPosition[0] + ',' + newPosition[1] + ') scale('+node.scale+') ');
- // Move links
- d3.selectAll('.link').filter(function(l) {
- if (l && (l.source === node || l.target === node)) {
- return this
- }
- return null;
- }).attr('d', diagonal);
- },
-
- /**
- * Refreshes UI of the Tez graph with latest values
- */
- refreshGraphUI: function () {
- var svgLayer = this.get('svgVerticesLayer');
- if (svgLayer!=null) {
- var self = this;
- var metricNodes = svgLayer.selectAll(".metric");
- var metricNodeTexts = svgLayer.selectAll(".metric-text");
- var metricNodeTitles = svgLayer.selectAll(".metric-title");
- var nodeBackgrounds =svgLayer.selectAll(".background");
- var vertexIconTexts = svgLayer.selectAll(".vertex-icon-text");
- var vertexIconRects = svgLayer.selectAll(".vertex-icon-rect");
- metricNodes.attr("class", function(node) {
- var classes = "metric ";
- var percent = node.metricPercent;
- if (numberUtils.validateInteger(percent) == null && percent >= 0) {
- if (percent <= 20) {
- classes += "heat-0-20 ";
- } else if (percent <= 40) {
- classes += "heat-20-40 ";
- } else if (percent <= 60) {
- classes += "heat-40-60 ";
- } else if (percent <= 80) {
- classes += "heat-60-80 ";
- } else if (percent <= 100) {
- classes += "heat-80-100 ";
- } else {
- classes += "heat-none";
- }
- } else {
- classes += "heat-none";
- }
- return classes;
- });
- metricNodeTexts.text(function(node){
- if (node.type == App.TezDagVertexType.UNION) {
- return '';
- }
- return node.metricDisplay;
- });
- metricNodeTitles.attr("title", function(node){
- return node.metricType;
- }).attr("data-original-title", function(node){
- return node.metricType;
- });
- nodeBackgrounds.attr("class", function(n) {
- var classes = "background ";
- if (n.type) {
- classes += (n.type.toLowerCase() + " ");
- } else {
- classes += "unknown-vertex-type ";
- }
- if (n.selected) {
- classes += "selected ";
- }
- return classes;
- });
- vertexIconRects.attr('title', function(node) {
- return stringUtils.getCamelCase(node.state);
- }).attr('data-original-title', function(node) {
- return stringUtils.getCamelCase(node.state);
- });
- vertexIconTexts.text(function(n) {
- return self.getVertexIcon(n)
- }).attr('class', function(n) {
- var classes = 'vertex-icon-text ';
- if (n.state != null) {
- if (n.state == App.TezDagVertexState.JOBFAILED) {
- classes += App.TezDagVertexState.FAILED.toLowerCase();
- } else {
- classes += n.state.toLowerCase();
- };
- };
- return classes;
- });
- }
- },
-
- getVertexIcon : function(node){
- var icon = "";
- switch (node.state) {
- case App.TezDagVertexState.NEW:
- icon = '\uF10C'; //icon-circle-blank
- case App.TezDagVertexState.RUNNING:
- case App.TezDagVertexState.FAILED:
- icon = '\uF111'; //icon-circle
- break;
- case App.TezDagVertexState.SUCCEEDED:
- icon = '\uF00C'; //icon-ok
- break;
- case App.TezDagVertexState.KILLED:
- case App.TezDagVertexState.ERROR:
- icon = '\uF057'; //icon-remove-sign
- break;
- case App.TezDagVertexState.INITED:
- case App.TezDagVertexState.INITIALIZING:
- case App.TezDagVertexState.TERMINATING:
- icon = '\uF141'; //icon-ellipsis-horizontal
- break;
- case App.TezDagVertexState.JOBFAILED:
- icon = '\uF05C'; //icon-remove-circle
- break;
- }
- return icon;
- },
-
- /**
- * Determines the size of a node by taking into account its duration and
- * number of operations performed.
- *
- * @return {Object} Provides various metrics necessary in drawing a node.
- * <code>
- * {
- * width: 360, // Scaled width of the node
- * height: 80, // Scaled height of the node
- * scale: 2, // Scale used on vertex dimensions. Quickest vertex is scaled to 1 and slowest vertex is scaled to 10.
- * drawWidth: 180, // Width of actual drawing (that will be scaled)
- * drawHeight: 40 // Height of actual drawing (that will be scaled)
- * }
- * </code>
- */
- getNodeCalculatedDimensions : function(node, minVertexDuration, maxVertexDuration) {
- var size = {
- width : 180,
- height : 40,
- drawWidth : 180,
- drawHeight : 40,
- scale : 1
- }
- if (node.operations && node.operations.length > 0) {
- var opsHeight = Math.ceil(node.operations.length / 3);
- size.drawHeight += (opsHeight * 20);
- }
- size.width = size.drawWidth * size.scale;
- size.height = size.drawHeight * size.scale;
- return size;
- }
-
-});
-
-App.HoverOpTable = Ember.View.extend({
- templateName : require('templates/main/jobs/hover_op_table')
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/views/main/jobs/hive_job_details_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/jobs/hive_job_details_view.js b/ambari-web/app/views/main/jobs/hive_job_details_view.js
deleted file mode 100644
index d22ed20..0000000
--- a/ambari-web/app/views/main/jobs/hive_job_details_view.js
+++ /dev/null
@@ -1,351 +0,0 @@
-/**
- * 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.
- */
-
-var App = require('app');
-var date = require('utils/date');
-var numberUtils = require('utils/number_utils');
-var dateUtils = require('utils/date');
-var stringUtils = require('utils/string_utils');
-var sort = require('views/common/sort_view');
-
-App.MainHiveJobDetailsView = Em.View.extend({
- templateName : require('templates/main/jobs/hive_job_details'),
-
- selectedVertex : null,
- content : null,
- zoomScaleFrom : 1,
- zoomScaleTo: 2,
- zoomScale : 1,
- showQuery : false,
-
- zoomStep : function() {
- var zoomStep = 0.01;
- var zoomFrom = this.get('zoomScaleFrom');
- var zoomTo = this.get('zoomScaleTo');
- if (zoomFrom < zoomTo) {
- zoomStep = (zoomTo - zoomFrom) / 5;
- }
- return zoomStep;
- }.property('zoomScaleFrom', 'zoomScaleTo'),
- isGraphMaximized: false,
-
- toggleShowQuery : function () {
- this.toggleProperty('showQuery');
- var queryBlock = $('.query-info');
- if (this.get('showQuery')) {
- queryBlock.slideDown();
- } else {
- queryBlock.slideUp();
- };
- },
-
- toggleShowQueryText : function () {
- return this.get('showQuery') ? Em.I18n.t('jobs.hive.less') : Em.I18n.t('jobs.hive.more');
- }.property('showQuery'),
-
- summaryMetricType: 'input',
- summaryMetricTypesDisplay : [
- Em.I18n.t('jobs.hive.tez.metric.input'),
- Em.I18n.t('jobs.hive.tez.metric.output'),
- /* Em.I18n.t('jobs.hive.tez.metric.recordsRead'),
- Em.I18n.t('jobs.hive.tez.metric.recordsWrite'), */
- Em.I18n.t('jobs.hive.tez.metric.tezTasks'),
- Em.I18n.t('jobs.hive.tez.metric.spilledRecords')
- ],
- summaryMetricTypeDisplay: function(){
- return Em.I18n.t('jobs.hive.tez.metric.'+this.get('summaryMetricType'));
- }.property('summaryMetricType'),
-
- sortedVertices : function() {
- var sortColumn = this.get('controller.sortingColumn');
- if(sortColumn && sortColumn.get('status')){
- var sortColumnStatus = sortColumn.get('status');
- var sorted = sortColumn.get('parentView').sort(sortColumn, sortColumnStatus === "sorting_desc", true);
- sortColumn.set('status', sortColumnStatus);
- return sorted;
- }
- var vertices = this.get('controller.content.tezDag.vertices');
- if (vertices != null) {
- vertices = vertices.toArray();
- return vertices;
- }
- return vertices;
- }.property('content.tezDag.vertices','controller.sortingColumn'),
-
- initialDataLoaded : function() {
- var loaded = this.get('controller.loaded');
- if (loaded) {
- this.set('content', this.get('controller.content'));
- }
- }.observes('controller.loaded'),
-
- yarnApplicationIdLink : function() {
- var yarnService = App.YARNService.find().objectAt(0);
- var appId = this.get('content.tezDag.yarnApplicationId');
- if (yarnService != null) {
- var quickLinksView = App.QuickViewLinks.create();
- try {
- quickLinksView.set('content', yarnService);
- quickLinksView.setQuickLinks();
- var links = quickLinksView.get('quickLinks');
- if (links && links.length > 0) {
- var rmUILink = links.findProperty('label', 'ResourceManager UI');
- if (rmUILink != null) {
- return rmUILink.get('url') + '/cluster/app/' + appId;
- }
- }
- } finally {
- quickLinksView.destroy();
- quickLinksView = null;
- }
- }
- return null;
- }.property('content.tezDag.yarnApplicationId', 'App.YARNService.resourceManager.hostName'),
-
- jobObserver : function() {
- var content = this.get('content');
- var selectedVertex = this.get('selectedVertex');
- if (selectedVertex == null && content != null) {
- var vertices = content.get('tezDag.vertices');
- if (vertices) {
- vertices.setEach('isSelected', false);
- this.doSelectVertex({
- context : vertices.objectAt(0)
- }, false);
- }
- }
- }.observes('selectedVertex', 'content.tezDag.vertices.@each.id'),
-
- doSelectVertex : function(event,notTableClick) {
- notTableClick = notTableClick ? true : false;
- var newVertex = event.context;
- var currentVertex = this.get('selectedVertex');
- if (currentVertex != null) {
- currentVertex.set('isSelected', false);
- }
- newVertex.set('notTableClick', notTableClick);
- newVertex.set('isSelected', true);
- this.set('selectedVertex', newVertex);
- },
-
- doSelectSummaryMetricType: function(event) {
- var summaryType = event.context;
- switch (summaryType) {
- case Em.I18n.t('jobs.hive.tez.metric.input'):
- summaryType = 'input';
- break;
- case Em.I18n.t('jobs.hive.tez.metric.output'):
- summaryType = 'output';
- break;
- case Em.I18n.t('jobs.hive.tez.metric.recordsRead'):
- summaryType = 'recordsRead';
- break;
- case Em.I18n.t('jobs.hive.tez.metric.recordsWrite'):
- summaryType = 'recordsWrite';
- break;
- case Em.I18n.t('jobs.hive.tez.metric.tezTasks'):
- summaryType = 'tezTasks';
- break;
- case Em.I18n.t('jobs.hive.tez.metric.spilledRecords'):
- summaryType = 'spilledRecords';
- break;
- default:
- break;
- }
- this.set('summaryMetricType', summaryType);
- },
-
- /**
- * Provides display information for vertex I/O.
- *
- * {
- * 'file': {
- * 'read': {
- * 'ops': '100 reads',
- * 'bytes': '10 MB'
- * }
- * 'write: {
- * 'ops': '200 writes',
- * 'bytes': '20 MB'
- * }
- * },
- * 'hdfs': {
- * 'read': {
- * 'ops': '100 reads',
- * 'bytes': '10 MB'
- * }
- * 'write: {
- * 'ops': '200 writes',
- * 'bytes': '20 MB'
- * }
- * },
- * 'records': {
- * 'read': '100 records',
- * 'write': '123 records'
- * },
- * 'started': 'Feb 12, 2014 10:30am',
- * 'ended': 'Feb 12, 2014 10:35am',
- * 'status': 'Running'
- * }
- */
- selectedVertexIODisplay : function() {
- var v = this.get('selectedVertex');
- var status = v.get('state');
- if (status) {
- status = stringUtils.getCamelCase(status);
- }
- var fileReadOps = v.get('fileReadOps');
- var fileWriteOps = v.get('fileWriteOps');
- var hdfsReadOps = v.get('hdfsReadOps');
- var hdfsWriteOps = v.get('hdfsWriteOps');
- var naString = Em.I18n.t('common.na');
- if (fileReadOps === null) {
- fileReadOps = naString;
- }
- if (fileWriteOps === null) {
- fileWriteOps = naString;
- }
- if (hdfsReadOps === null) {
- hdfsReadOps = naString;
- }
- if (hdfsWriteOps === null) {
- hdfsWriteOps = naString;
- }
- return {
- file : {
- read : {
- ops : Em.I18n.t('jobs.hive.tez.reads').format(fileReadOps),
- bytes : numberUtils.bytesToSize(v.get('fileReadBytes'))
- },
- write : {
- ops : Em.I18n.t('jobs.hive.tez.writes').format(fileWriteOps),
- bytes : numberUtils.bytesToSize(v.get('fileWriteBytes'))
- }
- },
- hdfs : {
- read : {
- ops : Em.I18n.t('jobs.hive.tez.reads').format(hdfsReadOps),
- bytes : numberUtils.bytesToSize(v.get('hdfsReadBytes'))
- },
- write : {
- ops : Em.I18n.t('jobs.hive.tez.writes').format(hdfsWriteOps),
- bytes : numberUtils.bytesToSize(v.get('hdfsWriteBytes'))
- }
- },
- records : {
- read : v.get('recordReadCount') == null ? null : Em.I18n.t('jobs.hive.tez.records.count').format(v.get('recordReadCount')),
- write : v.get('recordWriteCount') == null ? null : Em.I18n.t('jobs.hive.tez.records.count').format(v.get('recordWriteCount'))
- },
- started: v.get('startTime') ? dateUtils.dateFormat(v.get('startTime'), 'ddd, MMM DD, YYYY HH:mm:ss:SSS') : '',
- ended: v.get('endTime') ? dateUtils.dateFormat(v.get('endTime'), 'ddd, MMM DD, YYYY HH:mm:ss:SSS') : '',
- status: status
- };
- }.property('selectedVertex.fileReadOps', 'selectedVertex.fileWriteOps', 'selectedVertex.hdfsReadOps', 'selectedVertex.hdfdWriteOps',
- 'selectedVertex.fileReadBytes', 'selectedVertex.fileWriteBytes', 'selectedVertex.hdfsReadBytes', 'selectedVertex.hdfdWriteBytes',
- 'selectedVertex.recordReadCount', 'selectedVertex.recordWriteCount', 'selectedVertex.status'),
-
- canGraphZoomIn : function() {
- var zoomTo = this.get('zoomScaleTo');
- var zoomScale = this.get('zoomScale');
- console.debug("canGraphZoomIn? : ", (zoomScale < zoomTo), " (scaleTo=", zoomTo,", scale=",zoomScale,")");
- return zoomScale < zoomTo;
- }.property('zoomScale', 'zoomScaleTo'),
-
- canGraphZoomOut : function() {
- var zoomFrom = this.get('zoomScaleFrom');
- var zoomScale = this.get('zoomScale');
- console.debug("canGraphZoomOut? : ", (zoomScale > zoomFrom), " (scaleFrom=", zoomFrom,", scale=",zoomScale,")");
- return zoomScale > zoomFrom;
- }.property('zoomScale', 'zoomScaleFrom'),
-
- doGraphZoomIn: function() {
- var zoomTo = this.get('zoomScaleTo');
- var zoomScale = this.get('zoomScale');
- var zoomStep = this.get('zoomStep');
- if (zoomScale < zoomTo) {
- var step = Math.min(zoomStep, (zoomTo - zoomScale));
- zoomScale += step;
- console.debug("doGraphZoomIn(): New scale = ", zoomScale);
- this.set('zoomScale', zoomScale);
- }
- },
-
- doGraphZoomOut: function() {
- var zoomFrom = this.get('zoomScaleFrom');
- var zoomScale = this.get('zoomScale');
- var zoomStep = this.get('zoomStep');
- if (zoomScale > zoomFrom) {
- var step = Math.min(zoomStep, (zoomScale - zoomFrom));
- zoomScale -= step;
- console.debug("doGraphZoomOut(): New scale = ", zoomScale);
- this.set('zoomScale', zoomScale);
- }
- },
-
- doGraphMaximize: function() {
- this.set('isGraphMaximized', true);
- },
-
- doGraphMinimize: function() {
- this.set('isGraphMaximized', false);
- }
-});
-
-App.MainHiveJobDetailsVerticesTableView = App.TableView.extend({
- sortView: sort.wrapperView,
-
- didInsertElement: function () {
- if(!this.get('controller.sortingColumn')){
- var columns = this.get('childViews')[0].get('childViews');
- if(columns && columns.findProperty('name', 'name')){
- columns.findProperty('name','name').set('status', 'sorting_asc');
- this.get('controller').set('sortingColumn', columns.findProperty('name','name'))
- }
- }
- },
-
- nameSort: sort.fieldView.extend({
- column: 0,
- name: 'name',
- displayName: Em.I18n.t('common.name'),
- type: 'string'
- }),
- tasksSort: sort.fieldView.extend({
- column: 1,
- name: 'tasksNumber',
- displayName: Em.I18n.t('common.tasks'),
- type: 'number'
- }),
- inputSort: sort.fieldView.extend({
- column: 2,
- name: 'totalReadBytes',
- displayName: Em.I18n.t('apps.item.dag.input'),
- type: 'number'
- }),
- outputSort: sort.fieldView.extend({
- column: 3,
- name: 'totalWriteBytes',
- displayName: Em.I18n.t('apps.item.dag.output'),
- type: 'number'
- }),
- durationSort: sort.fieldView.extend({
- column: 4,
- name: 'duration',
- displayName: Em.I18n.t('apps.item.dag.duration'),
- type: 'number'
- })
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/views/main/jobs/select_custom_date_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/jobs/select_custom_date_view.js b/ambari-web/app/views/main/jobs/select_custom_date_view.js
deleted file mode 100644
index d0c03ef..0000000
--- a/ambari-web/app/views/main/jobs/select_custom_date_view.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * 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.
- */
-
-var App = require('app');
-var date = require('utils/date');
-
-App.JobsCustomDatesSelectView = Em.View.extend({
- name: 'jobsCustomDatesSelectView',
- templateName: require('templates/main/jobs/custom_dates_popup'),
-
- middayPeriodOptions: [Em.I18n.t('jobs.table.custom.date.am'), Em.I18n.t('jobs.table.custom.date.pm')],
-
- hourOptions: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'],
-
- minuteOptions: ['00', '05', '10', '15', '20', '25', '30', '35', '40', '45', '50', '55'],
-
- didInsertElement: function () {
- $('.datepicker').datepicker({
- format: 'mm/dd/yyyy'
- });
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/views/main/jobs_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/jobs_view.js b/ambari-web/app/views/main/jobs_view.js
deleted file mode 100644
index ea6cec9..0000000
--- a/ambari-web/app/views/main/jobs_view.js
+++ /dev/null
@@ -1,336 +0,0 @@
-/**
- * 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.
- */
-
-var App = require('app');
-var filters = require('views/common/filter_view');
-var sort = require('views/common/sort_view');
-
-App.MainJobsView = App.TableView.extend({
- templateName: require('templates/main/jobs'),
-
- content: [],
-
-
- /**
- * If no jobs table rows to show.
- */
- noDataToShow:true,
-
- filterCondition:[],
-
- /*
- If no jobs to display set noDataToShow to true, else set emptyData to false.
- */
- noDataToShowObserver: function () {
- if(this.get("controller.content.length") > 0){
- this.set("noDataToShow",false);
- }else{
- this.set("noDataToShow",true);
- }
- }.observes("controller.content.length"),
-
- willInsertElement: function () {
- this._super();
- var self = this;
- var name = this.get('controller.name');
- var colPropAssoc = this.get('colPropAssoc');
- var filterConditions = App.db.getFilterConditions(name);
- if (filterConditions) {
- this.set('filterConditions', filterConditions);
- var childViews = this.get('childViews');
-
- filterConditions.forEach(function(condition) {
- var view = !Em.isNone(condition.iColumn) && childViews.findProperty('column', condition.iColumn);
- if (view) {
- //self.get('controller.filterObject').set(colPropAssoc[condition.iColumn], condition.value);
- view.set('value', condition.value);
- if(view.get('setPropertyOnApply')){
- view.setValueOnApply();
- }
- Em.run.next(function() {
- view.showClearFilter();
- });
- }
- });
- } else {
- this.clearFilters();
- }
- this.onApplyIdFilter();
- this.set('tableFilteringComplete', true);
- },
-
- didInsertElement: function () {
- if(!this.get('controller.sortingColumn')){
- var columns = this.get('childViews')[0].get('childViews')
- if(columns && columns.findProperty('name', 'startTime')){
- columns.findProperty('name','startTime').set('status', 'sorting_desc');
- this.get('controller').set('sortingColumn', columns.findProperty('name','startTime'))
- }
- }
- },
-
- onApplyIdFilter: function() {
- var isIdFilterApplied = this.get('controller.filterObject.isIdFilterApplied');
- this.get('childViews').forEach(function(childView) {
- if (childView['clearFilter'] && childView.get('column') != 1) {
- if(isIdFilterApplied){
- childView.clearFilter();
- }
- var childOfChild = childView.get('childViews')[0];
- if(childOfChild){
- Em.run.next(function() {
- childOfChild.set('disabled', isIdFilterApplied);
- })
- }
- }
- });
- }.observes('controller.filterObject.isIdFilterApplied'),
-
- saveFilter: function () {
- if(this.get('tableFilteringComplete')){
- this.updateFilter(1, this.get('controller.filterObject.id'), 'string');
- this.updateFilter(2, this.get('controller.filterObject.user'), 'string');
- this.updateFilter(4, this.get('controller.filterObject.windowEnd'), 'date');
- }
- }.observes(
- 'controller.filterObject.id',
- 'controller.filterObject.user',
- 'controller.filterObject.windowEnd'
- ),
-
- sortView: sort.wrapperView,
- idSort: sort.fieldView.extend({
- column: 1,
- name: 'id',
- displayName: Em.I18n.t('jobs.column.id'),
- type: 'string'
- }),
- userSort: sort.fieldView.extend({
- column: 2,
- name: 'user',
- displayName: Em.I18n.t('jobs.column.user'),
- type: 'string'
- }),
- startTimeSort: sort.fieldView.extend({
- column: 3,
- name: 'startTime',
- displayName: Em.I18n.t('jobs.column.start.time'),
- type: 'number'
- }),
- endTimeSort: sort.fieldView.extend({
- column: 4,
- name: 'endTime',
- displayName: Em.I18n.t('jobs.column.end.time'),
- type: 'number'
- }),
- durationSort: sort.fieldView.extend({
- column: 5,
- name: 'duration',
- displayName: Em.I18n.t('jobs.column.duration'),
- type: 'number'
- }),
-
- /**
- * Select View with list of "rows-per-page" options
- * @type {Ember.View}
- */
- rowsPerPageSelectView: Em.Select.extend({
- content: ['10', '25', '50', '100', "250", "500"],
- valueBinding: "controller.filterObject.jobsLimit",
- attributeBindings: ['disabled'],
- disabled: false,
- disabledObserver: function () {
- if (this.get("parentView.hasBackLinks")) {
- this.set('disabled', true);
- }else{
- this.set('disabled', false);
- }
- }.observes('parentView.hasBackLinks'),
- change: function () {
- this.get('controller').set('navIDs.nextID', '');
- this.get('parentView').saveDisplayLength();
- }
- }),
-
- /**
- * return filtered number of all content number information displayed on the page footer bar
- * @returns {String}
- */
- filteredJobs: function () {
- return Em.I18n.t('jobs.filtered.jobs').format(this.get('controller.content.length'));
- }.property('controller.content.length', 'controller.totalOfJobs'),
-
- pageContentObserver: function () {
- if (!this.get('controller.loading')) {
- if ($('.tooltip').length) {
- Ember.run.later(this, function() {
- if ($('.tooltip').length > 1) {
- $('.tooltip').first().remove();
- };
- }, 500);
- };
- };
- }.observes('controller.loading'),
-
- init: function() {
- this._super();
- App.tooltip($('body'), {
- selector: '[rel="tooltip"]',
- template: '<div class="tooltip jobs-tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
- placement: 'bottom'
- });
- },
-
- willDestroyElement : function() {
- $('.tooltip').remove();
- },
-
- /**
- * Filter-field for Jobs ID.
- * Based on <code>filters</code> library
- */
- jobsIdFilterView: filters.createTextView({
- column: 1,
- showApply: true,
- setPropertyOnApply: 'controller.filterObject.id'
- }),
-
- /**
- * Filter-list for User.
- * Based on <code>filters</code> library
- */
- userFilterView: filters.createTextView({
- column: 2,
- fieldType: 'input-small',
- showApply: true,
- setPropertyOnApply: 'controller.filterObject.user'
- }),
-
- /**
- * Filter-field for Start Time.
- * Based on <code>filters</code> library
- */
- startTimeFilterView: filters.createSelectView({
- fieldType: 'input-120',
- column: 3,
- content: ['Any', 'Past 1 hour', 'Past 1 Day', 'Past 2 Days', 'Past 7 Days', 'Past 14 Days', 'Past 30 Days', 'Custom'],
- valueBinding: "controller.filterObject.startTime",
- onChangeValue: function () {
- this.get('parentView').updateFilter(this.get('column'), this.get('value'), 'date');
- }
- }),
-
- jobNameView: Em.View.extend({
- classNames: ['job-link'],
- tagName: 'a',
- classNameBindings: ['isLink'],
- attributeBindings: ['rel', 'job.queryText:data-original-title', 'href'],
- rel: 'tooltip',
- href: '#',
- isLink: 'is-not-link',
- isLinkObserver: function () {
- this.refreshLinks();
- }.observes('controller.sortingDone'),
- refreshLinks: function () {
- if (this.get('job.hasTezDag')) {
- this.set('isLink', "");
- }else{
- this.set('isLink', "is-not-link");
- }
- },
- template: Ember.Handlebars.compile('{{job.name}}'),
- click: function(event) {
- if (this.get('job.hasTezDag')) {
- App.router.transitionTo('main.jobs.jobDetails', this.get('job'));
- };
- return false;
- },
- didInsertElement: function () {
- this.refreshLinks();
- }
- }),
-
- /**
- * associations between content (jobs list) property and column index
- */
- colPropAssoc: function () {
- var associations = [];
- associations[1] = 'id';
- associations[2] = 'user';
- associations[3] = 'startTime';
- associations[4] = 'endTime';
- return associations;
- }.property(),
-
- clearFilters: function() {
- this.get('childViews').forEach(function(childView) {
- if (childView['clearFilter']) {
- childView.clearFilter();
- }
- });
- },
-
- jobFailMessage: function() {
- return Em.I18n.t('jobs.table.job.fail');
- }.property(),
-
- jobsPaginationLeft: Ember.View.extend({
- tagName: 'a',
- template: Ember.Handlebars.compile('<i class="icon-arrow-left"></i>'),
- classNameBindings: ['class'],
- class: function () {
- if (this.get("parentView.hasBackLinks") && !this.get('controller.filterObject.isAnyFilterApplied')) {
- return "paginate_previous";
- }
- return "paginate_disabled_previous";
- }.property('parentView.hasBackLinks', 'controller.filterObject.isAnyFilterApplied'),
-
- click: function () {
- if (this.get("parentView.hasBackLinks") && !this.get('controller.filterObject.isAnyFilterApplied')) {
- this.get('controller').navigateBack();
- }
- }
- }),
-
- jobsPaginationRight: Ember.View.extend({
- tagName: 'a',
- template: Ember.Handlebars.compile('<i class="icon-arrow-right"></i>'),
- classNameBindings: ['class'],
- class: function () {
- if (this.get("parentView.hasNextJobs") && !this.get('controller.filterObject.isAnyFilterApplied')) {
- return "paginate_next";
- }
- return "paginate_disabled_next";
- }.property("parentView.hasNextJobs", 'controller.filterObject.isAnyFilterApplied'),
-
- click: function () {
- if (this.get("parentView.hasNextJobs") && !this.get('controller.filterObject.isAnyFilterApplied')) {
- this.get('controller').navigateNext();
- }
- }
- }),
-
- hasNextJobs: function() {
- return (this.get("controller.navIDs.nextID.length") > 0);
- }.property('controller.navIDs.nextID'),
-
- hasBackLinks: function() {
- return (this.get("controller.navIDs.backIDs").length > 1);
- }.property('controller.navIDs.backIDs.[].length')
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/views/main/menu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/menu.js b/ambari-web/app/views/main/menu.js
index 9ac0f40..b81c90c 100644
--- a/ambari-web/app/views/main/menu.js
+++ b/ambari-web/app/views/main/menu.js
@@ -48,9 +48,6 @@ App.MainMenuView = Em.CollectionView.extend({
if (!App.get('isHadoop2Stack')) {
result.push({ label:Em.I18n.t('menu.item.jobs'), routing:'apps'});
- } else if( App.router.get('mainAdminController.isAccessAvailable') && App.supports.jobs
- && (App.router.get('mainAdminAccessController.showJobs') || App.get('isAdmin'))) {
- result.push({ label:Em.I18n.t('menu.item.jobs'), routing:'jobs'});
}
if (App.get('isAdmin')) {
@@ -65,7 +62,7 @@ App.MainMenuView = Em.CollectionView.extend({
}
return result;
- }.property('App.router.loggedIn', 'App.router.clusterController.isLoaded', 'App.supports.views', 'App.supports.mirroring', 'App.supports.secureCluster', 'App.supports.highAvailability', 'App.supports.jobs'),
+ }.property('App.router.loggedIn', 'App.router.clusterController.isLoaded', 'App.supports.views', 'App.supports.mirroring', 'App.supports.secureCluster', 'App.supports.highAvailability'),
/**
* Adds observer on lastSetURL and calls navigation sync procedure
[5/6] git commit: AMBARI-6848 Service config version should always
clone and rev up (not simply point to an older version) (dsen)
Posted by jo...@apache.org.
AMBARI-6848 Service config version should always clone and rev up (not simply point to an older version) (dsen)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6eb753d8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6eb753d8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6eb753d8
Branch: refs/heads/branch-alerts-dev
Commit: 6eb753d8cbc8fb89d0efb15234c543121a1f83ad
Parents: 16d8093
Author: Dmytro Sen <ds...@hortonworks.com>
Authored: Thu Aug 14 14:30:56 2014 +0300
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Thu Aug 14 09:19:16 2014 -0400
----------------------------------------------------------------------
.../ServiceConfigVersionResponse.java | 11 -
.../ServiceConfigVersionResourceProvider.java | 2 -
.../ambari/server/orm/dao/ServiceConfigDAO.java | 37 +--
.../ServiceConfigApplicationEntity.java | 114 --------
.../orm/entities/ServiceConfigEntity.java | 34 ++-
.../server/state/cluster/ClusterImpl.java | 76 +++--
.../server/upgrade/UpgradeCatalog170.java | 9 +-
.../main/resources/Ambari-DDL-MySQL-CREATE.sql | 12 +-
.../main/resources/Ambari-DDL-Oracle-CREATE.sql | 8 +-
.../resources/Ambari-DDL-Postgres-CREATE.sql | 9 +-
.../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql | 11 +-
.../src/main/resources/properties.json | 1 -
.../server/orm/dao/ServiceConfigDAOTest.java | 282 +++++++++++++++++++
.../orm/entities/ServiceConfigEntityTest.java | 49 ++++
.../server/state/cluster/ClusterTest.java | 57 +++-
.../server/upgrade/UpgradeCatalog170Test.java | 11 +
16 files changed, 486 insertions(+), 237 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/6eb753d8/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
index 491f112..f463a4b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
@@ -30,7 +30,6 @@ public class ServiceConfigVersionResponse {
private String serviceName;
private Long version;
private Long createTime;
- private Long applyTime;
private String userName;
private String note;
private List<ConfigurationResponse> configurations;
@@ -63,16 +62,6 @@ public class ServiceConfigVersionResponse {
this.createTime = createTime;
}
- @JsonProperty("appliedtime")
- @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
- public Long getApplyTime() {
- return applyTime;
- }
-
- public void setApplyTime(Long applyTime) {
- this.applyTime = applyTime;
- }
-
@JsonProperty("user")
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public String getUserName() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/6eb753d8/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
index 581ed54..1713d01 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceConfigVersionResourceProvider.java
@@ -36,7 +36,6 @@ public class ServiceConfigVersionResourceProvider extends
public static final String SERVICE_CONFIG_VERSION_PROPERTY_ID = PropertyHelper.getPropertyId(null, "serviceconfigversion");
public static final String SERVICE_CONFIG_VERSION_SERVICE_NAME_PROPERTY_ID = PropertyHelper.getPropertyId(null, "service_name");
public static final String SERVICE_CONFIG_VERSION_CREATE_TIME_PROPERTY_ID = PropertyHelper.getPropertyId(null, "createtime");
- public static final String SERVICE_CONFIG_VERSION_APPLY_TIME_PROPERTY_ID = PropertyHelper.getPropertyId(null, "appliedtime");
public static final String SERVICE_CONFIG_VERSION_USER_PROPERTY_ID = PropertyHelper.getPropertyId(null, "user");
public static final String SERVICE_CONFIG_VERSION_NOTE_PROPERTY_ID = PropertyHelper.getPropertyId(null, "service_config_version_note");
public static final String SERVICE_CONFIG_VERSION_CONFIGURATIONS_PROPERTY_ID = PropertyHelper.getPropertyId(null, "configurations");
@@ -98,7 +97,6 @@ public class ServiceConfigVersionResourceProvider extends
resource.setProperty(SERVICE_CONFIG_VERSION_SERVICE_NAME_PROPERTY_ID, response.getServiceName());
resource.setProperty(SERVICE_CONFIG_VERSION_USER_PROPERTY_ID, response.getUserName());
resource.setProperty(SERVICE_CONFIG_VERSION_PROPERTY_ID, response.getVersion());
- resource.setProperty(SERVICE_CONFIG_VERSION_APPLY_TIME_PROPERTY_ID, response.getApplyTime());
resource.setProperty(SERVICE_CONFIG_VERSION_CREATE_TIME_PROPERTY_ID, response.getCreateTime());
resource.setProperty(SERVICE_CONFIG_VERSION_CONFIGURATIONS_PROPERTY_ID,
convertToSubResources(response.getClusterName(), response.getConfigurations()));
http://git-wip-us.apache.org/repos/asf/ambari/blob/6eb753d8/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
index 698e655..add58fc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
@@ -23,7 +23,6 @@ import com.google.inject.Provider;
import com.google.inject.Singleton;
import com.google.inject.persist.Transactional;
import org.apache.ambari.server.orm.RequiresSession;
-import org.apache.ambari.server.orm.entities.ServiceConfigApplicationEntity;
import org.apache.ambari.server.orm.entities.ServiceConfigEntity;
import javax.persistence.EntityManager;
@@ -72,21 +71,24 @@ public class ServiceConfigDAO {
return daoUtils.selectList(query, clusterId, configType, configVersion);
}
- public List<ServiceConfigApplicationEntity> getLastApplications(Long clusterId) {
- TypedQuery<ServiceConfigApplicationEntity> query = entityManagerProvider.get().
- createQuery("SELECT sca FROM ServiceConfigEntity scv JOIN scv.serviceConfigApplicationEntities sca " +
- "WHERE scv.clusterId = ?1 AND sca.applyTimestamp = (" +
- "SELECT max(sca2.applyTimestamp) FROM ServiceConfigApplicationEntity sca2 JOIN sca2.serviceConfigEntity scv2 WHERE scv2.serviceName = scv.serviceName " +
- "AND scv2.clusterId = ?1)",
- ServiceConfigApplicationEntity.class);
+ public List<ServiceConfigEntity> getLastServiceConfigs(Long clusterId) {
+ TypedQuery<ServiceConfigEntity> query = entityManagerProvider.get().
+ createQuery("SELECT scv FROM ServiceConfigEntity scv " +
+ "WHERE scv.clusterId = ?1 AND scv.createTimestamp = (" +
+ "SELECT MAX(scv2.createTimestamp) FROM ServiceConfigEntity scv2 " +
+ "WHERE scv2.serviceName = scv.serviceName AND scv2.clusterId = ?1)",
+ ServiceConfigEntity.class);
+
return daoUtils.selectList(query, clusterId);
}
- public ServiceConfigApplicationEntity getLastApplication(Long clusterId, String serviceName) {
- TypedQuery<ServiceConfigApplicationEntity> query = entityManagerProvider.get().
- createQuery("SELECT sca FROM ServiceConfigEntity scv JOIN scv.serviceConfigApplicationEntities sca " +
- "WHERE scv.clusterId = ?1 AND scv.serviceName = ?2 ORDER BY sca.applyTimestamp DESC",
- ServiceConfigApplicationEntity.class);
+ public ServiceConfigEntity getLastServiceConfig(Long clusterId, String serviceName) {
+ TypedQuery<ServiceConfigEntity> query = entityManagerProvider.get().
+ createQuery("SELECT scv FROM ServiceConfigEntity scv " +
+ "WHERE scv.clusterId = ?1 AND scv.serviceName = ?2 " +
+ "ORDER BY scv.createTimestamp DESC",
+ ServiceConfigEntity.class);
+
return daoUtils.selectOne(query, clusterId, serviceName);
}
@@ -99,10 +101,11 @@ public class ServiceConfigDAO {
return daoUtils.selectSingle(query, clusterId, serviceName);
}
- public List<ServiceConfigApplicationEntity> getServiceConfigApplications(Long clusterId) {
- TypedQuery<ServiceConfigApplicationEntity> query = entityManagerProvider.get().createQuery(
- "SELECT apply FROM ServiceConfigApplicationEntity apply JOIN apply.serviceConfigEntity scv " +
- "WHERE scv.clusterId=?1 ORDER BY apply.applyTimestamp DESC", ServiceConfigApplicationEntity.class);
+ public List<ServiceConfigEntity> getServiceConfigs(Long clusterId) {
+ TypedQuery<ServiceConfigEntity> query = entityManagerProvider.get()
+ .createQuery("SELECT scv FROM ServiceConfigEntity scv " +
+ "WHERE scv.clusterId=?1 " +
+ "ORDER BY scv.createTimestamp DESC", ServiceConfigEntity.class);
return daoUtils.selectList(query, clusterId);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6eb753d8/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigApplicationEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigApplicationEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigApplicationEntity.java
deleted file mode 100644
index 6f2f441..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigApplicationEntity.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.ambari.server.orm.entities;
-
-import javax.persistence.Basic;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import javax.persistence.TableGenerator;
-
-@Entity
-@Table(name = "serviceconfigapplication")
-@TableGenerator(name = "service_config_application_id_generator",
- table = "ambari_sequences", pkColumnName = "sequence_name", valueColumnName = "value"
- , pkColumnValue = "service_config_application_id_seq"
- , initialValue = 1
- , allocationSize = 1
-)
-public class ServiceConfigApplicationEntity {
- @Id
- @Column(name = "apply_id")
- @GeneratedValue(strategy = GenerationType.TABLE, generator = "service_config_application_id_generator")
- private Long applyId;
-
- @Basic
- @Column(name = "service_config_id", updatable = false, insertable = false, nullable = false)
- private Long serviceConfigId;
-
- @Basic
- @Column(name = "apply_timestamp")
- private Long applyTimestamp;
-
- @Basic
- @Column(name = "user_name")
- private String user = "_db";
-
- @Basic
- @Column(name = "note")
- private String note;
-
- @ManyToOne
- @JoinColumn(name = "service_config_id", referencedColumnName = "service_config_id")
- private ServiceConfigEntity serviceConfigEntity;
-
-
- public Long getApplyId() {
- return applyId;
- }
-
- public void setApplyId(Long applyId) {
- this.applyId = applyId;
- }
-
- public Long getServiceConfigId() {
- return serviceConfigId;
- }
-
- public void setServiceConfigId(Long serviceConfigId) {
- this.serviceConfigId = serviceConfigId;
- }
-
- public Long getApplyTimestamp() {
- return applyTimestamp;
- }
-
- public void setApplyTimestamp(Long applyTimestamp) {
- this.applyTimestamp = applyTimestamp;
- }
-
- public ServiceConfigEntity getServiceConfigEntity() {
- return serviceConfigEntity;
- }
-
- public void setServiceConfigEntity(ServiceConfigEntity serviceConfigEntity) {
- this.serviceConfigEntity = serviceConfigEntity;
- }
-
- public String getUser() {
- return user;
- }
-
- public void setUser(String user) {
- this.user = user;
- }
-
- public String getNote() {
- return note;
- }
-
- public void setNote(String note) {
- this.note = note;
- }
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6eb753d8/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigEntity.java
index 2727388..ce47e28 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigEntity.java
@@ -64,8 +64,13 @@ public class ServiceConfigEntity {
@Column(name = "create_timestamp", nullable = false)
private Long createTimestamp = System.currentTimeMillis();
- @OneToMany(mappedBy = "serviceConfigEntity", cascade = CascadeType.ALL)
- private List<ServiceConfigApplicationEntity> serviceConfigApplicationEntities;
+ @Basic
+ @Column(name = "user_name")
+ private String user = "_db";
+
+ @Basic
+ @Column(name = "note")
+ private String note;
@ManyToMany
@JoinTable(
@@ -111,15 +116,6 @@ public class ServiceConfigEntity {
this.createTimestamp = create_timestamp;
}
-
- public List<ServiceConfigApplicationEntity> getServiceConfigApplicationEntities() {
- return serviceConfigApplicationEntities;
- }
-
- public void setServiceConfigApplicationEntities(List<ServiceConfigApplicationEntity> serviceConfigApplicationEntities) {
- this.serviceConfigApplicationEntities = serviceConfigApplicationEntities;
- }
-
public List<ClusterConfigEntity> getClusterConfigEntities() {
return clusterConfigEntities;
}
@@ -143,4 +139,20 @@ public class ServiceConfigEntity {
public void setClusterEntity(ClusterEntity clusterEntity) {
this.clusterEntity = clusterEntity;
}
+
+ public String getUser() {
+ return user;
+ }
+
+ public void setUser(String user) {
+ this.user = user;
+ }
+
+ public String getNote() {
+ return note;
+ }
+
+ public void setNote(String note) {
+ this.note = note;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6eb753d8/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
index eb5d36d..00316ce 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
@@ -65,7 +65,6 @@ import org.apache.ambari.server.orm.entities.PermissionEntity;
import org.apache.ambari.server.orm.entities.PrivilegeEntity;
import org.apache.ambari.server.orm.entities.RequestScheduleEntity;
import org.apache.ambari.server.orm.entities.ResourceEntity;
-import org.apache.ambari.server.orm.entities.ServiceConfigApplicationEntity;
import org.apache.ambari.server.orm.entities.ServiceConfigEntity;
import org.apache.ambari.server.state.*;
import org.apache.ambari.server.state.configgroup.ConfigGroup;
@@ -1423,7 +1422,7 @@ public class ClusterImpl implements Cluster {
readWriteLock.writeLock().lock();
try {
applyServiceConfigVersion(serviceName, version, user, note);
-
+ configHelper.invalidateStaleConfigsCache();
return true;
} finally {
readWriteLock.writeLock().unlock();
@@ -1462,14 +1461,17 @@ public class ClusterImpl implements Cluster {
readWriteLock.readLock().lock();
try {
List<ServiceConfigVersionResponse> serviceConfigVersionResponses = new ArrayList<ServiceConfigVersionResponse>();
- for (ServiceConfigApplicationEntity applicationEntity : serviceConfigDAO.getServiceConfigApplications(getClusterId())) {
- ServiceConfigVersionResponse serviceConfigVersionResponse =
- convertToServiceConfigVersionResponse(applicationEntity);
-
+ for (ServiceConfigEntity serviceConfigEntity : serviceConfigDAO.getServiceConfigs(getClusterId())) {
+ ServiceConfigVersionResponse serviceConfigVersionResponse = new ServiceConfigVersionResponse();
+
+ serviceConfigVersionResponse.setClusterName(getClusterName());
+ serviceConfigVersionResponse.setServiceName(serviceConfigEntity.getServiceName());
+ serviceConfigVersionResponse.setVersion(serviceConfigEntity.getVersion());
+ serviceConfigVersionResponse.setCreateTime(serviceConfigEntity.getCreateTimestamp());
+ serviceConfigVersionResponse.setUserName(serviceConfigEntity.getUser());
+ serviceConfigVersionResponse.setNote(serviceConfigEntity.getNote());
serviceConfigVersionResponse.setConfigurations(new ArrayList<ConfigurationResponse>());
- ServiceConfigEntity serviceConfigEntity = applicationEntity.getServiceConfigEntity();
-
List<ClusterConfigEntity> clusterConfigEntities = serviceConfigEntity.getClusterConfigEntities();
for (ClusterConfigEntity clusterConfigEntity : clusterConfigEntities) {
Config config = allConfigs.get(clusterConfigEntity.getType()).get(clusterConfigEntity.getTag());
@@ -1493,36 +1495,33 @@ public class ClusterImpl implements Cluster {
@RequiresSession
Set<ServiceConfigVersionResponse> getActiveServiceConfigVersionSet() {
Set<ServiceConfigVersionResponse> responses = new HashSet<ServiceConfigVersionResponse>();
- List<ServiceConfigApplicationEntity> lastApplications = serviceConfigDAO.getLastApplications(getClusterId());
- for (ServiceConfigApplicationEntity lastApplication : lastApplications) {
- responses.add(convertToServiceConfigVersionResponse(lastApplication));
+ List<ServiceConfigEntity> lastServiceConfigs = serviceConfigDAO.getLastServiceConfigs(getClusterId());
+ for (ServiceConfigEntity lastServiceConfig : lastServiceConfigs) {
+ responses.add(convertToServiceConfigVersionResponse(lastServiceConfig));
}
return responses;
}
@RequiresSession
ServiceConfigVersionResponse getActiveServiceConfigVersion(String serviceName) {
- ServiceConfigApplicationEntity lastApplication = serviceConfigDAO.getLastApplication(getClusterId(), serviceName);
- if (lastApplication == null) {
- LOG.debug("No active service config version found for service {}", serviceName);
+ ServiceConfigEntity lastServiceConfig = serviceConfigDAO.getLastServiceConfig(getClusterId(), serviceName);
+ if (lastServiceConfig == null) {
+ LOG.debug("No service config version found for service {}", serviceName);
return null;
}
- return convertToServiceConfigVersionResponse(lastApplication);
+ return convertToServiceConfigVersionResponse(lastServiceConfig);
}
@RequiresSession
- ServiceConfigVersionResponse convertToServiceConfigVersionResponse(ServiceConfigApplicationEntity applicationEntity) {
+ ServiceConfigVersionResponse convertToServiceConfigVersionResponse(ServiceConfigEntity serviceConfigEntity) {
ServiceConfigVersionResponse serviceConfigVersionResponse = new ServiceConfigVersionResponse();
- ServiceConfigEntity serviceConfigEntity = applicationEntity.getServiceConfigEntity();
-
serviceConfigVersionResponse.setClusterName(getClusterName());
serviceConfigVersionResponse.setServiceName(serviceConfigEntity.getServiceName());
serviceConfigVersionResponse.setVersion(serviceConfigEntity.getVersion());
- serviceConfigVersionResponse.setCreateTime(serviceConfigEntity.getCreateTimestamp());
- serviceConfigVersionResponse.setApplyTime(applicationEntity.getApplyTimestamp());
- serviceConfigVersionResponse.setUserName(applicationEntity.getUser());
- serviceConfigVersionResponse.setNote(applicationEntity.getNote());
+ serviceConfigVersionResponse.setCreateTime(serviceConfigEntity.getCreateTimestamp());
+ serviceConfigVersionResponse.setUserName(serviceConfigEntity.getUser());
+ serviceConfigVersionResponse.setNote(serviceConfigEntity.getNote());
return serviceConfigVersionResponse;
}
@@ -1547,15 +1546,17 @@ public class ClusterImpl implements Cluster {
selectConfig(configEntity.getType(), configEntity.getTag(), user);
}
- ServiceConfigApplicationEntity applicationEntity = new ServiceConfigApplicationEntity();
- applicationEntity.setApplyTimestamp(System.currentTimeMillis());
- applicationEntity.setServiceConfigEntity(serviceConfigEntity);
- applicationEntity.setUser(user);
- applicationEntity.setNote(serviceConfigVersionNote);
-
- serviceConfigEntity.getServiceConfigApplicationEntities().add(applicationEntity);
+ ServiceConfigEntity serviceConfigEntityClone = new ServiceConfigEntity();
+ serviceConfigEntityClone.setCreateTimestamp(System.currentTimeMillis());
+ serviceConfigEntityClone.setUser(user);
+ serviceConfigEntityClone.setServiceName(serviceName);
+ serviceConfigEntityClone.setClusterEntity(clusterEntity);
+ serviceConfigEntityClone.setClusterConfigEntities(serviceConfigEntity.getClusterConfigEntities());
+ serviceConfigEntityClone.setClusterId(serviceConfigEntity.getClusterId());
+ serviceConfigEntityClone.setNote(serviceConfigVersionNote);
+ serviceConfigEntityClone.setVersion(configVersionHelper.getNextVersion(serviceName));
- serviceConfigDAO.merge(serviceConfigEntity);
+ serviceConfigDAO.create(serviceConfigEntityClone);
}
@Transactional
@@ -1613,15 +1614,8 @@ public class ClusterImpl implements Cluster {
serviceConfigEntity.setServiceName(serviceName);
serviceConfigEntity.setClusterEntity(clusterEntity);
serviceConfigEntity.setVersion(configVersionHelper.getNextVersion(serviceName));
-
- //set first default application
- serviceConfigEntity.setServiceConfigApplicationEntities(new ArrayList<ServiceConfigApplicationEntity>());
- ServiceConfigApplicationEntity serviceConfigApplicationEntity = new ServiceConfigApplicationEntity();
- serviceConfigApplicationEntity.setApplyTimestamp(serviceConfigEntity.getCreateTimestamp());
- serviceConfigApplicationEntity.setServiceConfigEntity(serviceConfigEntity);
- serviceConfigApplicationEntity.setUser(user);
- serviceConfigApplicationEntity.setNote(serviceConfigVersionNote);
- serviceConfigEntity.getServiceConfigApplicationEntities().add(serviceConfigApplicationEntity);
+ serviceConfigEntity.setUser(user);
+ serviceConfigEntity.setNote(serviceConfigVersionNote);
List<ClusterConfigEntity> configEntities = new ArrayList<ClusterConfigEntity>();
serviceConfigEntity.setClusterConfigEntities(configEntities);
@@ -1649,8 +1643,8 @@ public class ClusterImpl implements Cluster {
response.setVersion(serviceConfigEntity.getVersion());
response.setServiceName(serviceConfigEntity.getServiceName());
response.setCreateTime(serviceConfigEntity.getCreateTimestamp());
- response.setApplyTime(serviceConfigApplicationEntity.getApplyTimestamp());
- response.setNote(serviceConfigApplicationEntity.getNote());
+ response.setUserName(serviceConfigEntity.getUser());
+ response.setNote(serviceConfigEntity.getNote());
return response;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6eb753d8/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
index bb248ba..0601d2c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java
@@ -273,6 +273,8 @@ public class UpgradeCatalog170 extends AbstractUpgradeCatalog {
columns.add(new DBColumnInfo("service_name", String.class, null, null, false));
columns.add(new DBColumnInfo("version", Long.class, null, null, false));
columns.add(new DBColumnInfo("create_timestamp", Long.class, null, null, false));
+ columns.add(new DBColumnInfo("user_name", String.class, null, "_db", false));
+ columns.add(new DBColumnInfo("note", char[].class, null, null, true));
dbAccessor.createTable("serviceconfig", columns, "service_config_id");
columns.clear();
@@ -280,13 +282,6 @@ public class UpgradeCatalog170 extends AbstractUpgradeCatalog {
columns.add(new DBColumnInfo("config_id", Long.class, null, null, false));
dbAccessor.createTable("serviceconfigmapping", columns, "service_config_id", "config_id");
- columns.clear();
- columns.add(new DBColumnInfo("apply_id", Long.class, null, null, false));
- columns.add(new DBColumnInfo("service_config_id", Long.class, null, null, false));
- columns.add(new DBColumnInfo("apply_timestamp", Long.class, null, null, false));
- columns.add(new DBColumnInfo("user_name", String.class, null, "_db", false));
- dbAccessor.createTable("serviceconfigapplication", columns, "apply_id");
-
dbAccessor.addFKConstraint("confgroupclusterconfigmapping", "FK_confg",
new String[]{"cluster_id", "config_type", "version_tag"}, "clusterconfig",
new String[]{"cluster_id", "type_name", "version_tag"}, true);
http://git-wip-us.apache.org/repos/asf/ambari/blob/6eb753d8/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
index 5fc03b1..00f0e7c 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -28,9 +28,8 @@ delimiter ;
CREATE TABLE clusters (cluster_id BIGINT NOT NULL, resource_id BIGINT NOT NULL, cluster_info VARCHAR(255) NOT NULL, cluster_name VARCHAR(100) NOT NULL UNIQUE, provisioning_state VARCHAR(255) NOT NULL DEFAULT 'INIT', desired_cluster_state VARCHAR(255) NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id));
CREATE TABLE clusterconfig (config_id BIGINT NOT NULL, version_tag VARCHAR(255) NOT NULL, version BIGINT NOT NULL, type_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, config_data LONGTEXT NOT NULL, config_attributes LONGTEXT, create_timestamp BIGINT NOT NULL, PRIMARY KEY (config_id));
-CREATE TABLE serviceconfig (service_config_id BIGINT NOT NULL, cluster_id BIGINT NOT NULL, service_name VARCHAR(255) NOT NULL, version BIGINT NOT NULL, create_timestamp BIGINT NOT NULL, PRIMARY KEY (service_config_id));
+CREATE TABLE serviceconfig (service_config_id BIGINT NOT NULL, cluster_id BIGINT NOT NULL, service_name VARCHAR(255) NOT NULL, version BIGINT NOT NULL, create_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT '_db', note LONGTEXT, PRIMARY KEY (service_config_id));
CREATE TABLE serviceconfigmapping (service_config_id BIGINT NOT NULL, config_id BIGINT NOT NULL, PRIMARY KEY(service_config_id, config_id));
-CREATE TABLE serviceconfigapplication (apply_id BIGINT NOT NULL, service_config_id BIGINT NOT NULL, apply_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT '_db', note LONGTEXT, PRIMARY KEY(apply_id));
CREATE TABLE clusterservices (service_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, service_enabled INTEGER NOT NULL, PRIMARY KEY (service_name, cluster_id));
CREATE TABLE clusterstate (cluster_id BIGINT NOT NULL, current_cluster_state VARCHAR(255) NOT NULL, current_stack_version VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id));
CREATE TABLE hostcomponentdesiredstate (cluster_id BIGINT NOT NULL, component_name VARCHAR(255) NOT NULL, desired_stack_version VARCHAR(255) NOT NULL, desired_state VARCHAR(255) NOT NULL, host_name VARCHAR(255) NOT NULL, service_name VARCHAR(255) NOT NULL, admin_state VARCHAR(32), maintenance_state VARCHAR(32) NOT NULL DEFAULT 'ACTIVE', restart_required TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
@@ -81,7 +80,7 @@ CREATE TABLE adminprincipal (principal_id BIGINT NOT NULL, principal_type_id INT
CREATE TABLE adminpermission (permission_id BIGINT NOT NULL, permission_name VARCHAR(255) NOT NULL, resource_type_id INTEGER NOT NULL, PRIMARY KEY(permission_id));
CREATE TABLE adminprivilege (privilege_id BIGINT, permission_id BIGINT NOT NULL, resource_id BIGINT NOT NULL, principal_id BIGINT NOT NULL, PRIMARY KEY(privilege_id));
---------altering tables by creating unique constraints----------
+-- altering tables by creating unique constraints----------
ALTER TABLE users ADD CONSTRAINT UNQ_users_0 UNIQUE (user_name, ldap_user);
ALTER TABLE groups ADD CONSTRAINT UNQ_groups_0 UNIQUE (group_name, ldap_group);
ALTER TABLE members ADD CONSTRAINT UNQ_members_0 UNIQUE (group_id, user_id);
@@ -92,7 +91,7 @@ ALTER TABLE viewinstance ADD CONSTRAINT UQ_viewinstance_name_id UNIQUE (view_ins
ALTER TABLE serviceconfig ADD CONSTRAINT UQ_scv_service_version UNIQUE (cluster_id, service_name, version);
ALTER TABLE adminpermission ADD CONSTRAINT UQ_perm_name_resource_type_id UNIQUE (permission_name, resource_type_id);
---------altering tables by creating foreign keys----------
+-- altering tables by creating foreign keys----------
ALTER TABLE members ADD CONSTRAINT FK_members_group_id FOREIGN KEY (group_id) REFERENCES groups (group_id);
ALTER TABLE members ADD CONSTRAINT FK_members_user_id FOREIGN KEY (user_id) REFERENCES users (user_id);
ALTER TABLE clusterconfig ADD CONSTRAINT FK_clusterconfig_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id);
@@ -118,12 +117,8 @@ ALTER TABLE user_roles ADD CONSTRAINT FK_user_roles_user_id FOREIGN KEY (user_id
ALTER TABLE user_roles ADD CONSTRAINT FK_user_roles_role_name FOREIGN KEY (role_name) REFERENCES roles (role_name);
ALTER TABLE hostconfigmapping ADD CONSTRAINT FK_hostconfmapping_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id);
ALTER TABLE hostconfigmapping ADD CONSTRAINT FK_hostconfmapping_host_name FOREIGN KEY (host_name) REFERENCES hosts (host_name);
-ALTER TABLE clusterconfig ADD CONSTRAINT UQ_config_type_tag UNIQUE (cluster_id, type_name, version_tag);
-ALTER TABLE clusterconfig ADD CONSTRAINT UQ_config_type_version UNIQUE (cluster_id, type_name, version);
-ALTER TABLE serviceconfig ADD CONSTRAINT UQ_scv_service_version UNIQUE (cluster_id, service_name, version);
ALTER TABLE serviceconfigmapping ADD CONSTRAINT FK_scvm_scv FOREIGN KEY (service_config_id) REFERENCES serviceconfig(service_config_id);
ALTER TABLE serviceconfigmapping ADD CONSTRAINT FK_scvm_config FOREIGN KEY (config_id) REFERENCES clusterconfig(config_id);
-ALTER TABLE serviceconfigapplication ADD CONSTRAINT FK_scva_scv FOREIGN KEY (service_config_id) REFERENCES serviceconfig(service_config_id);
ALTER TABLE configgroup ADD CONSTRAINT FK_configgroup_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id);
ALTER TABLE confgroupclusterconfigmapping ADD CONSTRAINT FK_confg FOREIGN KEY (cluster_id, config_type, version_tag) REFERENCES clusterconfig (cluster_id, type_name, version_tag);
ALTER TABLE confgroupclusterconfigmapping ADD CONSTRAINT FK_cgccm_gid FOREIGN KEY (config_group_id) REFERENCES configgroup (group_id);
@@ -272,7 +267,6 @@ INSERT INTO ambari_sequences(sequence_name, value) values ('permission_id_seq',
INSERT INTO ambari_sequences(sequence_name, value) values ('privilege_id_seq', 1);
INSERT INTO ambari_sequences(sequence_name, value) values ('config_id_seq', 1);
INSERT INTO ambari_sequences(sequence_name, value) values ('service_config_id_seq', 1);
-INSERT INTO ambari_sequences(sequence_name, value) values ('service_config_application_id_seq', 1);
INSERT INTO ambari_sequences(sequence_name, value) values ('alert_definition_id_seq', 0);
INSERT INTO ambari_sequences(sequence_name, value) values ('alert_group_id_seq', 0);
INSERT INTO ambari_sequences(sequence_name, value) values ('alert_target_id_seq', 0);
http://git-wip-us.apache.org/repos/asf/ambari/blob/6eb753d8/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
index c8897f7..ccf99af 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -19,9 +19,8 @@
------create tables---------
CREATE TABLE clusters (cluster_id NUMBER(19) NOT NULL, resource_id NUMBER(19) NOT NULL, cluster_info VARCHAR2(255) NULL, cluster_name VARCHAR2(100) NOT NULL UNIQUE, provisioning_state VARCHAR2(255) DEFAULT 'INIT' NOT NULL, desired_cluster_state VARCHAR2(255) NULL, desired_stack_version VARCHAR2(255) NULL, PRIMARY KEY (cluster_id));
CREATE TABLE clusterconfig (config_id NUMBER(19) NOT NULL, version_tag VARCHAR2(255) NOT NULL, version NUMBER(19) NOT NULL, type_name VARCHAR2(255) NOT NULL, cluster_id NUMBER(19) NOT NULL, config_data CLOB NOT NULL, config_attributes CLOB, create_timestamp NUMBER(19) NOT NULL, PRIMARY KEY (config_id));
-CREATE TABLE serviceconfig (service_config_id NUMBER(19) NOT NULL, cluster_id NUMBER(19) NOT NULL, service_name VARCHAR(255) NOT NULL, version NUMBER(19) NOT NULL, create_timestamp NUMBER(19) NOT NULL, PRIMARY KEY (service_config_id));
+CREATE TABLE serviceconfig (service_config_id NUMBER(19) NOT NULL, cluster_id NUMBER(19) NOT NULL, service_name VARCHAR(255) NOT NULL, version NUMBER(19) NOT NULL, create_timestamp NUMBER(19) NOT NULL, user_name VARCHAR(255) DEFAULT '_db' NOT NULL, note CLOB, PRIMARY KEY (service_config_id));
CREATE TABLE serviceconfigmapping (service_config_id NUMBER(19) NOT NULL, config_id NUMBER(19) NOT NULL, PRIMARY KEY(service_config_id, config_id));
-CREATE TABLE serviceconfigapplication (apply_id NUMBER(19) NOT NULL, service_config_id NUMBER(19) NOT NULL, apply_timestamp NUMBER(19) NOT NULL, user_name VARCHAR(255) DEFAULT '_db' NOT NULL, note CLOB, PRIMARY KEY(apply_id));
CREATE TABLE clusterservices (service_name VARCHAR2(255) NOT NULL, cluster_id NUMBER(19) NOT NULL, service_enabled NUMBER(10) NOT NULL, PRIMARY KEY (service_name, cluster_id));
CREATE TABLE clusterstate (cluster_id NUMBER(19) NOT NULL, current_cluster_state VARCHAR2(255) NULL, current_stack_version VARCHAR2(255) NULL, PRIMARY KEY (cluster_id));
CREATE TABLE hostcomponentdesiredstate (cluster_id NUMBER(19) NOT NULL, component_name VARCHAR2(255) NOT NULL, desired_stack_version VARCHAR2(255) NULL, desired_state VARCHAR2(255) NOT NULL, host_name VARCHAR2(255) NOT NULL, service_name VARCHAR2(255) NOT NULL, admin_state VARCHAR2(32) NULL, maintenance_state VARCHAR2(32) NOT NULL, restart_required NUMBER(1) DEFAULT 0 NOT NULL, PRIMARY KEY (cluster_id, component_name, host_name, service_name));
@@ -109,12 +108,8 @@ ALTER TABLE user_roles ADD CONSTRAINT FK_user_roles_user_id FOREIGN KEY (user_id
ALTER TABLE user_roles ADD CONSTRAINT FK_user_roles_role_name FOREIGN KEY (role_name) REFERENCES roles (role_name);
ALTER TABLE hostconfigmapping ADD CONSTRAINT FK_hostconfmapping_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id);
ALTER TABLE hostconfigmapping ADD CONSTRAINT FK_hostconfmapping_host_name FOREIGN KEY (host_name) REFERENCES hosts (host_name);
-ALTER TABLE clusterconfig ADD CONSTRAINT UQ_config_type_tag UNIQUE (cluster_id, type_name, version_tag);
-ALTER TABLE clusterconfig ADD CONSTRAINT UQ_config_type_version UNIQUE (cluster_id, type_name, version);
-ALTER TABLE serviceconfig ADD CONSTRAINT UQ_scv_service_version UNIQUE (cluster_id, service_name, version);
ALTER TABLE serviceconfigmapping ADD CONSTRAINT FK_scvm_scv FOREIGN KEY (service_config_id) REFERENCES serviceconfig(service_config_id);
ALTER TABLE serviceconfigmapping ADD CONSTRAINT FK_scvm_config FOREIGN KEY (config_id) REFERENCES clusterconfig(config_id);
-ALTER TABLE serviceconfigapplication ADD CONSTRAINT FK_scva_scv FOREIGN KEY (service_config_id) REFERENCES serviceconfig(service_config_id);
ALTER TABLE configgroup ADD CONSTRAINT FK_configgroup_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id);
ALTER TABLE confgroupclusterconfigmapping ADD CONSTRAINT FK_confg FOREIGN KEY (version_tag, config_type, cluster_id) REFERENCES clusterconfig (version_tag, type_name, cluster_id);
ALTER TABLE confgroupclusterconfigmapping ADD CONSTRAINT FK_cgccm_gid FOREIGN KEY (config_group_id) REFERENCES configgroup (group_id);
@@ -264,7 +259,6 @@ INSERT INTO ambari_sequences(sequence_name, value) values ('permission_id_seq',
INSERT INTO ambari_sequences(sequence_name, value) values ('privilege_id_seq', 1);
INSERT INTO ambari_sequences(sequence_name, value) values ('config_id_seq', 1);
INSERT INTO ambari_sequences(sequence_name, value) values ('service_config_id_seq', 1);
-INSERT INTO ambari_sequences(sequence_name, value) values ('service_config_application_id_seq', 1);
INSERT INTO ambari_sequences(sequence_name, value) values ('alert_definition_id_seq', 0);
INSERT INTO ambari_sequences(sequence_name, value) values ('alert_group_id_seq', 0);
INSERT INTO ambari_sequences(sequence_name, value) values ('alert_target_id_seq', 0);
http://git-wip-us.apache.org/repos/asf/ambari/blob/6eb753d8/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index eb4d073..9178336 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -23,12 +23,10 @@ CREATE TABLE clusterconfig (config_id BIGINT NOT NULL, version_tag VARCHAR(255)
CREATE TABLE clusterconfigmapping (cluster_id BIGINT NOT NULL, type_name VARCHAR(255) NOT NULL, version_tag VARCHAR(255) NOT NULL, create_timestamp BIGINT NOT NULL, selected INTEGER NOT NULL DEFAULT 0, user_name VARCHAR(255) NOT NULL DEFAULT '_db', PRIMARY KEY (cluster_id, type_name, create_timestamp));
-CREATE TABLE serviceconfig (service_config_id BIGINT NOT NULL, cluster_id BIGINT NOT NULL, service_name VARCHAR(255) NOT NULL, version BIGINT NOT NULL, create_timestamp BIGINT NOT NULL, PRIMARY KEY (service_config_id));
+CREATE TABLE serviceconfig (service_config_id BIGINT NOT NULL, cluster_id BIGINT NOT NULL, service_name VARCHAR(255) NOT NULL, version BIGINT NOT NULL, create_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT '_db', note TEXT, PRIMARY KEY (service_config_id));
CREATE TABLE serviceconfigmapping (service_config_id BIGINT NOT NULL, config_id BIGINT NOT NULL, PRIMARY KEY(service_config_id, config_id));
-CREATE TABLE serviceconfigapplication (apply_id BIGINT NOT NULL, service_config_id BIGINT NOT NULL, apply_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT '_db', note TEXT, PRIMARY KEY(apply_id));
-
CREATE TABLE clusterservices (service_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, service_enabled INTEGER NOT NULL, PRIMARY KEY (service_name, cluster_id));
CREATE TABLE clusterstate (cluster_id BIGINT NOT NULL, current_cluster_state VARCHAR(255) NOT NULL, current_stack_version VARCHAR(255) NOT NULL, PRIMARY KEY (cluster_id));
@@ -173,7 +171,6 @@ ALTER TABLE users ADD CONSTRAINT FK_users_principal_id FOREIGN KEY (principal_id
ALTER TABLE groups ADD CONSTRAINT FK_groups_principal_id FOREIGN KEY (principal_id) REFERENCES adminprincipal(principal_id);
ALTER TABLE serviceconfigmapping ADD CONSTRAINT FK_scvm_scv FOREIGN KEY (service_config_id) REFERENCES serviceconfig(service_config_id);
ALTER TABLE serviceconfigmapping ADD CONSTRAINT FK_scvm_config FOREIGN KEY (config_id) REFERENCES clusterconfig(config_id);
-ALTER TABLE serviceconfigapplication ADD CONSTRAINT FK_scva_scv FOREIGN KEY (service_config_id) REFERENCES serviceconfig(service_config_id);
ALTER TABLE clusters ADD CONSTRAINT FK_clusters_resource_id FOREIGN KEY (resource_id) REFERENCES adminresource(resource_id);
-- Alerting Framework
@@ -326,9 +323,7 @@ BEGIN;
union all
select 'config_id_seq', 1
union all
- select 'service_config_id_seq', 1
- union all
- select 'service_config_application_id_seq', 1;
+ select 'service_config_id_seq', 1;
INSERT INTO adminresourcetype (resource_type_id, resource_type_name)
SELECT 1, 'AMBARI'
http://git-wip-us.apache.org/repos/asf/ambari/blob/6eb753d8/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
index d775eea..2dfea87 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
@@ -37,15 +37,12 @@ GRANT ALL PRIVILEGES ON TABLE ambari.clusterconfig TO :username;
CREATE TABLE ambari.clusterconfigmapping (cluster_id BIGINT NOT NULL, type_name VARCHAR(255) NOT NULL, version_tag VARCHAR(255) NOT NULL, create_timestamp BIGINT NOT NULL, selected INTEGER NOT NULL DEFAULT 0, user_name VARCHAR(255) NOT NULL DEFAULT '_db', PRIMARY KEY (cluster_id, type_name, create_timestamp));
GRANT ALL PRIVILEGES ON TABLE ambari.clusterconfigmapping TO :username;
-CREATE TABLE ambari.serviceconfig (service_config_id BIGINT NOT NULL, cluster_id BIGINT NOT NULL, service_name VARCHAR(255) NOT NULL, version BIGINT NOT NULL, create_timestamp BIGINT NOT NULL, PRIMARY KEY (service_config_id));
+CREATE TABLE ambari.serviceconfig (service_config_id BIGINT NOT NULL, cluster_id BIGINT NOT NULL, service_name VARCHAR(255) NOT NULL, version BIGINT NOT NULL, create_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT '_db', note TEXT, PRIMARY KEY (service_config_id));
GRANT ALL PRIVILEGES ON TABLE ambari.serviceconfig TO :username;
CREATE TABLE ambari.serviceconfigmapping (service_config_id BIGINT NOT NULL, config_id BIGINT NOT NULL, PRIMARY KEY(service_config_id, config_id));
GRANT ALL PRIVILEGES ON TABLE ambari.serviceconfigmapping TO :username;
-CREATE TABLE ambari.serviceconfigapplication (apply_id BIGINT NOT NULL, service_config_id BIGINT NOT NULL, apply_timestamp BIGINT NOT NULL, user_name VARCHAR(255) NOT NULL DEFAULT '_db', note TEXT, PRIMARY KEY(apply_id));
-GRANT ALL PRIVILEGES ON TABLE ambari.serviceconfigapplication TO :username;
-
CREATE TABLE ambari.clusterservices (service_name VARCHAR(255) NOT NULL, cluster_id BIGINT NOT NULL, service_enabled INTEGER NOT NULL, PRIMARY KEY (service_name, cluster_id));
GRANT ALL PRIVILEGES ON TABLE ambari.clusterservices TO :username;
@@ -229,7 +226,6 @@ ALTER TABLE ambari.confgroupclusterconfigmapping ADD CONSTRAINT FK_confg FOREIGN
ALTER TABLE ambari.confgroupclusterconfigmapping ADD CONSTRAINT FK_cgccm_gid FOREIGN KEY (config_group_id) REFERENCES ambari.configgroup (group_id);
ALTER TABLE ambari.serviceconfigmapping ADD CONSTRAINT FK_scvm_scv FOREIGN KEY (service_config_id) REFERENCES ambari.serviceconfig(service_config_id);
ALTER TABLE ambari.serviceconfigmapping ADD CONSTRAINT FK_scvm_config FOREIGN KEY (config_id) REFERENCES ambari.clusterconfig(config_id);
-ALTER TABLE ambari.serviceconfigapplication ADD CONSTRAINT FK_scva_scv FOREIGN KEY (service_config_id) REFERENCES ambari.serviceconfig(service_config_id);
ALTER TABLE ambari.adminresource ADD CONSTRAINT FK_resource_resource_type_id FOREIGN KEY (resource_type_id) REFERENCES ambari.adminresourcetype(resource_type_id);
ALTER TABLE ambari.adminprincipal ADD CONSTRAINT FK_principal_principal_type_id FOREIGN KEY (principal_type_id) REFERENCES ambari.adminprincipaltype(principal_type_id);
ALTER TABLE ambari.adminpermission ADD CONSTRAINT FK_permission_resource_type_id FOREIGN KEY (resource_type_id) REFERENCES ambari.adminresourcetype(resource_type_id);
@@ -401,10 +397,7 @@ INSERT INTO ambari.ambari_sequences (sequence_name, "value")
union all
select 'config_id_seq', 1
union all
- select 'service_config_id_seq', 1
- union all
- select 'service_config_application_id_seq', 1;
-
+ select 'service_config_id_seq', 1;
INSERT INTO ambari.adminresourcetype (resource_type_id, resource_type_name)
SELECT 1, 'AMBARI'
http://git-wip-us.apache.org/repos/asf/ambari/blob/6eb753d8/ambari-server/src/main/resources/properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/properties.json b/ambari-server/src/main/resources/properties.json
index 753efeb..b12a531 100644
--- a/ambari-server/src/main/resources/properties.json
+++ b/ambari-server/src/main/resources/properties.json
@@ -90,7 +90,6 @@
"ServiceConfigVersion/service_name",
"ServiceConfigVersion/serviceconfigversion",
"ServiceConfigVersion/createtime",
- "ServiceConfigVersion/appliedtime",
"ServiceConfigVersion/user",
"ServiceConfigVersion/service_config_version_note"
],
http://git-wip-us.apache.org/repos/asf/ambari/blob/6eb753d8/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/ServiceConfigDAOTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/ServiceConfigDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/ServiceConfigDAOTest.java
new file mode 100644
index 0000000..5118156
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/ServiceConfigDAOTest.java
@@ -0,0 +1,282 @@
+/**
+ * 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.
+ */
+package org.apache.ambari.server.orm.dao;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.persist.PersistService;
+import junit.framework.Assert;
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.orm.GuiceJpaInitializer;
+import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
+import org.apache.ambari.server.orm.cache.ConfigGroupHostMapping;
+import org.apache.ambari.server.orm.entities.ClusterConfigEntity;
+import org.apache.ambari.server.orm.entities.ClusterEntity;
+import org.apache.ambari.server.orm.entities.ConfigGroupConfigMappingEntity;
+import org.apache.ambari.server.orm.entities.ConfigGroupEntity;
+import org.apache.ambari.server.orm.entities.ConfigGroupHostMappingEntity;
+import org.apache.ambari.server.orm.entities.HostEntity;
+import org.apache.ambari.server.orm.entities.ResourceEntity;
+import org.apache.ambari.server.orm.entities.ResourceTypeEntity;
+import org.apache.ambari.server.orm.entities.ServiceConfigEntity;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class ServiceConfigDAOTest {
+ private Injector injector;
+ private ServiceConfigDAO serviceConfigDAO;
+ private ClusterDAO clusterDAO;
+ private ResourceTypeDAO resourceTypeDAO;
+
+
+ @Before
+ public void setup() throws Exception {
+ injector = Guice.createInjector(new InMemoryDefaultTestModule());
+ injector.getInstance(GuiceJpaInitializer.class);
+
+ clusterDAO = injector.getInstance(ClusterDAO.class);
+ serviceConfigDAO = injector.getInstance(ServiceConfigDAO.class);
+ resourceTypeDAO = injector.getInstance(ResourceTypeDAO.class);
+ }
+
+ @After
+ public void teardown() throws AmbariException {
+ injector.getInstance(PersistService.class).stop();
+ }
+
+ private ServiceConfigEntity createServiceConfig(String serviceName,
+ String userName, Long version, Long serviceConfigId,
+ Long createTimestamp, List<ClusterConfigEntity> clusterConfigEntities)
+ throws Exception {
+
+ // create an admin resource to represent this cluster
+ ResourceTypeEntity resourceTypeEntity = resourceTypeDAO.findById(ResourceTypeEntity.CLUSTER_RESOURCE_TYPE);
+ if (resourceTypeEntity == null) {
+ resourceTypeEntity = new ResourceTypeEntity();
+ resourceTypeEntity.setId(ResourceTypeEntity.CLUSTER_RESOURCE_TYPE);
+ resourceTypeEntity.setName(ResourceTypeEntity.CLUSTER_RESOURCE_TYPE_NAME);
+ resourceTypeEntity = resourceTypeDAO.merge(resourceTypeEntity);
+ }
+ ResourceEntity resourceEntity = new ResourceEntity();
+ resourceEntity.setResourceType(resourceTypeEntity);
+
+ ClusterEntity clusterEntity = clusterDAO.findByName("c1");
+ if (clusterEntity == null) {
+ clusterEntity = new ClusterEntity();
+ clusterEntity.setClusterName("c1");
+ clusterEntity.setResource(resourceEntity);
+ clusterDAO.create(clusterEntity);
+ }
+
+ ServiceConfigEntity serviceConfigEntity = new ServiceConfigEntity();
+ serviceConfigEntity.setServiceName(serviceName);
+ serviceConfigEntity.setUser(userName);
+ serviceConfigEntity.setVersion(version);
+ serviceConfigEntity.setServiceConfigId(serviceConfigId);
+ serviceConfigEntity.setClusterId(clusterEntity.getClusterId());
+ serviceConfigEntity.setCreateTimestamp(createTimestamp);
+ serviceConfigEntity.setClusterConfigEntities(clusterConfigEntities);
+ serviceConfigEntity.setClusterEntity(clusterEntity);
+
+ serviceConfigDAO.create(serviceConfigEntity);
+
+ return serviceConfigEntity;
+ }
+
+ @Test
+ public void testCreateServiceConfigVersion() throws Exception {
+
+ ServiceConfigEntity serviceConfigEntity =
+ createServiceConfig("HDFS", "admin", 1L, 1L, 1111L, null);
+
+ Assert.assertNotNull(serviceConfigEntity);
+ Assert.assertEquals("c1", serviceConfigEntity.getClusterEntity().getClusterName());
+ Assert.assertEquals(Long.valueOf(1), serviceConfigEntity.getClusterEntity()
+ .getClusterId());
+ Assert.assertEquals("HDFS", serviceConfigEntity.getServiceName());
+ Assert.assertEquals(Long.valueOf(1111L), serviceConfigEntity.getCreateTimestamp());
+ Assert.assertEquals("admin", serviceConfigEntity.getUser());
+ Assert.assertEquals(Long.valueOf(1), serviceConfigEntity.getVersion());
+ Assert.assertTrue(serviceConfigEntity.getClusterConfigEntities().isEmpty());
+ Assert.assertNotNull(serviceConfigEntity.getServiceConfigId());
+ }
+
+ @Test
+ public void testFindServiceConfigEntity() throws Exception {
+ ServiceConfigEntity sce =
+ createServiceConfig("HDFS", "admin", 1L, 1L, 1111L, null);
+
+ ServiceConfigEntity serviceConfigEntity = serviceConfigDAO.find(sce.getServiceConfigId());
+
+ Assert.assertNotNull(serviceConfigEntity);
+ Assert.assertEquals("c1", serviceConfigEntity.getClusterEntity().getClusterName());
+ Assert.assertEquals(Long.valueOf(1), serviceConfigEntity.getClusterEntity()
+ .getClusterId());
+ Assert.assertEquals("HDFS", serviceConfigEntity.getServiceName());
+ Assert.assertEquals(Long.valueOf(1111L), serviceConfigEntity.getCreateTimestamp());
+ Assert.assertEquals("admin", serviceConfigEntity.getUser());
+ Assert.assertEquals(Long.valueOf(1), serviceConfigEntity.getVersion());
+ Assert.assertTrue(serviceConfigEntity.getClusterConfigEntities().isEmpty());
+ Assert.assertNotNull(serviceConfigEntity.getServiceConfigId());
+ }
+
+ @Test
+ public void testFindByServiceAndVersion() throws Exception {
+
+ createServiceConfig("HDFS", "admin", 1L, 1L, 1111L, null);
+
+ ServiceConfigEntity serviceConfigEntity =
+ serviceConfigDAO.findByServiceAndVersion("HDFS", 1L);
+
+ Assert.assertNotNull(serviceConfigEntity);
+ Assert.assertEquals("c1", serviceConfigEntity.getClusterEntity().getClusterName());
+ Assert.assertEquals(Long.valueOf(1), serviceConfigEntity.getClusterEntity()
+ .getClusterId());
+ Assert.assertEquals("HDFS", serviceConfigEntity.getServiceName());
+ Assert.assertEquals(Long.valueOf(1111L), serviceConfigEntity.getCreateTimestamp());
+ Assert.assertEquals("admin", serviceConfigEntity.getUser());
+ Assert.assertEquals(Long.valueOf(1), serviceConfigEntity.getVersion());
+ Assert.assertTrue(serviceConfigEntity.getClusterConfigEntities().isEmpty());
+ Assert.assertNotNull(serviceConfigEntity.getServiceConfigId());
+ }
+
+ @Test
+ public void testFindMaxVersions() throws Exception {
+ createServiceConfig("HDFS", "admin", 1L, 1L, 1111L, null);
+ createServiceConfig("HDFS", "admin", 2L, 2L, 2222L, null);
+ createServiceConfig("YARN", "admin", 1L, 3L, 3333L, null);
+
+
+ Map<String,Long> maxVersions = serviceConfigDAO.findMaxVersions(
+ clusterDAO.findByName("c1").getClusterId());
+
+ Assert.assertNotNull(maxVersions);
+
+ Assert.assertEquals(2, maxVersions.size());
+
+ Assert.assertEquals(Long.valueOf(2), maxVersions.get("HDFS"));
+ Assert.assertEquals(Long.valueOf(1), maxVersions.get("YARN"));
+ }
+
+ @Test
+ public void testGetLastServiceConfigs() throws Exception {
+ createServiceConfig("HDFS", "admin", 1L, 1L, 1111L, null);
+ createServiceConfig("HDFS", "admin", 2L, 2L, 2222L, null);
+ createServiceConfig("YARN", "admin", 1L, 3L, 3333L, null);
+
+ List<ServiceConfigEntity> serviceConfigEntities =
+ serviceConfigDAO.getLastServiceConfigs(clusterDAO.findByName("c1").getClusterId());
+
+ Assert.assertNotNull(serviceConfigEntities);
+ Assert.assertEquals(2, serviceConfigEntities.size());
+
+ for (ServiceConfigEntity sce: serviceConfigEntities) {
+ if ("HDFS".equals(sce.getServiceName())) {
+ Assert.assertEquals("c1", sce.getClusterEntity().getClusterName());
+ Assert.assertEquals(Long.valueOf(1), sce.getClusterEntity()
+ .getClusterId());
+ Assert.assertEquals(Long.valueOf(2222L), sce.getCreateTimestamp());
+ Assert.assertEquals(Long.valueOf(2), sce.getVersion());
+ Assert.assertTrue(sce.getClusterConfigEntities().isEmpty());
+ Assert.assertNotNull(sce.getServiceConfigId());
+ }
+ if ("YARN".equals(sce.getServiceName())) {
+ Assert.assertEquals("c1", sce.getClusterEntity().getClusterName());
+ Assert.assertEquals(Long.valueOf(1), sce.getClusterEntity()
+ .getClusterId());
+ Assert.assertEquals(Long.valueOf(3333L), sce.getCreateTimestamp());
+ Assert.assertEquals(Long.valueOf(1), sce.getVersion());
+ Assert.assertTrue(sce.getClusterConfigEntities().isEmpty());
+ Assert.assertNotNull(sce.getServiceConfigId());
+ }
+
+ Assert.assertEquals("admin", sce.getUser());
+ }
+ }
+
+ @Test
+ public void testGetLastServiceConfig() throws Exception {
+ createServiceConfig("HDFS", "admin", 1L, 1L, 1111L, null);
+ createServiceConfig("HDFS", "admin", 2L, 2L, 2222L, null);
+ createServiceConfig("YARN", "admin", 1L, 3L, 3333L, null);
+
+ ServiceConfigEntity serviceConfigEntity =
+ serviceConfigDAO.getLastServiceConfig(1L, "HDFS");
+
+ Assert.assertNotNull(serviceConfigEntity);
+ Assert.assertEquals("c1", serviceConfigEntity.getClusterEntity().getClusterName());
+ Assert.assertEquals(Long.valueOf(1), serviceConfigEntity.getClusterEntity()
+ .getClusterId());
+ Assert.assertEquals("HDFS", serviceConfigEntity.getServiceName());
+ Assert.assertEquals(Long.valueOf(2222L), serviceConfigEntity.getCreateTimestamp());
+ Assert.assertEquals("admin", serviceConfigEntity.getUser());
+ Assert.assertEquals(Long.valueOf(2), serviceConfigEntity.getVersion());
+ Assert.assertTrue(serviceConfigEntity.getClusterConfigEntities().isEmpty());
+ Assert.assertNotNull(serviceConfigEntity.getServiceConfigId());
+ }
+
+ @Test
+ public void testGetServiceConfigs() throws Exception {
+ createServiceConfig("HDFS", "admin", 1L, 1L, 1111L, null);
+ createServiceConfig("HDFS", "admin", 2L, 2L, 2222L, null);
+ createServiceConfig("YARN", "admin", 1L, 3L, 3333L, null);
+
+ List<ServiceConfigEntity> serviceConfigEntities =
+ serviceConfigDAO.getServiceConfigs(clusterDAO.findByName("c1").getClusterId());
+
+ Assert.assertNotNull(serviceConfigEntities);
+ Assert.assertEquals(3, serviceConfigEntities.size());
+
+ for (ServiceConfigEntity sce: serviceConfigEntities) {
+ if ("HDFS".equals(sce.getServiceName()) && (sce.getVersion() == 1)) {
+ Assert.assertEquals("c1", sce.getClusterEntity().getClusterName());
+ Assert.assertEquals(Long.valueOf(1), sce.getClusterEntity()
+ .getClusterId());
+ Assert.assertEquals(Long.valueOf(1111L), sce.getCreateTimestamp());
+ Assert.assertTrue(sce.getClusterConfigEntities().isEmpty());
+ Assert.assertNotNull(sce.getServiceConfigId());
+ } else if ("HDFS".equals(sce.getServiceName()) && (sce.getVersion() == 2)) {
+ Assert.assertEquals("c1", sce.getClusterEntity().getClusterName());
+ Assert.assertEquals(Long.valueOf(1), sce.getClusterEntity()
+ .getClusterId());
+ Assert.assertEquals(Long.valueOf(2222L), sce.getCreateTimestamp());
+ Assert.assertTrue(sce.getClusterConfigEntities().isEmpty());
+ Assert.assertNotNull(sce.getServiceConfigId());
+ } else if ("YARN".equals(sce.getServiceName())) {
+ Assert.assertEquals("c1", sce.getClusterEntity().getClusterName());
+ Assert.assertEquals(Long.valueOf(1), sce.getClusterEntity()
+ .getClusterId());
+ Assert.assertEquals(Long.valueOf(3333L), sce.getCreateTimestamp());
+ Assert.assertEquals(Long.valueOf(1), sce.getVersion());
+ Assert.assertTrue(sce.getClusterConfigEntities().isEmpty());
+ Assert.assertNotNull(sce.getServiceConfigId());
+
+ } else {
+ Assert.fail();
+ }
+ Assert.assertEquals("admin", sce.getUser());
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6eb753d8/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/ServiceConfigEntityTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/ServiceConfigEntityTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/ServiceConfigEntityTest.java
new file mode 100644
index 0000000..e12e7ae
--- /dev/null
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/ServiceConfigEntityTest.java
@@ -0,0 +1,49 @@
+/**
+ * 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.
+ */
+
+package org.apache.ambari.server.orm.entities;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
+/**
+ * ServiceConfigEntity unit tests.
+ */
+public class ServiceConfigEntityTest {
+ @Test
+ public void testSettersGetters() {
+ ServiceConfigEntity entity = new ServiceConfigEntity();
+ entity.setServiceName("foo");
+ entity.setUser("bar");
+ entity.setNote("note");
+ entity.setVersion(1L);
+ entity.setServiceConfigId(1L);
+ entity.setClusterId(1L);
+ entity.setCreateTimestamp(1111L);
+ assertEquals("foo", entity.getServiceName());
+ assertEquals("bar", entity.getUser());
+ assertEquals("note", entity.getNote());
+ assertEquals(Long.valueOf(1), entity.getVersion());
+ assertEquals(Long.valueOf(1), entity.getServiceConfigId());
+ assertEquals(Long.valueOf(1), entity.getClusterId());
+ assertEquals(Long.valueOf(1111), entity.getCreateTimestamp());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6eb753d8/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
index 453c26b..222924b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
@@ -47,6 +47,7 @@ import org.apache.ambari.server.agent.DiskInfo;
import org.apache.ambari.server.agent.HostInfo;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.controller.ClusterResponse;
+import org.apache.ambari.server.controller.ServiceConfigVersionResponse;
import org.apache.ambari.server.orm.GuiceJpaInitializer;
import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
import org.apache.ambari.server.orm.entities.ClusterEntity;
@@ -633,4 +634,58 @@ public class ClusterTest {
assertEquals(2, result.size());
}
-}
+ @Test
+ public void testAddServiceConfigVersions() {
+ Config config1 = configFactory.createNew(c1, "hdfs-site",
+ new HashMap<String, String>() {{ put("a", "b"); }}, new HashMap<String, Map<String,String>>());
+ config1.setTag("version1");
+
+ Config config2 = configFactory.createNew(c1, "hdfs-site",
+ new HashMap<String, String>() {{ put("x", "y"); }}, new HashMap<String, Map<String,String>>());
+ config2.setTag("version2");
+
+ c1.addConfig(config1);
+ c1.addConfig(config2);
+
+ c1.addDesiredConfig("admin", config1);
+ List<ServiceConfigVersionResponse> serviceConfigVersions =
+ c1.getServiceConfigVersions();
+ Assert.assertNotNull(serviceConfigVersions);
+ Assert.assertEquals(1, serviceConfigVersions.size());
+ Map<String, ServiceConfigVersionResponse> activeServiceConfigVersions =
+ c1.getActiveServiceConfigVersions();
+ Assert.assertEquals(1, activeServiceConfigVersions.size());
+ ServiceConfigVersionResponse mapredResponse =
+ activeServiceConfigVersions.get("MAPREDUCE");
+
+ Assert.assertEquals("MAPREDUCE", mapredResponse.getServiceName());
+ Assert.assertEquals("c1", mapredResponse.getClusterName());
+ Assert.assertEquals("admin", mapredResponse.getUserName());
+ Assert.assertEquals(Long.valueOf(1), mapredResponse.getVersion());
+
+ c1.addDesiredConfig("admin", config2);
+ serviceConfigVersions = c1.getServiceConfigVersions();
+ Assert.assertNotNull(serviceConfigVersions);
+ // created new ServiceConfigVersion
+ Assert.assertEquals(2, serviceConfigVersions.size());
+ // active version still 1
+ Assert.assertEquals(1, activeServiceConfigVersions.size());
+ mapredResponse = activeServiceConfigVersions.get("MAPREDUCE");
+ Assert.assertEquals("MAPREDUCE", mapredResponse.getServiceName());
+ Assert.assertEquals("c1", mapredResponse.getClusterName());
+ Assert.assertEquals("admin", mapredResponse.getUserName());
+
+ // Rollback , clonning version1 config, created new ServiceConfigVersion
+ c1.addDesiredConfig("admin", config1);
+ serviceConfigVersions = c1.getServiceConfigVersions();
+ Assert.assertNotNull(serviceConfigVersions);
+ // created new ServiceConfigVersion
+ Assert.assertEquals(3, serviceConfigVersions.size());
+ // active version still 1
+ Assert.assertEquals(1, activeServiceConfigVersions.size());
+ mapredResponse = activeServiceConfigVersions.get("MAPREDUCE");
+ Assert.assertEquals("MAPREDUCE", mapredResponse.getServiceName());
+ Assert.assertEquals("c1", mapredResponse.getClusterName());
+ Assert.assertEquals("admin", mapredResponse.getUserName());
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/6eb753d8/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
index 63b64e4..19f37ad 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
@@ -85,6 +85,8 @@ public class UpgradeCatalog170Test {
Capture<List<DBAccessor.DBColumnInfo>> alertGroupTargetCapture = new Capture<List<DBAccessor.DBColumnInfo>>();
Capture<List<DBAccessor.DBColumnInfo>> alertGroupingCapture = new Capture<List<DBAccessor.DBColumnInfo>>();
Capture<List<DBAccessor.DBColumnInfo>> alertNoticeCapture = new Capture<List<DBAccessor.DBColumnInfo>>();
+ Capture<List<DBAccessor.DBColumnInfo>> serviceConfigCapture = new Capture<List<DBAccessor.DBColumnInfo>>();
+ Capture<List<DBAccessor.DBColumnInfo>> serviceConfigMappingCapture = new Capture<List<DBAccessor.DBColumnInfo>>();
setViewExpectations(dbAccessor, maskColumnCapture);
setViewParameterExpectations(dbAccessor, maskedColumnCapture);
@@ -114,6 +116,13 @@ public class UpgradeCatalog170Test {
dbAccessor.createTable(eq("alert_notice"), capture(alertNoticeCapture),
eq("notification_id"));
+ dbAccessor.createTable(eq("serviceconfig"), capture(serviceConfigCapture),
+ eq("service_config_id"));
+
+ dbAccessor.createTable(eq("serviceconfigmapping"),
+ capture(serviceConfigMappingCapture), eq("service_config_id"),
+ eq("config_id"));
+
dbAccessor.executeSelect(anyObject(String.class));
expectLastCall().andReturn(resultSet).anyTimes();
resultSet.next();
@@ -143,6 +152,8 @@ public class UpgradeCatalog170Test {
assertEquals(2, alertGroupTargetCapture.getValue().size());
assertEquals(2, alertGroupingCapture.getValue().size());
assertEquals(4, alertNoticeCapture.getValue().size());
+ assertEquals(2, serviceConfigCapture.getValue().size());
+ assertEquals(2, serviceConfigMappingCapture.getValue().size());
}
@Test
[4/6] git commit: AMBARI-6840. Jobs View: Update Top Nav rendering
for jobs (srimanth)
Posted by jo...@apache.org.
AMBARI-6840. Jobs View: Update Top Nav rendering for jobs (srimanth)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2f5ee092
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2f5ee092
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2f5ee092
Branch: refs/heads/branch-alerts-dev
Commit: 2f5ee092fc283e8025ec9d751f6d906d46c015fd
Parents: 45d4e59
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Tue Aug 12 18:14:41 2014 -0700
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Thu Aug 14 09:19:16 2014 -0400
----------------------------------------------------------------------
ambari-web/app/config.js | 1 -
ambari-web/app/controllers.js | 2 -
.../controllers/main/admin/access_controller.js | 6 +-
.../main/jobs/hive_job_details_controller.js | 87 --
.../app/controllers/main/jobs_controller.js | 497 ----------
ambari-web/app/initialize.js | 1 -
ambari-web/app/mappers.js | 2 -
ambari-web/app/mappers/jobs/hive_job_mapper.js | 216 -----
ambari-web/app/mappers/jobs/hive_jobs_mapper.js | 100 --
ambari-web/app/models.js | 3 -
ambari-web/app/models/jobs/hive_job.js | 29 -
ambari-web/app/models/jobs/job.js | 80 --
ambari-web/app/models/jobs/tez_dag.js | 189 ----
ambari-web/app/routes/main.js | 41 -
ambari-web/app/templates/main/admin/access.hbs | 4 -
ambari-web/app/templates/main/jobs.hbs | 101 --
.../templates/main/jobs/custom_dates_popup.hbs | 39 -
.../templates/main/jobs/hive_job_details.hbs | 215 -----
.../main/jobs/hive_job_details_tez_dag.hbs | 44 -
.../app/templates/main/jobs/hover_op_table.hbs | 39 -
.../app/templates/main/jobs/user_filter.hbs | 34 -
ambari-web/app/utils/jobs.js | 263 ------
ambari-web/app/views.js | 4 -
.../main/jobs/hive_job_details_tez_dag_view.js | 946 -------------------
.../views/main/jobs/hive_job_details_view.js | 351 -------
.../views/main/jobs/select_custom_date_view.js | 37 -
ambari-web/app/views/main/jobs_view.js | 336 -------
ambari-web/app/views/main/menu.js | 5 +-
28 files changed, 4 insertions(+), 3668 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/config.js b/ambari-web/app/config.js
index a4c71d4..f4e882a 100644
--- a/ambari-web/app/config.js
+++ b/ambari-web/app/config.js
@@ -75,7 +75,6 @@ App.supports = {
deleteHost: true,
autoRollbackHA: false,
appTimelineServer: true,
- jobs: true,
ubuntu: true,
views: true,
flume: true,
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/controllers.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers.js b/ambari-web/app/controllers.js
index 9e915a6..3601cd2 100644
--- a/ambari-web/app/controllers.js
+++ b/ambari-web/app/controllers.js
@@ -117,8 +117,6 @@ require('controllers/main/charts/heatmap_metrics/heatmap_metric_hbase_regions');
require('controllers/main/charts/heatmap_metrics/heatmap_metric_hbase_memstoresize');
require('controllers/main/charts/heatmap');
require('controllers/main/apps_controller');
-require('controllers/main/jobs_controller');
-require('controllers/main/jobs/hive_job_details_controller');
require('controllers/main/apps/item_controller');
require('controllers/main/mirroring_controller');
require('controllers/main/mirroring/edit_dataset_controller');
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/controllers/main/admin/access_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/access_controller.js b/ambari-web/app/controllers/main/admin/access_controller.js
index aaab364..82bc9f3 100644
--- a/ambari-web/app/controllers/main/admin/access_controller.js
+++ b/ambari-web/app/controllers/main/admin/access_controller.js
@@ -25,7 +25,7 @@ App.MainAdminAccessController = Em.Controller.extend(App.UserPref, {
* Show jobs by default
* @type {bool}
*/
- showJobs: true,
+ showJobs: false,
/**
* User pref key
@@ -57,9 +57,9 @@ App.MainAdminAccessController = Em.Controller.extend(App.UserPref, {
getUserPrefErrorCallback: function () {
if (App.get('isAdmin')) {
- this.postUserPref(this.get('persistKey'), true);
+ this.postUserPref(this.get('persistKey'), false);
}
- this.set('showJobs', true);
+ this.set('showJobs', false);
return true;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/controllers/main/jobs/hive_job_details_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/jobs/hive_job_details_controller.js b/ambari-web/app/controllers/main/jobs/hive_job_details_controller.js
deleted file mode 100644
index 1e2df7e..0000000
--- a/ambari-web/app/controllers/main/jobs/hive_job_details_controller.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * 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.
- */
-
-var App = require('app');
-var jobsUtils = require('utils/jobs');
-
-App.MainHiveJobDetailsController = Em.Controller.extend({
- name : 'mainHiveJobDetailsController',
-
- content : null,
- loaded : false,
- loadTimeout: null,
- job: null,
- sortingColumn: null,
-
- loadJobDetails : function() {
- var self = this;
- var timeout = this.get('loadTimeout');
- var yarnService = App.YARNService.find().objectAt(0);
- if (yarnService != null) {
- var content = this.get('content');
- if (content != null) {
- jobsUtils.refreshJobDetails(content, function() {
- self.set('content', self.get('job'));
- self.set('loaded', true);
- }, function(errorId) {
- switch (errorId) {
- case 'job.dag.noId':
- App.showAlertPopup(Em.I18n.t('jobs.hive.tez.dag.error.noDagId.title'), Em.I18n.t('jobs.hive.tez.dag.error.noDagId.message'));
- break;
- case 'job.dag.noname':
- App.showAlertPopup(Em.I18n.t('jobs.hive.tez.dag.error.noDag.title'), Em.I18n.t('jobs.hive.tez.dag.error.noDag.message'));
- break;
- case 'job.dag.id.noDag':
- App.showAlertPopup(Em.I18n.t('jobs.hive.tez.dag.error.noDagForId.title'), Em.I18n.t('jobs.hive.tez.dag.error.noDagForId.message'));
- break;
- case 'job.dag.id.loaderror':
- case 'job.dag.name.loaderror':
- break;
- default:
- break;
- }
- self.routeToJobs();
- });
- }
- } else {
- clearTimeout(timeout);
- timeout = setTimeout(function() {
- self.loadJobDetails();
- }, 300);
- }
- },
-
- /**
- * path to page visited before
- */
- referer : '',
- /**
- * open dashboard page
- */
- routeHome : function() {
- App.router.transitionTo('main.dashboard.index');
- },
-
- /**
- * open jobs page
- *
- * @param event
- */
- routeToJobs : function() {
- App.router.transitionTo('main.jobs.index');
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/controllers/main/jobs_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/jobs_controller.js b/ambari-web/app/controllers/main/jobs_controller.js
deleted file mode 100644
index caeac05..0000000
--- a/ambari-web/app/controllers/main/jobs_controller.js
+++ /dev/null
@@ -1,497 +0,0 @@
-/**
- * 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.
- */
-
-var App = require('app');
-
-App.MainJobsController = Em.Controller.extend({
-/*
- * https://github.com/emberjs/ember.js/issues/1221 prevents this controller
- * from being an Ember.ArrayController. Doing so will keep the UI flashing
- * whenever any of the 'sortProperties' or 'sortAscending' properties are set.
- *
- * To bypass this issue this controller will be a regular controller. Also,
- * for memory-leak issues and sorting purposes, we are decoupling the backend
- * model and the UI model. There will be simple Ember POJOs for the UI which
- * will be periodically updated from backend Jobs model.
- */
-
- name:'mainJobsController',
-
- /**
- * Unsorted ArrayProxy
- */
- content: App.HiveJob.find(),
-
- /**
- * Sorted ArrayProxy
- */
- sortedContent: [],
-
- contentAndSortObserver : function() {
- Ember.run.once(this, 'contentAndSortUpdater');
- if(App.HiveJob.find().findProperty('id', this.get('lastJobID'))) {
- this.set('hasNewJobs', false);
- }
- }.observes('content.length', 'content.@each.id', 'content.@each.startTime', 'content.@each.endTime', 'sortProperties', 'sortAscending'),
-
- contentAndSortUpdater: function() {
- this.set('sortingDone', false);
- var content = this.get('content');
- var sortedContent = content.toArray();
- var sortProperty = this.get('sortProperty');
- var sortAscending = this.get('sortAscending');
- sortedContent.sort(function(r1, r2) {
- var r1id = r1.get(sortProperty);
- var r2id = r2.get(sortProperty);
- if (r1id < r2id)
- return sortAscending ? -1 : 1;
- if (r1id > r2id)
- return sortAscending ? 1 : -1;
- return 0;
- });
- var sortedArray = this.get('sortedContent');
- var count = 0;
- sortedContent.forEach(function(sortedJob){
- if(sortedArray.length <= count) {
- sortedArray.pushObject(Ember.Object.create());
- }
- sortedArray[count].set('failed', sortedJob.get('failed'));
- sortedArray[count].set('hasTezDag', sortedJob.get('hasTezDag'));
- sortedArray[count].set('queryText', sortedJob.get('queryText'));
- sortedArray[count].set('name', sortedJob.get('name'));
- sortedArray[count].set('user', sortedJob.get('user'));
- sortedArray[count].set('id', sortedJob.get('id'));
- sortedArray[count].set('startTimeDisplay', sortedJob.get('startTimeDisplay'));
- sortedArray[count].set('endTimeDisplay', sortedJob.get('endTimeDisplay'));
- sortedArray[count].set('durationDisplay', sortedJob.get('durationDisplay'));
- count ++;
- });
- if(sortedArray.length > count) {
- for(var c = sortedArray.length-1; c >= count; c--){
- sortedArray.removeObject(sortedArray[c]);
- }
- }
- sortedContent.length = 0;
- this.set('sortingDone', true);
- },
-
- navIDs: {
- backIDs: [],
- nextID: ''
- },
- lastJobID: '',
- hasNewJobs: false,
- loaded : false,
- loading : false,
- resetPagination: false,
- loadJobsTimeout: null,
- loadTimeout: null,
- jobsUpdateInterval: 6000,
- jobsUpdate: null,
- sortingColumn: null,
- sortProperty: 'id',
- sortAscending: true,
- sortingDone: true,
- jobsMessage: Em.I18n.t('jobs.loadingTasks'),
-
- sortingColumnObserver: function () {
- if(this.get('sortingColumn')){
- this.set('sortProperty', this.get('sortingColumn').get('name'));
- this.set('sortAscending', this.get('sortingColumn').get('status') == "sorting_desc" ? false : true );
- }
- }.observes('sortingColumn.name','sortingColumn.status'),
-
- updateJobsByClick: function () {
- this.set('navIDs.backIDs', []);
- this.set('navIDs.nextID', '');
- this.get('filterObject').set('nextFromId', '');
- this.get('filterObject').set('backFromId', '');
- this.get('filterObject').set('fromTs', '');
- this.set('hasNewJobs', false);
- this.set('resetPagination', true);
- this.loadJobs();
- },
-
- updateJobs: function (controllerName, funcName) {
- clearInterval(this.get('jobsUpdate'));
- var self = this;
- var interval = setInterval(function () {
- App.router.get(controllerName)[funcName]();
- }, this.jobsUpdateInterval);
- this.set('jobsUpdate', interval);
- },
-
- totalOfJobs: 0,
- setTotalOfJobs: function () {
- if(this.get('totalOfJobs') < this.get('content.length')){
- this.set('totalOfJobs', this.get('content.length'));
- }
- }.observes('content.length'),
-
- filterObject: Ember.Object.create({
- id: "",
- isIdFilterApplied: false,
- jobsLimit: 10,
- user: "",
- windowStart: "",
- windowEnd: "",
- nextFromId: "",
- backFromId: "",
- fromTs: "",
- isAnyFilterApplied: false,
-
- onApplyIdFilter: function () {
- if(this.get('id') == ""){
- this.set('isIdFilterApplied', false);
- }else{
- this.set('isIdFilterApplied', true);
- }
- }.observes('id'),
-
- /**
- * Direct binding to startTime filter field
- */
- startTime: "",
- onStartTimeChange:function(){
- var time = "";
- var curTime = new Date().getTime();
- switch (this.get('startTime')) {
- case 'Past 1 hour':
- time = curTime - 3600000;
- break;
- case 'Past 1 Day':
- time = curTime - 86400000;
- break;
- case 'Past 2 Days':
- time = curTime - 172800000;
- break;
- case 'Past 7 Days':
- time = curTime - 604800000;
- break;
- case 'Past 14 Days':
- time = curTime - 1209600000;
- break;
- case 'Past 30 Days':
- time = curTime - 2592000000;
- break;
- case 'Custom':
- this.showCustomDatePopup();
- break;
- case 'Any':
- time = "";
- break;
- }
- if(this.get('startTime') != "Custom"){
- this.set("windowStart", time);
- this.set("windowEnd", "");
- }
- }.observes("startTime"),
-
- // Fields values from Select Custom Dates form
- customDateFormFields: Ember.Object.create({
- startDate: null,
- hoursForStart: null,
- minutesForStart: null,
- middayPeriodForStart: null,
- endDate: null,
- hoursForEnd: null,
- minutesForEnd: null,
- middayPeriodForEnd: null
- }),
-
- errors: Ember.Object.create({
- isStartDateError: false,
- isEndDateError: false
- }),
-
- errorMessages: Ember.Object.create({
- startDate: '',
- endDate: ''
- }),
-
- showCustomDatePopup: function () {
- var self = this;
- var windowEnd = "";
- var windowStart = "";
- App.ModalPopup.show({
- header: Em.I18n.t('jobs.table.custom.date.header'),
- onPrimary: function () {
- self.validate();
- if(self.get('errors.isStartDateError') || self.get('errors.isEndDateError')){
- return false;
- }
-
- var windowStart = self.createCustomStartDate();
- var windowEnd = self.createCustomEndDate();
-
- self.set("windowStart", windowStart.getTime());
- self.set("windowEnd", windowEnd.getTime());
- this.hide();
- },
- onSecondary: function () {
- self.set('startTime','Any');
- this.hide();
- },
- bodyClass: App.JobsCustomDatesSelectView.extend({
- controller: self
- })
- });
- },
-
- createCustomStartDate : function () {
- var startDate = this.get('customDateFormFields.startDate');
- var hoursForStart = this.get('customDateFormFields.hoursForStart');
- var minutesForStart = this.get('customDateFormFields.minutesForStart');
- var middayPeriodForStart = this.get('customDateFormFields.middayPeriodForStart');
- if (startDate && hoursForStart && minutesForStart && middayPeriodForStart) {
- return new Date(startDate + ' ' + hoursForStart + ':' + minutesForStart + ' ' + middayPeriodForStart);
- }
- return null;
- },
-
- createCustomEndDate : function () {
- var endDate = this.get('customDateFormFields.endDate');
- var hoursForEnd = this.get('customDateFormFields.hoursForEnd');
- var minutesForEnd = this.get('customDateFormFields.minutesForEnd');
- var middayPeriodForEnd = this.get('customDateFormFields.middayPeriodForEnd');
- if (endDate && hoursForEnd && minutesForEnd && middayPeriodForEnd) {
- return new Date(endDate + ' ' + hoursForEnd + ':' + minutesForEnd + ' ' + middayPeriodForEnd);
- }
- return null;
- },
-
- clearErrors: function () {
- var errorMessages = this.get('errorMessages');
- Em.keys(errorMessages).forEach(function (key) {
- errorMessages.set(key, '');
- }, this);
- var errors = this.get('errors');
- Em.keys(errors).forEach(function (key) {
- errors.set(key, false);
- }, this);
- },
-
- // Validation for every field in customDateFormFields
- validate: function () {
- var formFields = this.get('customDateFormFields');
- var errors = this.get('errors');
- var errorMessages = this.get('errorMessages');
- this.clearErrors();
- // Check if feild is empty
- Em.keys(errorMessages).forEach(function (key) {
- if (!formFields.get(key)) {
- errors.set('is' + key.capitalize() + 'Error', true);
- errorMessages.set(key, Em.I18n.t('jobs.customDateFilter.error.required'));
- }
- }, this);
- // Check that endDate is after startDate
- var startDate = this.createCustomStartDate();
- var endDate = this.createCustomEndDate();
- if (startDate && endDate && (startDate > endDate)) {
- errors.set('isEndDateError', true);
- errorMessages.set('endDate', Em.I18n.t('jobs.customDateFilter.error.date.order'));
- }
- },
-
- /**
- * Create link for server request
- * @return {String}
- */
- createJobsFiltersLink: function() {
- var link = "?fields=events,primaryfilters,otherinfo&secondaryFilter=tez:true";
- var numberOfAppliedFilters = 0;
-
- if(this.get("id") !== "") {
- link = "/" + this.get("id") + link;
- numberOfAppliedFilters++;
- }
-
- link += "&limit=" + (parseInt(this.get("jobsLimit")) + 1);
-
- if(this.get("user") !== ""){
- link += "&primaryFilter=user:" + this.get("user");
- numberOfAppliedFilters++;
- }
- if(this.get("backFromId") != ""){
- link += "&fromId=" + this.get("backFromId");
- }
- if(this.get("nextFromId") != ""){
- link += "&fromId=" + this.get("nextFromId");
- }
- if(this.get("fromTs") != ""){
- link += "&fromTs=" + this.get("fromTs");
- }
- if(this.get("startTime") !== "" && this.get("startTime") !== "Any"){
- link += this.get("windowStart") !== "" ? ("&windowStart=" + this.get("windowStart")) : "";
- link += this.get("windowEnd") !== "" ? ("&windowEnd=" + this.get("windowEnd")) : "";
- numberOfAppliedFilters++;
- }
-
- if(numberOfAppliedFilters > 0){
- this.set('isAnyFilterApplied', true);
- }else{
- this.set('isAnyFilterApplied', false);
- }
-
- return link;
- }
- }),
-
- columnsName: Ember.ArrayController.create({
- content: [
- { name: Em.I18n.t('jobs.column.id'), index: 0 },
- { name: Em.I18n.t('jobs.column.user'), index: 1 },
- { name: Em.I18n.t('jobs.column.start.time'), index: 2 },
- { name: Em.I18n.t('jobs.column.end.time'), index: 3 },
- { name: Em.I18n.t('jobs.column.duration'), index: 4 }
- ],
- columnsCount: function () {
- return this.get('content.length') + 1;
- }.property('content.length')
- }),
-
- lastIDSuccessCallback: function(data, jqXHR, textStatus) {
- if(!data.entities[0]){
- return;
- }
- var lastReceivedID = data.entities[0].entity;
- if(this.get('lastJobID') == '') {
- this.set('lastJobID', lastReceivedID);
- if (this.get('loaded') && App.HiveJob.find().get('length') < 1) {
- this.set('hasNewJobs', true);
- }
- } else if (this.get('lastJobID') !== lastReceivedID) {
- this.set('lastJobID', lastReceivedID);
- if(!App.HiveJob.find().findProperty('id', lastReceivedID)) {
- this.set('hasNewJobs', true);
- }
- }
- },
-
- lastIDErrorCallback: function(data, jqXHR, textStatus) {
- console.debug(jqXHR);
- },
-
- checkDataLoadingError: function (jqXHR){
- var atsComponent = App.HostComponent.find().findProperty('componentName','APP_TIMELINE_SERVER');
- if(atsComponent && atsComponent.get('workStatus') != "STARTED") {
- this.set('jobsMessage', Em.I18n.t('jobs.error.ats.down'));
- }else if (jqXHR && jqXHR.status == 400) {
- this.set('jobsMessage', Em.I18n.t('jobs.error.400'));
- }else if ((!jqXHR && this.get('loaded') && !this.get('loading')) || (jqXHR && jqXHR.status == 500)) {
- this.set('jobsMessage', Em.I18n.t('jobs.nothingToShow'));
- }else{
- this.set('jobsMessage', Em.I18n.t('jobs.loadingTasks'));
- }
- },
-
- loadJobs : function() {
- var self = this,
- timeout = this.get('loadTimeout'),
- yarnService = App.YARNService.find().objectAt(0),
- atsComponent = App.HostComponent.find().findProperty('componentName','APP_TIMELINE_SERVER'),
- atsInValidState = !!atsComponent && atsComponent.get('workStatus') === "STARTED",
- retryLoad = this.checkDataLoadingError();
- if (yarnService != null && atsInValidState) {
- this.set('loading', true);
- var historyServerHostName = yarnService.get('appTimelineServer.hostName'),
- filtersLink = this.get('filterObject').createJobsFiltersLink(),
- hiveQueriesUrl = App.get('testMode') ? "/data/jobs/hive-queries.json" : "/proxy?url=http://" + historyServerHostName
- + ":" + yarnService.get('ahsWebPort') + "/ws/v1/timeline/HIVE_QUERY_ID" + filtersLink;
- App.ajax.send({
- name: 'jobs.lastID',
- sender: self,
- data: {
- historyServerHostName: historyServerHostName,
- ahsWebPort: yarnService.get('ahsWebPort')
- },
- success: 'lastIDSuccessCallback',
- error : 'lastIDErrorCallback'
- });
- App.HttpClient.get(hiveQueriesUrl, App.hiveJobsMapper, {
- complete : function(data, jqXHR, textStatus) {
- self.set('loading', false);
- if(self.get('loaded') == false || self.get('resetPagination') == true){
- self.initializePagination();
- self.set('resetPagination', false);
- }
- self.set('loaded', true);
- }
- }, function (jqXHR, textStatus) {
- App.hiveJobsMapper.map({entities : []});
- self.checkDataLoadingError(jqXHR);
- });
- }else{
- this.checkDataLoadingError();
- clearTimeout(timeout);
- timeout = setTimeout(function(){
- self.loadJobs();
- }, 300);
- }
- },
-
- initializePagination: function() {
- var back_link_IDs = this.get('navIDs.backIDs.[]');
- if(!back_link_IDs.contains(this.get('lastJobID'))) {
- back_link_IDs.push(this.get('lastJobID'));
- }
- this.set('filterObject.backFromId', this.get('lastJobID'));
- this.get('filterObject').set('fromTs', App.dateTime());
- },
-
- navigateNext: function() {
- this.set("filterObject.backFromId", '');
- var back_link_IDs = this.get('navIDs.backIDs.[]');
- var lastBackID = this.get('navIDs.nextID');
- if(!back_link_IDs.contains(lastBackID)) {
- back_link_IDs.push(lastBackID);
- }
- this.set('navIDs.backIDs.[]', back_link_IDs);
- this.set("filterObject.nextFromId", this.get('navIDs.nextID'));
- this.set('navIDs.nextID', '');
- this.loadJobs();
- },
-
- navigateBack: function() {
- this.set("filterObject.nextFromId", '');
- var back_link_IDs = this.get('navIDs.backIDs.[]');
- back_link_IDs.pop();
- var lastBackID = back_link_IDs[back_link_IDs.length - 1]
- this.set('navIDs.backIDs.[]', back_link_IDs);
- this.set("filterObject.backFromId", lastBackID);
- this.loadJobs();
- },
-
- refreshLoadedJobs : function() {
- var timeout = this.get('loadJobsTimeout');
- var self = this;
-
- clearTimeout(timeout);
- timeout = setTimeout(function(){
- self.loadJobs();
- }, 300);
-
- this.set('loadJobsTimeout', timeout);
- }.observes(
- 'filterObject.id',
- 'filterObject.jobsLimit',
- 'filterObject.user',
- 'filterObject.windowStart',
- 'filterObject.windowEnd'
- )
-})
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/initialize.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/initialize.js b/ambari-web/app/initialize.js
index 14473eb..a53e6af 100644
--- a/ambari-web/app/initialize.js
+++ b/ambari-web/app/initialize.js
@@ -40,7 +40,6 @@ require('utils/action_sequence');
require('mappers');
-require('mappers/jobs/hive_job_mapper');
require('utils/http_client');
require('utils/host_progress_popup');
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/mappers.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers.js b/ambari-web/app/mappers.js
index 3435ac1..80c7255 100644
--- a/ambari-web/app/mappers.js
+++ b/ambari-web/app/mappers.js
@@ -21,7 +21,6 @@ require('mappers/server_data_mapper');
require('mappers/stack_service_mapper');
require('mappers/hosts_mapper');
require('mappers/cluster_mapper');
-require('mappers/jobs_mapper');
require('mappers/runs_mapper');
require('mappers/racks_mapper');
require('mappers/users_mapper');
@@ -31,5 +30,4 @@ require('mappers/target_cluster_mapper');
require('mappers/dataset_mapper');
require('mappers/component_config_mapper');
require('mappers/components_state_mapper');
-require('mappers/jobs/hive_jobs_mapper');
require('mappers/service_config_version_mapper');
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/mappers/jobs/hive_job_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/jobs/hive_job_mapper.js b/ambari-web/app/mappers/jobs/hive_job_mapper.js
deleted file mode 100644
index 58d3e90..0000000
--- a/ambari-web/app/mappers/jobs/hive_job_mapper.js
+++ /dev/null
@@ -1,216 +0,0 @@
-/**
- * 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.
- */
-
-var App = require('app');
-
-/**
- * Maps a Hive job response from server into an existing Hive Job.
- *
- * This will only update an existing Hive Job and not create a new one. It will
- * populate all fields (stages, Tez DAG, etc.) except runtime information like
- * <ul>
- * <li>tezDag.id
- * <li>tezDag.vertices.state
- * <li>tezDag.vertices.startTime
- * <li>tezDag.vertices.endTime
- * <li>tezDag.vertices.tasksCount
- * <li>tezDag.vertices.file*
- * <li>tezDag.vertices.hdfs*
- * <li>tezDag.vertices.recordReadCount
- * <li>tezDag.vertices.recordWriteCount
- * </ul>
- */
-App.hiveJobMapper = App.QuickDataMapper.create({
- model : App.HiveJob,
- map : function(json) {
- var model = this.get('model');
- if (!model) {
- return;
- }
- var hiveJob = {};
- if (json && json.entity) {
- var hiveJob = {};
- hiveJob.id = json.entity;
- hiveJob.name = hiveJob.id;
- hiveJob.startTime = json.starttime;
- if (typeof(json.endtime) == "undefined") {
- var i = 0;
- while (typeof(hiveJob.endTime) == "undefined" && json.events && json.events[i]) {
- if (json.events[i].eventtype == 'QUERY_COMPLETED') {
- hiveJob.endTime = json.events[i].timestamp;
- };
- i++;
- };
- } else {
- hiveJob.endTime = json.endtime;
- };
- json.otherinfo.query = $.parseJSON(json.otherinfo.query);
- if (json.otherinfo.query && json.otherinfo.query.queryText) {
- hiveJob.query_text = json.otherinfo.query.queryText;
- }
- hiveJob.stages = [];
- var stagePlans = json.otherinfo.query.queryPlan["STAGE PLANS"];
- for ( var stage in stagePlans) {
- var stageValue = stagePlans[stage];
- var stageItem = {};
- stageItem.id = stage;
- stageItem.description = '. ';
- for (var item in stageValue) {
- stageItem.description += item;
- };
- hiveJob.stages.push(stageItem);
- if (stageValue.Tez != null && hiveJob.tezDag == null) {
- var dagName = stageValue.Tez['DagName:'];
- // Vertices
- var vertices = [];
- var vertexIds = [];
- var vertexIdMap = {};
- for ( var vertexName in stageValue.Tez["Vertices:"]) {
- var vertex = stageValue.Tez["Vertices:"][vertexName];
- var vertexObj = {
- id : dagName + "/" + vertexName,
- name : vertexName,
- incoming_edges : [],
- outgoing_edges : []
- };
- vertexIds.push(vertexObj.id);
- var operatorExtractor = function(obj) {
- var ops = [];
- if ($.isArray(obj)) {
- obj.forEach(function(o) {
- ops = ops.concat(operatorExtractor(o));
- });
- } else {
- for ( var key in obj) {
- ops.push(key);
- if (obj[key].children != null) {
- ops = ops.concat(operatorExtractor(obj[key].children));
- }
- }
- }
- return ops;
- }
- if (vertex["Map Operator Tree:"] != null) {
- vertexObj.type = App.TezDagVertexType.MAP;
- vertexObj.operations = operatorExtractor(vertex["Map Operator Tree:"]);
- vertexObj.operation_plan = JSON.stringify(vertex["Map Operator Tree:"], undefined, " ");
- } else if (vertex["Reduce Operator Tree:"] != null) {
- vertexObj.type = App.TezDagVertexType.REDUCE;
- vertexObj.operations = operatorExtractor(vertex["Reduce Operator Tree:"]);
- vertexObj.operation_plan = JSON.stringify(vertex["Reduce Operator Tree:"], undefined, " ");
- } else if (vertex["Vertex:"] != null && vertexName==vertex['Vertex:']) {
- vertexObj.type = App.TezDagVertexType.UNION;
- }
- vertexIdMap[vertexObj.id] = vertexObj;
- vertices.push(vertexObj);
- }
- // Edges
- var edges = [];
- var edgeIds = [];
- for ( var childVertex in stageValue.Tez["Edges:"]) {
- var childVertices = stageValue.Tez["Edges:"][childVertex];
- if (!$.isArray(childVertices)) {
- // Single edge given as object instead of array
- childVertices = [ childVertices ];
- }
- childVertices.forEach(function(e) {
- var parentVertex = e.parent;
- if (e.type == 'CONTAINS') {
- var parentVertexNode = vertexIdMap[dagName + "/" + parentVertex];
- if (parentVertexNode != null && parentVertexNode.type == App.TezDagVertexType.UNION) {
- // We flip the edges for Union vertices
- var tmp = childVertex;
- childVertex = parentVertex;
- parentVertex = tmp;
- }
- }
- var edgeObj = {
- id : dagName + "/" + parentVertex + "-" + childVertex,
- from_vertex_id : dagName + "/" + parentVertex,
- to_vertex_id : dagName + "/" + childVertex
- };
- vertexIdMap[edgeObj.from_vertex_id].outgoing_edges.push(edgeObj.id);
- vertexIdMap[edgeObj.to_vertex_id].incoming_edges.push(edgeObj.id);
- edgeIds.push(edgeObj.id);
- switch (e.type) {
- case "BROADCAST_EDGE":
- edgeObj.edge_type = App.TezDagEdgeType.BROADCAST;
- break;
- case "SIMPLE_EDGE":
- edgeObj.edge_type = App.TezDagEdgeType.SCATTER_GATHER;
- break;
- case "CONTAINS":
- edgeObj.edge_type = App.TezDagEdgeType.CONTAINS;
- break;
- default:
- break;
- }
- edges.push(edgeObj);
- });
- }
- // Create records
- var tezDag = {
- id : dagName,
- name : dagName,
- stage : stage,
- vertices : vertexIds,
- edges : edgeIds
- }
- // Once the DAG is loaded, we do not need to
- // reload as the structure does not change. Reloading
- // here causes missing data (got from other calls)
- // to propagate into UI - causing flashing.
- var newVertices = [];
- var newEdges = [];
- vertices.forEach(function(v) {
- var vertexRecord = App.TezDagVertex.find(v.id);
- if (!vertexRecord.get('isLoaded')) {
- newVertices.push(v);
- }
- });
- edges.forEach(function(e) {
- var edgeRecord = App.TezDagEdge.find(e.id);
- if (!edgeRecord.get('isLoaded')) {
- newEdges.push(e);
- }
- });
- App.store.loadMany(App.TezDagVertex, newVertices);
- App.store.loadMany(App.TezDagEdge, newEdges);
- var dagRecord = App.TezDag.find(tezDag.id);
- if (!dagRecord.get('isLoaded')) {
- App.store.load(App.TezDag, tezDag);
- }
- hiveJob.tezDag = tezDag.id;
- }
- }
- if(App.HiveJob.find().get('content').length == 0){
- App.store.load(model, hiveJob);
- }
- var hiveJobRecord = App.HiveJob.find(hiveJob.id);
- if (hiveJobRecord != null) {
- hiveJobRecord.set('stages', hiveJob.stages.sortProperty('id'));
- hiveJobRecord.set('startTime', hiveJob.startTime);
- hiveJobRecord.set('endTime', hiveJob.endTime);
- if (hiveJob.tezDag != null) {
- // Some hive queries dont use Tez
- hiveJobRecord.set('tezDag', App.TezDag.find(hiveJob.tezDag));
- }
- }
- }
- },
- config : {}
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/mappers/jobs/hive_jobs_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/jobs/hive_jobs_mapper.js b/ambari-web/app/mappers/jobs/hive_jobs_mapper.js
deleted file mode 100644
index 7377b8d..0000000
--- a/ambari-web/app/mappers/jobs/hive_jobs_mapper.js
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * 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.
- */
-
-var App = require('app');
-
-App.hiveJobsMapper = App.QuickDataMapper.create({
- model : App.HiveJob,
- map : function(json) {
- var model = this.get('model');
- if (!model) {
- return;
- }
- var hiveJobs = []
- if (json) {
- if(!json.entities) {
- json.entities = [];
- if(json.entity){
- json.entities = [json];
- }
- }
- var currentEntityMap = {};
- json.entities.forEach(function(entity) {
- currentEntityMap[entity.entity] = entity.entity;
- var hiveJob = {
- id : entity.entity,
- name : entity.entity,
- user : entity.primaryfilters.user
- }
- hiveJob.has_tez_dag = false;
- hiveJob.query_text = '';
- if (entity.otherinfo && entity.otherinfo.query) {
- // Explicit false match needed for when failure hook not set
- hiveJob.failed = entity.otherinfo.status===false;
- hiveJob.has_tez_dag = entity.otherinfo.query.match("\"Tez\".*\"DagName:\"");
- var queryJson = $.parseJSON(entity.otherinfo.query);
- if (queryJson && queryJson.queryText) {
- hiveJob.query_text = queryJson.queryText;
- }
- }
- if (entity.events != null) {
- entity.events.forEach(function(event) {
- switch (event.eventtype) {
- case "QUERY_SUBMITTED":
- hiveJob.start_time = event.timestamp;
- break;
- case "QUERY_COMPLETED":
- hiveJob.end_time = event.timestamp;
- break;
- default:
- break;
- }
- });
- }
- if (!hiveJob.start_time && entity.starttime > 0) {
- hiveJob.start_time = entity.starttime;
- }
- if (!hiveJob.end_time && entity.endtime > 0) {
- hiveJob.end_time = entity.endtime;
- }
- hiveJobs.push(hiveJob);
- hiveJob = null;
- entity = null;
- });
-
- if(hiveJobs.length > App.router.get('mainJobsController.filterObject.jobsLimit')) {
- var lastJob = hiveJobs.pop();
- if(App.router.get('mainJobsController.navIDs.nextID') != lastJob.id) {
- App.router.set('mainJobsController.navIDs.nextID', lastJob.id);
- }
- currentEntityMap[lastJob.id] = null;
- }
-
- // Delete IDs not seen from server
- var hiveJobsModel = model.find().toArray();
- hiveJobsModel.forEach(function(job) {
- if (job && !currentEntityMap[job.get('id')]) {
- this.deleteRecord(job);
- }
- }, this);
- }
- App.store.loadMany(model, hiveJobs);
- json = null;
- hiveJobs = null;
- },
- config : {}
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/models.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models.js b/ambari-web/app/models.js
index 461cdfd..49b0498 100644
--- a/ambari-web/app/models.js
+++ b/ambari-web/app/models.js
@@ -54,7 +54,4 @@ require('models/slave_component');
require('classes/run_class');
require('classes/job_class');
require('models/config_group');
-require('models/jobs/tez_dag');
-require('models/jobs/job');
-require('models/jobs/hive_job');
require('models/service_config_version');
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/models/jobs/hive_job.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/jobs/hive_job.js b/ambari-web/app/models/jobs/hive_job.js
deleted file mode 100644
index 419dd41..0000000
--- a/ambari-web/app/models/jobs/hive_job.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * 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.
- */
-
-var App = require('app');
-
-App.HiveJob = App.AbstractJob.extend({
- jobType : App.JobType.HIVE,
- queryText : DS.attr('string'),
- stages : DS.attr('array'),
- hasTezDag: DS.attr('boolean'),
- tezDag : DS.belongsTo('App.TezDag'),
- failed: DS.attr('boolean')
-});
-
-App.HiveJob.FIXTURES = [];
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/models/jobs/job.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/jobs/job.js b/ambari-web/app/models/jobs/job.js
deleted file mode 100644
index 44142fc..0000000
--- a/ambari-web/app/models/jobs/job.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * 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.
- */
-
-var App = require('app');
-var dateUtils = require('utils/date');
-
-/**
- * Base class of all Jobs.
- *
- * This class is meant to be extended and not instantiated directly.
- */
-App.AbstractJob = DS.Model.extend({
- id : DS.attr('string'),
- name : DS.attr('string'),
- user : DS.attr('string'),
- startTime : DS.attr('number'),
- endTime : DS.attr('number'),
-
- startTimeDisplay : function() {
- var startTime = this.get('startTime');
- if (startTime > 0) {
- return dateUtils.dateFormat(startTime);
- } else {
- return "";
- }
- }.property('startTime'),
-
- endTimeDisplay : function() {
- var endTime = this.get('endTime');
- if (endTime > 0) {
- return dateUtils.dateFormat(endTime);
- } else {
- return "";
- }
- }.property('endTime'),
-
- /**
- * Provides the duration of this job. If the job has not started, duration
- * will be given as 0. If the job has not ended, duration will be till now.
- *
- * @return {Number} Duration in milliseconds.
- */
- duration : function() {
- var startTime = this.get('startTime');
- var endTime = this.get('endTime');
- if(endTime < startTime || endTime == undefined) {
- endTime = App.dateTime();
- }
- return dateUtils.duration(startTime, endTime);
- }.property('startTime', 'endTime'),
-
- durationDisplay : function() {
- return dateUtils.timingFormat(this.get('duration'), true);
- }.property('duration'),
-
- /**
- * Type of this job. Should be one of constants defined in App.JobType
- */
- jobType : DS.attr('string')
-});
-
-App.JobType = {
- HIVE : "hive"
-};
-
-App.AbstractJob.FIXTURES = [];
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/models/jobs/tez_dag.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/jobs/tez_dag.js b/ambari-web/app/models/jobs/tez_dag.js
deleted file mode 100644
index 461c227..0000000
--- a/ambari-web/app/models/jobs/tez_dag.js
+++ /dev/null
@@ -1,189 +0,0 @@
-/**
- * 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.
- */
-
-var App = require('app');
-var dateUtils = require('utils/date');
-var numberUtils = require('utils/number_utils');
-
-App.TezDag = DS.Model.extend({
- id : DS.attr('string'),
- /**
- * When DAG is actually running on server, a unique ID is assigned.
- */
- instanceId : DS.attr('string'),
- name : DS.attr('string'),
- yarnApplicationId: DS.attr('string'),
- stage : DS.attr('string'),
- vertices : DS.hasMany('App.TezDagVertex'),
- edges : DS.hasMany('App.TezDagEdge')
-});
-
-App.TezDagEdge = DS.Model.extend({
- id : DS.attr('string'),
- instanceId : DS.attr('string'),
- fromVertex : DS.belongsTo('App.TezDagVertex'),
- toVertex : DS.belongsTo('App.TezDagVertex'),
- /**
- * Type of this edge connecting vertices. Should be one of constants defined
- * in 'App.TezDagEdgeType'.
- */
- edgeType : DS.attr('string')
-});
-
-App.TezDagVertex = DS.Model.extend({
- id : DS.attr('string'),
- /**
- * When DAG vertex is actually running on server, a unique ID is assigned.
- */
- instanceId : DS.attr('string'),
- name : DS.attr('string'),
-
- /**
- * State of this vertex. Should be one of constants defined in
- * App.TezDagVertexState.
- */
- state : DS.attr('string'),
-
- /**
- * Vertex type has to be one of the types defined in 'App.TezDagVertexType'
- * @return {string}
- */
- type : DS.attr('string'),
-
- /**
- * A vertex can have multiple incoming edges.
- */
- incomingEdges : DS.hasMany('App.TezDagEdge'),
-
- /**
- * This vertex can have multiple outgoing edges.
- */
- outgoingEdges : DS.hasMany('App.TezDagEdge'),
-
- startTime : DS.attr('number'),
- endTime : DS.attr('number'),
-
- /**
- * Provides the duration of this job. If the job has not started, duration
- * will be given as 0. If the job has not ended, duration will be till now.
- *
- * @return {Number} Duration in milliseconds.
- */
- duration : function() {
- return dateUtils.duration(this.get('startTime'), this.get('endTime'))
- }.property('startTime', 'endTime'),
-
- /**
- * Each Tez vertex can perform arbitrary application specific computations
- * inside. The application can provide a list of operations it has provided in
- * this vertex.
- *
- * Array of strings. [{string}]
- */
- operations : DS.attr('array'),
-
- /**
- * Provides additional information about the 'operations' performed in this
- * vertex. This is shown directly to the user.
- */
- operationPlan : DS.attr('string'),
-
- /**
- * Number of actual Map/Reduce tasks in this vertex
- */
- tasksCount : DS.attr('number'),
-
- tasksNumber: function () {
- return this.get('tasksCount') ? this.get('tasksCount') : 0;
- }.property('tasksCount'),
-
- /**
- * Local filesystem usage metrics for this vertex
- */
- fileReadBytes : DS.attr('number'),
- fileWriteBytes : DS.attr('number'),
- fileReadOps : DS.attr('number'),
- fileWriteOps : DS.attr('number'),
-
- /**
- * Spilled records
- */
- spilledRecords : DS.attr('number'),
-
- /**
- * HDFS usage metrics for this vertex
- */
- hdfsReadBytes : DS.attr('number'),
- hdfsWriteBytes : DS.attr('number'),
- hdfsReadOps : DS.attr('number'),
- hdfsWriteOps : DS.attr('number'),
-
- /**
- * Record metrics for this vertex
- */
- recordReadCount : DS.attr('number'),
- recordWriteCount : DS.attr('number'),
-
- totalReadBytes : function() {
- return this.get('fileReadBytes') + this.get('hdfsReadBytes');
- }.property('fileReadBytes', 'hdfsReadBytes'),
-
- totalWriteBytes : function() {
- return this.get('fileWriteBytes') + this.get('hdfsWriteBytes');
- }.property('fileWriteBytes', 'hdfsWriteBytes'),
-
- totalReadBytesDisplay : function() {
- return numberUtils.bytesToSize(this.get('totalReadBytes'));
- }.property('totalReadBytes'),
-
- totalWriteBytesDisplay : function() {
- return numberUtils.bytesToSize(this.get('totalWriteBytes'));
- }.property('totalWriteBytes'),
-
- durationDisplay : function() {
- return dateUtils.timingFormat(this.get('duration'), true);
- }.property('duration')
-});
-
-App.TezDagVertexState = {
- NEW : "NEW",
- INITIALIZING : "INITIALIZING",
- INITED : "INITED",
- RUNNING : "RUNNING",
- SUCCEEDED : "SUCCEEDED",
- FAILED : "FAILED",
- KILLED : "KILLED",
- ERROR : "ERROR",
- TERMINATING : "TERMINATING",
- JOBFAILED: "JOB FAILED"
-};
-
-App.TezDagVertexType = {
- MAP: 'MAP',
- REDUCE: 'REDUCE',
- UNION: 'UNION'
-};
-
-App.TezDagEdgeType = {
- SCATTER_GATHER : "SCATTER_GATHER",
- BROADCAST : "BROADCAST",
- CONTAINS: "CONTAINS"
-};
-
-App.TezDag.FIXTURES = [];
-App.TezDagEdge.FIXTURES = [];
-App.TezDagVertex.FIXTURES = [];
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 42dd211..ab4b0b3 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -186,47 +186,6 @@ module.exports = Em.Route.extend({
}
}),
- jobs: Em.Route.extend({
- route: '/jobs',
- enter: function (router) {
- if (!App.router.get('mainAdminAccessController.showJobs') && !App.get('isAdmin')) {
- Em.run.next(function () {
- router.transitionTo('main.dashboard.index');
- });
- }
- },
- exit: function (router) {
- clearInterval(router.get('mainJobsController').jobsUpdate);
- },
- index: Ember.Route.extend({
- route: '/',
- connectOutlets: function (router) {
- if (!App.get('isHadoop2Stack')) {
- Em.run.next(function () {
- router.transitionTo('main.dashboard.index');
- });
- } else {
- router.get('mainJobsController').updateJobs('mainJobsController', 'refreshLoadedJobs');
- router.get('mainController').connectOutlet('mainJobs');
- }
- }
- }),
- jobDetails: Em.Route.extend({
- route: '/:job_id',
- connectOutlets: function (router, job) {
- if (job) {
- router.get('mainHiveJobDetailsController').set('loaded', false);
- router.get('mainController').connectOutlet('mainHiveJobDetails', job);
- router.get('mainHiveJobDetailsController').loadJobDetails();
- router.get('mainJobsController').updateJobs('mainHiveJobDetailsController', 'loadJobDetails');
- }
- },
- exit: function (router) {
- router.get('mainHiveJobDetailsController').set('loaded', false);
- }
- })
- }),
-
mirroring: Em.Route.extend({
route: '/mirroring',
index: Ember.Route.extend({
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/templates/main/admin/access.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/access.hbs b/ambari-web/app/templates/main/admin/access.hbs
index a4a870a..9e85a06 100644
--- a/ambari-web/app/templates/main/admin/access.hbs
+++ b/ambari-web/app/templates/main/admin/access.hbs
@@ -20,10 +20,6 @@
<strong>{{t common.access}}</strong>
</div>
<div class="acces-values">
- <label>
- {{view Ember.Checkbox checkedBinding="controller.showJobs" class="checkbox"}}
- {{t admin.access.showJobs}}
- </label>
</div>
<div class="control-group">
<div class="controls">
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/templates/main/jobs.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/jobs.hbs b/ambari-web/app/templates/main/jobs.hbs
deleted file mode 100644
index 304f8fa..0000000
--- a/ambari-web/app/templates/main/jobs.hbs
+++ /dev/null
@@ -1,101 +0,0 @@
-{{!
-* 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.
-}}
-
-
- <div id="jobs">
- <div class="jobs_head">
- <div>{{t menu.item.jobs}}</div>
- {{#if controller.hasNewJobs}}
- <div class="new-jobs-link">
- <a href="javascript:void(null);" {{action updateJobsByClick target="controller"}}>{{t jobs.new_jobs.info}}</a>
- </div>
- {{/if}}
- <div class="jobs-type">
- {{t jobs.type}} : <span class="label label-info">{{t jobs.type.hive}}</span>
- </div>
- </div>
- <table id="jobs-table" class="table advanced-header-table table-bordered table-striped">
- <thead>
- {{#view view.sortView classNames="label-row" contentBinding="view.content"}}
- <th></th>
- {{view view.parentView.idSort}}
- {{view view.parentView.userSort}}
- {{view view.parentView.startTimeSort}}
- {{view view.parentView.endTimeSort}}
- {{view view.parentView.durationSort}}
- {{/view}}
-
- <tr id="filter-row" class="first">
- <th></th>
- <th>{{view view.jobsIdFilterView}}</th>
- <th>{{view view.userFilterView}}</th>
- <th class="start-time">{{view view.startTimeFilterView}}</th>
- <th></th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- {{#if view.noDataToShow}}
- <tr>
- <td class="no-data" {{bindAttr colspan="controller.columnsName.columnsCount"}}>
- {{controller.jobsMessage}}
- </td>
- </tr>
- {{else}}
- {{#each job in controller.sortedContent}}
- <tr>
- <td>
- {{#if job.failed}}
- <i class="icon-remove-sign job-link" {{bindAttr title="view.jobFailMessage"}}></i>
- {{/if}}
- </td>
- <td>
- {{view view.jobNameView jobBinding="job"}}
- </td>
- <td>
- {{job.user}}
- </td>
- <td>
- {{job.startTimeDisplay}}
- </td>
- <td>
- {{job.endTimeDisplay}}
- </td>
- <td>
- {{job.durationDisplay}}
- </td>
- </tr>
- {{/each}}
- {{/if}}
- </tbody>
- </table>
-
- <div class="page-bar">
- <div id="filtered-jobs">
- {{view.filteredJobs}} - <a href="javascript:void(null);" {{action clearFilters target="view"}}>{{t jobs.filtered.clear}}</a>
- </div>
- <div class="items-on-page">
- <label>{{t jobs.show.up.to}}: {{view view.rowsPerPageSelectView selectionBinding="view.displayLength"}}</label>
- </div>
- <div class="paging_two_button">
- {{view view.jobsPaginationLeft}}
- {{view view.jobsPaginationRight}}
- </div>
- </div>
- </div>
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/templates/main/jobs/custom_dates_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/jobs/custom_dates_popup.hbs b/ambari-web/app/templates/main/jobs/custom_dates_popup.hbs
deleted file mode 100644
index 1b1d920..0000000
--- a/ambari-web/app/templates/main/jobs/custom_dates_popup.hbs
+++ /dev/null
@@ -1,39 +0,0 @@
-{{!
-* 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.
-}}
-
-<div class="jobs-custom-dates">
- <div>
- <label>{{t jobs.customDateFilter.startTime}}</label>
- {{view Ember.TextField valueBinding="customDateFormFields.startDate" class="input-small datepicker"}}
- {{view Ember.Select contentBinding="view.hourOptions" selectionBinding="customDateFormFields.hoursForStart" class="input-mini"}}
- {{view Ember.Select contentBinding="view.minuteOptions" selectionBinding="customDateFormFields.minutesForStart" class="input-mini"}}
- {{view Ember.Select contentBinding="view.middayPeriodOptions" selectionBinding="customDateFormFields.middayPeriodForStart" class="input-mini"}}
- <span class="help-inline">{{errorMessages.startDate}}</span>
- </div>
- <div>
-
- </div>
- <div>
- <label>{{t jobs.customDateFilter.endTime}}</label>
- {{view Ember.TextField valueBinding="customDateFormFields.endDate" class="input-small datepicker"}}
- {{view Ember.Select contentBinding="view.hourOptions" selectionBinding="customDateFormFields.hoursForEnd" class="input-mini"}}
- {{view Ember.Select contentBinding="view.minuteOptions" selectionBinding="customDateFormFields.minutesForEnd" class="input-mini"}}
- {{view Ember.Select contentBinding="view.middayPeriodOptions" selectionBinding="customDateFormFields.middayPeriodForEnd" class="input-mini"}}
- <span class="help-inline">{{errorMessages.endDate}}</span>
- </div>
-</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/templates/main/jobs/hive_job_details.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/jobs/hive_job_details.hbs b/ambari-web/app/templates/main/jobs/hive_job_details.hbs
deleted file mode 100644
index 7a4eb3b..0000000
--- a/ambari-web/app/templates/main/jobs/hive_job_details.hbs
+++ /dev/null
@@ -1,215 +0,0 @@
-{{!
-* 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.
-}}
-
-<div id="hive-job-details">
-
- {{#if controller.loaded}}
- <!-- Top Bar -->
- <div class="top-bar">
- <a {{action "routeToJobs" target="controller"}} href="#">{{t menu.item.jobs}}</a> > {{view.content.name}}
- <a {{action "toggleShowQuery" target="view"}} href="#" id="toggle-query">{{view.toggleShowQueryText}}</a>
- <div class="pull-right">Job Type: <span class="label label-info">{{view.content.jobType}}</span></div>
- <div class="alert alert-info query-info">
- <table id="job-more-details-table">
- <tr>
- <td>
- {{t jobs.hive.query}}
- </td>
- <td>
- {{view.content.queryText}}
- </td>
- </tr>
- <tr>
- <td>
- {{t jobs.hive.yarnApplication}}
- </td>
- <td>
- {{#if view.yarnApplicationIdLink}}
- <a {{bindAttr href="view.yarnApplicationIdLink"}} target="_blank">
- {{view.content.tezDag.yarnApplicationId}}
- </a>
- {{else}}
- {{view.content.tezDag.yarnApplicationId}}
- {{/if}}
- </td>
- </tr>
- <tr>
- <td>
- {{t jobs.hive.stages}}
- </td>
- <td>
- <ol>
- {{#each stage in view.content.stages}}
- <li>{{stage.id}}{{stage.description}}.</li>
- {{/each}}
- </ol>
- </td>
- </tr>
- </table>
- </div>
- </div>
-
- <!-- Sections -->
- <div class="row-fluid">
- <div class="span12 sections">
- <!-- Section LHS -->
- <div id="tez-dag-lhs" {{bindAttr class="view.isGraphMaximized:span12:span6 :sections-lhs"}}>
- <div id="tez-dag-section" class="box">
- <div id="tez-dag-section-top-bar">
- {{t jobs.hive.tez.dag.summary.metric}}
- <div class="btn-group display-inline-block">
- <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
- {{view.summaryMetricTypeDisplay}}
- <span class="caret"></span>
- </a>
- <ul class="dropdown-menu">
- <!-- dropdown menu links -->
- {{#each type in view.summaryMetricTypesDisplay}}
- <li>
- <a title="{{type}}" href="#" {{action "doSelectSummaryMetricType" type target="view"}}>{{type}}</a>
- </li>
- {{/each}}
- </ul>
- </div>
- <div id="tez-dag-section-top-bar-actions" class="pull-right">
- <div class="btn-group">
- <a id="tez-dag-zoom-in-button" {{bindAttr class="view.canGraphZoomIn::disabled :btn"}} {{action "doGraphZoomIn" target="view"}}>
- <i class="icon-zoom-in"></i>
- </a>
- <a id="tez-dag-zoom-out-button" {{bindAttr class="view.canGraphZoomOut::disabled :btn"}} {{action "doGraphZoomOut" target="view"}}>
- <i class="icon-zoom-out"></i>
- </a>
- {{#if view.isGraphMaximized}}
- <a id="tez-dag-resize-small-button" class="btn" {{action "doGraphMinimize" target="view"}}>
- <i class="icon-resize-small"></i>
- </a>
- {{else}}
- <a id="tez-dag-resize-full-button" class="btn" {{action "doGraphMaximize" target="view"}}>
- <i class="icon-resize-full"></i>
- </a>
- {{/if}}
- </div>
- </div>
- </div>
- <div id="tez-dag-section-body">
- {{view App.MainHiveJobDetailsTezDagView controllerBinding="controller" selectedVertexBinding="view.selectedVertex"
- summaryMetricTypeBinding="view.summaryMetricType" zoomScaleBinding="view.zoomScale"
- zoomScaleFromBinding="view.zoomScaleFrom" zoomScaleToBinding="view.zoomScaleTo"}}
- </div>
- </div>
- </div>
-
- <!-- Section RHS -->
- <div id="tez-vertices-rhs" {{bindAttr class="view.isGraphMaximized:hidden:span6 :sections-rhs"}}>
-
- <!-- Section RHS Vertices -->
- <div id="tez-vertices-table-section">
- <div id="tez-vertices-table-container" class="section">
- <table class="table table-hover table-bordered table-striped">
- {{#view App.MainHiveJobDetailsVerticesTableView contentBinding="view.sortedVertices" doSelectVertexBinding="view.doSelectVertex" selectedVertexBinding="view.selectedVertex"}}
- <thead>
- {{#view view.sortView contentBinding="view.content"}}
- {{view view.parentView.nameSort}}
- {{view view.parentView.tasksSort}}
- {{view view.parentView.inputSort}}
- {{view view.parentView.outputSort}}
- {{view view.parentView.durationSort}}
- {{/view}}
- </thead>
- <tbody>
- {{#each vertex in view.content}}
- <tr {{bindAttr class="vertex.isSelected:info"}}>
- <td>
- <a title="{{vertex.name}}" href="#" {{action "doSelectVertex" vertex target="view"}}>{{vertex.name}}</a>
- </td>
- <td>{{vertex.tasksNumber}}</td>
- <td>{{vertex.totalReadBytesDisplay}}</td>
- <td>{{vertex.totalWriteBytesDisplay}}</td>
- <td>{{vertex.durationDisplay}}</td>
- </tr>
- {{/each}}
- </tbody>
- {{/view}}
- </table>
- </div>
- </div>
-
- <!-- Section RHS Vertex -->
- {{#if view.selectedVertex}}
- <div id="section tez-vertex-details-section">
- <div class="box">
- <div class="box-header">
- <h4>{{view.selectedVertex.name}}</h4>
- </div>
- <div id="tez-vertex-details-section-body">
- <table class="table no-borders table-condensed">
- <tr>
- <td>{{t common.status}}</td>
- <td>{{view.selectedVertexIODisplay.status}}</td>
- <td></td>
- </tr>
- <tr>
- <td>{{t common.time.start}}</td>
- <td>{{view.selectedVertexIODisplay.started}}</td>
- <td></td>
- </tr>
- <tr>
- <td>{{t common.time.end}}</td>
- <td>{{view.selectedVertexIODisplay.ended}}</td>
- <td></td>
- </tr>
- <tr>
- <td>{{t jobs.hive.tez.tasks}}</td>
- <td>{{view.selectedVertex.tasksCount}}</td>
- <td></td>
- </tr>
- <tr>
- <td>{{t jobs.hive.tez.hdfs}}</td>
- <td>{{view.selectedVertexIODisplay.hdfs.read.ops}} / {{view.selectedVertexIODisplay.hdfs.read.bytes}}</td>
- <td>{{view.selectedVertexIODisplay.hdfs.write.ops}} / {{view.selectedVertexIODisplay.hdfs.write.bytes}}</td>
- </tr>
- <tr>
- <td>{{t jobs.hive.tez.localFiles}}</td>
- <td>{{view.selectedVertexIODisplay.file.read.ops}} / {{view.selectedVertexIODisplay.file.read.bytes}}</td>
- <td>{{view.selectedVertexIODisplay.file.write.ops}} / {{view.selectedVertexIODisplay.file.write.bytes}}</td>
- </tr>
- <tr>
- <td>{{t jobs.hive.tez.spilledRecords}}</td>
- <td>{{view.selectedVertex.spilledRecords}}</td>
- </tr>
- {{#if view.selectedVertexIODisplay.records.read}}
- <tr>
- <td>{{t jobs.hive.tez.records}}</td>
- <td>{{view.selectedVertexIODisplay.records.read}}</td>
- <td>{{view.selectedVertexIODisplay.records.write}}</td>
- </tr>
- {{/if}}
- </table>
- </div>
- </div>
- </div>
- {{/if}}
- </div>
- </div>
- </div>
- {{else}}
- <div class="alert alert-info">
- <h4>{{t app.loadingPlaceholder}}</h4>
- </div>
- {{/if}}
-</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/templates/main/jobs/hive_job_details_tez_dag.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/jobs/hive_job_details_tez_dag.hbs b/ambari-web/app/templates/main/jobs/hive_job_details_tez_dag.hbs
deleted file mode 100644
index 4d8d9e7..0000000
--- a/ambari-web/app/templates/main/jobs/hive_job_details_tez_dag.hbs
+++ /dev/null
@@ -1,44 +0,0 @@
-{{!
-* 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.
-}}
-
-<div id="tez-dag-section-body-dag">
- <svg id="tez-dag-svg" stroke="black" strokeWidth="2">
- <defs>
- <marker id="arrow" viewBox="0 -5 10 10" refX="4" markerWidth="3" markerHeight="3" orient="auto">
- <path d="M0,-5L10,0L0,5"></path>
- </marker>
- <filter id="shadow" width="200%" height="200%">
- <feGaussianBlur in="SourceAlpha" stdDeviation="3"/>
- <feOffset dx="2" dy="2" result="offsetblur"/>
- <feMerge>
- <feMergeNode/>
- <feMergeNode in="SourceGraphic"/>
- </feMerge>
- </filter>
- <clipPath id="operatorClipPath">
- <rect x="0" y="0" width="50" height="16">
- </rect>
- </clipPath>
- <font-face xmlns="http://www.w3.org/2000/svg" font-family="FontAwesome" unicode-range="U+0-7F">
- <font-face-src>
- <font-face-uri xlink:href="font/fontawesome-webfont.svg" xmlns:xlink="http://www.w3.org/1999/xlink"/>
- </font-face-src>
- </font-face>
- </defs>
- </svg>
-</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/templates/main/jobs/hover_op_table.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/jobs/hover_op_table.hbs b/ambari-web/app/templates/main/jobs/hover_op_table.hbs
deleted file mode 100644
index 22fa336..0000000
--- a/ambari-web/app/templates/main/jobs/hover_op_table.hbs
+++ /dev/null
@@ -1,39 +0,0 @@
-{{!
-* 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.
-}}
-
-<p>{{content.operationName}}</p>
-<table id="hover-op-table" class="table table-bordered">
- <thead>
- <tr>
- <th>{{t common.name}}</th>
- <th>{{t common.value}}</th>
- </tr>
- </thead>
- <tbody>
- {{#each keys in content.operatorPlanObj}}
- <tr>
- <td>
- {{keys.name}}
- </td>
- <td>
- {{keys.value}}
- </td>
- </tr>
- {{/each}}
- </tbody>
-</table>
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/templates/main/jobs/user_filter.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/jobs/user_filter.hbs b/ambari-web/app/templates/main/jobs/user_filter.hbs
deleted file mode 100644
index 4b93eb2..0000000
--- a/ambari-web/app/templates/main/jobs/user_filter.hbs
+++ /dev/null
@@ -1,34 +0,0 @@
-{{!
-* 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.
-}}
-<button class="btn single-btn-group filter-btn" {{action "clickFilterButton" target="view"}}>
- {{t common.user}} <i class="icon-filter"></i>
-</button>
-<ul class="dropdown-menu filter-components">
- <li id="title-bar">{{t apps.filters.filterComponents}}
- <a class="close" {{action "closeFilter" target="view"}}>X</a>
- </li>
- {{#each user in view.users}}
- <li>
- <label class="checkbox">{{view Ember.Checkbox checkedBinding="user.checked"}} {{user.name}}</label>
- </li>
- {{/each}}
-
- <li id="button-bar">
- <button class="btn btn-inverse" {{action "applyFilter" target="view"}}>{{t common.apply}}</button>
- </li>
-</ul>
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/utils/jobs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/jobs.js b/ambari-web/app/utils/jobs.js
deleted file mode 100644
index 8d8ee3f..0000000
--- a/ambari-web/app/utils/jobs.js
+++ /dev/null
@@ -1,263 +0,0 @@
-/**
- * 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.
- */
-
-var App = require('app');
-module.exports = {
-
- /**
- * Refreshes the latest information for a given job
- *
- * @param {App.AbstractJob}
- * job
- * @param {Function}
- * successCallback
- * @param {Funtion}
- * errorCallback(errorId) Called in error cases where there is no
- * data from server. 'errorId' can be one of
- * <ul>
- * <li>job.dag.noId</li>
- * <li>job.dag.noname</li>
- * <li>job.dag.id.noDag</li>
- * <li>job.dag.id.loaderror</li>
- * <li>job.dag.name.loaderror</li>
- * </ul>
- */
- refreshJobDetails : function(job, successCallback, errorCallback) {
- this.refreshHiveJobDetails(job, successCallback, errorCallback);
- },
-
- /**
- * Refreshes latest information of a Hive Job.
- *
- * @param {App.HiveJob}
- * hiveJob
- * @param {Function}
- * successCallback
- * @param {Function}
- * errorCallback @see #refreshJobDetails()
- */
- refreshHiveJobDetails : function(hiveJob, successCallback, errorCallback) {
- var self = this;
- // TODO - to be changed to history server when implemented in stack.
- var yarnService = App.YARNService.find().objectAt(0);
- var historyServerHostName = yarnService.get('appTimelineServer.hostName');
- var ahsWebPort = yarnService.get('ahsWebPort');
- var hiveJobId = hiveJob.get('id');
- // First refresh query
- var hiveQueriesUrl = App.get('testMode') ? "/data/jobs/hive-query-2.json" : "/proxy?url=http://" + historyServerHostName
- + ":" + ahsWebPort + "/ws/v1/timeline/HIVE_QUERY_ID/" + hiveJob.get('id') + "?fields=events,otherinfo";
- App.HttpClient.get(hiveQueriesUrl, App.hiveJobMapper, {
- complete : function(jqXHR, textStatus) {
- // Now get the Tez DAG ID from the DAG name
- var hiveRecord = App.HiveJob.find(hiveJobId);
- App.router.get('mainHiveJobDetailsController').set('job', hiveRecord);
- var tezDagName = hiveRecord.get('tezDag.name');
- if (tezDagName != null) {
- var sender = {
- dagNameToIdSuccess : function(data) {
- if (data && data.entities && data.entities.length > 0) {
- var dagId = data.entities[0].entity;
- App.TezDag.find(tezDagName).set('instanceId', dagId);
- self.refreshTezDagDetails(tezDagName, successCallback, errorCallback);
- }else{
- console.log('No Tez DAG was found for DAG name of ' + tezDagName);
- errorCallback('job.dag.noId');
- }
- },
- dagNameToIdError : function(jqXHR, url, method, showStatus) {
- App.ajax.defaultErrorHandler(jqXHR, url, method, showStatus);
- errorCallback('job.dag.name.loaderror');
- }
- }
- App.ajax.send({
- name : 'jobs.tezDag.NametoID',
- sender : sender,
- data : {
- historyServerHostName : historyServerHostName,
- tezDagName : tezDagName,
- ahsWebPort: ahsWebPort
- },
- success : 'dagNameToIdSuccess',
- error : 'dagNameToIdError'
- });
- } else {
- console.log('No Tez DAG name to ask ID for. Job ID: ' + hiveJobId);
- errorCallback('job.dag.noname');
- }
- }
- }, function () {
- App.router.transitionTo('main.jobs.index');
- });
- },
-
- /**
- * Refreshes runtime information of a Tez DAG based on events generated. The
- * instance ID of the Tez DAG should be set.
- *
- * @param {string}
- * tezDagId ID of the Tez DAG. Example: 'HIVE-Q2:1'
- * @param {Function}
- * successCallback
- * @param {Function}
- * errorCallback @see #refreshJobDetails()
- */
- refreshTezDagDetails : function(tezDagId, successCallback, errorCallback) {
- var self = this;
- var yarnService = App.YARNService.find().objectAt(0);
- var ahsWebPort = yarnService.get('ahsWebPort');
- var historyServerHostName = yarnService.get('appTimelineServer.hostName');
- var tezDag = App.TezDag.find(tezDagId);
- if (tezDag) {
- var tezDagInstanceId = tezDag.get('instanceId');
- var sender = {
- loadTezDagSuccess : function(data) {
- if (data) {
- if (data.otherinfo && data.otherinfo.applicationId) {
- tezDag.set('yarnApplicationId', data.otherinfo.applicationId);
- }
- if (data.relatedentities && data.relatedentities.TEZ_VERTEX_ID != null) {
- var count = data.relatedentities.TEZ_VERTEX_ID.length;
- data.relatedentities.TEZ_VERTEX_ID.forEach(function(v) {
- self.refreshTezDagVertex(tezDagId, v, function() {
- if (--count <= 0) {
- // all vertices succeeded
- successCallback();
- }
- });
- });
- }
- }
- },
- loadTezDagError : function(jqXHR, url, method, showStatus) {
- App.ajax.defaultErrorHandler(jqXHR, url, method, showStatus);
- errorCallback('job.dag.id.loaderror');
- }
- }
- App.ajax.send({
- name : 'jobs.tezDag.tezDagId',
- sender : sender,
- data : {
- historyServerHostName : historyServerHostName,
- tezDagId : tezDagInstanceId,
- ahsWebPort: ahsWebPort
- },
- success : 'loadTezDagSuccess',
- error : 'loadTezDagError'
- });
- } else {
- console.log('Unable to find DAG for ID: ' + tezDagId);
- errorCallback('job.dag.id.noDag');
- }
- },
-
- /**
- * Refreshes runtime information of the given vertex.
- *
- * @param {string}
- * tezDagId ID of the Tez DAG. Exmaple: 'HIVE-Q2:1'
- * @param {string}
- * tezVertexInstanceID Instance ID of the vertex to refresh. Example
- * 'vertex_1390516007863_0001_1_00'
- * @param {Function}
- * successCallback
- */
- refreshTezDagVertex : function(tezDagId, tezVertexInstanceId, successCallback) {
- var yarnService = App.YARNService.find().objectAt(0);
- var ahsWebPort = yarnService.get('ahsWebPort');
- var historyServerHostName = yarnService.get('appTimelineServer.hostName');
- var tezDag = App.TezDag.find(tezDagId);
- var hiveJob = App.HiveJob.find().findProperty('tezDag', tezDag);
- var hiveJobFailed = hiveJob.get('failed');
- var hiveJobEndTime = hiveJob.get('endTime');
- var sender = {
- loadTezDagVertexSuccess : function(data) {
- if (data && data.otherinfo) {
- var vertexRecord = App.TezDagVertex.find(tezDagId + "/" + data.otherinfo.vertexName);
- if (vertexRecord != null) {
- vertexRecord.set('startTime', data.otherinfo.startTime);
- if (data.otherinfo.endTime == undefined && hiveJobFailed) {
- vertexRecord.set('endTime', hiveJobEndTime);
- } else {
- vertexRecord.set('endTime', data.otherinfo.endTime);
- };
- vertexRecord.set('tasksCount', data.otherinfo.numTasks);
- if (data.otherinfo.status == null && hiveJobFailed) {
- vertexRecord.set('state', Em.I18n.t('jobs.hive.failed'));
- } else {
- vertexRecord.set('state', data.otherinfo.status);
- };
- if (data.otherinfo.counters && data.otherinfo.counters.counterGroups) {
- data.otherinfo.counters.counterGroups.forEach(function(cGroup) {
- var cNameToPropetyMap = {};
- switch (cGroup.counterGroupName) {
- case 'org.apache.tez.common.counters.FileSystemCounter':
- cNameToPropetyMap = {
- 'FILE_BYTES_READ' : 'fileReadBytes',
- 'FILE_BYTES_WRITTEN' : 'fileWriteBytes',
- 'FILE_READ_OPS' : 'fileReadOps',
- 'FILE_WRITE_OPS' : 'fileWriteOps',
- 'HDFS_BYTES_READ' : 'hdfsReadBytes',
- 'HDFS_BYTES_WRITTEN' : 'hdfsWriteBytes',
- 'HDFS_READ_OPS' : 'hdfsReadOps',
- 'HDFS_WRITE_OPS' : 'hdfsWriteOps'
- };
- break;
- case 'org.apache.tez.common.counters.TaskCounter':
- cNameToPropetyMap = {
- 'SPILLED_RECORDS' : 'spilledRecords'
- };
- break;
- case 'HIVE':
- cNameToPropetyMap = {
- 'RECORDS_READ' : 'recordReadCount',
- 'RECORDS_WRITE' : 'recordWriteCount'
- };
- break;
- default:
- break;
- }
- if (cGroup.counters) {
- cGroup.counters.forEach(function(counter) {
- var prop = cNameToPropetyMap[counter.counterName];
- if (prop != null) {
- vertexRecord.set(prop, counter.counterValue);
- }
- });
- }
- });
- }
- successCallback();
- }
- }
- },
- loadTezDagVertexError : function(jqXHR, url, method, showStatus) {
- App.ajax.defaultErrorHandler(jqXHR, url, method, showStatus);
- }
- }
- App.ajax.send({
- name : 'jobs.tezDag.tezDagVertexId',
- sender : sender,
- data : {
- historyServerHostName : historyServerHostName,
- tezDagVertexId : tezVertexInstanceId,
- ahsWebPort: ahsWebPort
- },
- success : 'loadTezDagVertexSuccess',
- error : 'loadTezDagVertexError'
- });
- }
-};
http://git-wip-us.apache.org/repos/asf/ambari/blob/2f5ee092/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index 8790fed..21eeb16 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -243,10 +243,6 @@ require('views/main/charts/heatmap/heatmap_rack');
require('views/main/charts/heatmap/heatmap_host');
require('views/main/charts/heatmap/heatmap_host_detail');
require('views/main/apps_view');
-require('views/main/jobs_view');
-require('views/main/jobs/select_custom_date_view');
-require('views/main/jobs/hive_job_details_view');
-require('views/main/jobs/hive_job_details_tez_dag_view');
require('views/main/apps/item_view');
require('views/main/apps/item/bar_view');
require('views/main/apps/item/dag_view');
[6/6] git commit: AMBARI-6835. View Packaging: create a way to
package views into Ambari by default using build time parameters (srimanth)
Posted by jo...@apache.org.
AMBARI-6835. View Packaging: create a way to package views into Ambari by default using build time parameters (srimanth)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8c537a1f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8c537a1f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8c537a1f
Branch: refs/heads/branch-alerts-dev
Commit: 8c537a1fe1fa89bfbb0d5f6edf75e7c5fe93c5c1
Parents: 2f5ee09
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Wed Aug 13 14:13:27 2014 -0700
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Thu Aug 14 09:19:16 2014 -0400
----------------------------------------------------------------------
ambari-server/pom.xml | 28 +++++++++++++++++---
contrib/views/capacity-scheduler/pom.xml | 17 ++++++++++++
contrib/views/files/pom.xml | 17 ++++++++++++
contrib/views/pig/pom.xml | 17 ++++++++++++
contrib/views/pom.xml | 19 +++++++++++++
contrib/views/slider/pom.xml | 17 ++++++++++++
.../slider/clients/AmbariInternalClient.java | 2 +-
pom.xml | 19 +++++++++++++
8 files changed, 132 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/8c537a1f/ambari-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index 72e9863..2ec71ab 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -35,6 +35,7 @@
<resource_management.install.dir>/usr/lib/ambari-server/lib/resource_management</resource_management.install.dir>
<ambari-web-dir>${basedir}/../ambari-web/public</ambari-web-dir>
<ambari-admin-dir>${basedir}/../ambari-admin</ambari-admin-dir>
+ <contrib-views-dir>${basedir}/../contrib/views</contrib-views-dir>
</properties>
<build>
<plugins>
@@ -423,7 +424,10 @@
<filemode>755</filemode>
<sources>
<source>
- <location>${ambari-admin-dir}/target/ambari-admin-${project.version}.jar</location>
+ <location>${ambari-admin-dir}/target</location>
+ <includes>
+ <include>*.jar</include>
+ </includes>
</source>
</sources>
</mapping>
@@ -754,8 +758,9 @@
</mapper>
</data>
<data>
- <src>${ambari-admin-dir}/target/ambari-admin-${project.version}.jar</src>
- <type>file</type>
+ <src>${ambari-admin-dir}/target</src>
+ <type>directory</type>
+ <includes>*.jar</includes>
<mapper>
<type>perm</type>
<prefix>/var/lib/ambari-server/resources/views</prefix>
@@ -982,6 +987,23 @@
<goal>run</goal>
</goals>
</execution>
+ <!-- Copies compiled views into known location for RPM builds -->
+ <execution>
+ <id>copy-view-jars</id>
+ <phase>package</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <copy todir="${ambari-admin-dir}/target" flatten="true">
+ <fileset dir="${contrib-views-dir}">
+ <include name="*/target/*jar" />
+ </fileset>
+ </copy>
+ </target>
+ </configuration>
+ </execution>
</executions>
</plugin>
</plugins>
http://git-wip-us.apache.org/repos/asf/ambari/blob/8c537a1f/contrib/views/capacity-scheduler/pom.xml
----------------------------------------------------------------------
diff --git a/contrib/views/capacity-scheduler/pom.xml b/contrib/views/capacity-scheduler/pom.xml
index 225acb8..bf851c8 100644
--- a/contrib/views/capacity-scheduler/pom.xml
+++ b/contrib/views/capacity-scheduler/pom.xml
@@ -149,6 +149,23 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.vafer</groupId>
+ <artifactId>jdeb</artifactId>
+ <version>1.0.1</version>
+ <executions>
+ <execution>
+ <phase>none</phase>
+ <goals>
+ <goal>jdeb</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <skip>true</skip>
+ <submodules>false</submodules>
+ </configuration>
+ </plugin>
</plugins>
<resources>
<resource>
http://git-wip-us.apache.org/repos/asf/ambari/blob/8c537a1f/contrib/views/files/pom.xml
----------------------------------------------------------------------
diff --git a/contrib/views/files/pom.xml b/contrib/views/files/pom.xml
index 8194fc7..dd8325e 100644
--- a/contrib/views/files/pom.xml
+++ b/contrib/views/files/pom.xml
@@ -207,6 +207,23 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.vafer</groupId>
+ <artifactId>jdeb</artifactId>
+ <version>1.0.1</version>
+ <executions>
+ <execution>
+ <phase>none</phase>
+ <goals>
+ <goal>jdeb</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <skip>true</skip>
+ <submodules>false</submodules>
+ </configuration>
+ </plugin>
</plugins>
<resources>
<resource>
http://git-wip-us.apache.org/repos/asf/ambari/blob/8c537a1f/contrib/views/pig/pom.xml
----------------------------------------------------------------------
diff --git a/contrib/views/pig/pom.xml b/contrib/views/pig/pom.xml
index f1ec302..809cdd3 100644
--- a/contrib/views/pig/pom.xml
+++ b/contrib/views/pig/pom.xml
@@ -199,6 +199,23 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.vafer</groupId>
+ <artifactId>jdeb</artifactId>
+ <version>1.0.1</version>
+ <executions>
+ <execution>
+ <phase>none</phase>
+ <goals>
+ <goal>jdeb</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <skip>true</skip>
+ <submodules>false</submodules>
+ </configuration>
+ </plugin>
</plugins>
<resources>
<resource>
http://git-wip-us.apache.org/repos/asf/ambari/blob/8c537a1f/contrib/views/pom.xml
----------------------------------------------------------------------
diff --git a/contrib/views/pom.xml b/contrib/views/pom.xml
index 529d12a..d5b1e2e 100644
--- a/contrib/views/pom.xml
+++ b/contrib/views/pom.xml
@@ -88,6 +88,25 @@
<mappings/>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.vafer</groupId>
+ <artifactId>jdeb</artifactId>
+ <version>1.0.1</version>
+ <executions>
+ <execution>
+ <phase>none</phase>
+ <goals>
+ <goal>jdeb</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <skip>true</skip>
+ <attach>false</attach>
+ <submodules>true</submodules>
+ <controlDir>${basedir}/../../ambari-project/src/main/package/deb/control</controlDir>
+ </configuration>
+ </plugin>
</plugins>
</build>
<dependencyManagement>
http://git-wip-us.apache.org/repos/asf/ambari/blob/8c537a1f/contrib/views/slider/pom.xml
----------------------------------------------------------------------
diff --git a/contrib/views/slider/pom.xml b/contrib/views/slider/pom.xml
index 9f66554..f3d6ad0 100644
--- a/contrib/views/slider/pom.xml
+++ b/contrib/views/slider/pom.xml
@@ -483,6 +483,23 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.vafer</groupId>
+ <artifactId>jdeb</artifactId>
+ <version>1.0.1</version>
+ <executions>
+ <execution>
+ <phase>none</phase>
+ <goals>
+ <goal>jdeb</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <skip>true</skip>
+ <submodules>false</submodules>
+ </configuration>
+ </plugin>
</plugins>
<resources>
<resource>
http://git-wip-us.apache.org/repos/asf/ambari/blob/8c537a1f/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/clients/AmbariInternalClient.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/clients/AmbariInternalClient.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/clients/AmbariInternalClient.java
index d7f41dc..529af9d 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/clients/AmbariInternalClient.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/clients/AmbariInternalClient.java
@@ -69,7 +69,7 @@ public class AmbariInternalClient implements AmbariClient {
for (Map.Entry<String, Object> siteEntry : desiredConfigsMapResource
.entrySet()) {
desiredConfigsMap.put(siteEntry.getKey(),
- ((DesiredConfig) siteEntry.getValue()).getVersion());
+ ((DesiredConfig) siteEntry.getValue()).getTag());
}
cluster.setDesiredConfigs(desiredConfigsMap);
http://git-wip-us.apache.org/repos/asf/ambari/blob/8c537a1f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 2feae5a..356090e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -286,6 +286,25 @@
</modules>
</profile>
<profile>
+ <id>default-views</id>
+ <activation>
+ <property>
+ <name>views</name>
+ </property>
+ </activation>
+ <modules>
+ <module>ambari-web</module>
+ <module>ambari-project</module>
+ <module>ambari-views</module>
+ <module>ambari-admin</module>
+ <module>contrib/views</module>
+ <module>ambari-server</module>
+ <module>ambari-agent</module>
+ <module>ambari-client</module>
+ <module>ambari-shell</module>
+ </modules>
+ </profile>
+ <profile>
<id>static-web</id>
<modules>
<module>ambari-project</module>