You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by re...@apache.org on 2014/12/04 16:17:34 UTC
[1/5] stratos git commit: Update the python agent publisher events
with instance_id
Repository: stratos
Updated Branches:
refs/heads/master bf4d3c254 -> 73202bcec
Update the python agent publisher events with instance_id
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/fbb4dda2
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/fbb4dda2
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/fbb4dda2
Branch: refs/heads/master
Commit: fbb4dda2c33749cbde5d0bf6834f7051c055193f
Parents: bf4d3c2
Author: gayan <ga...@puppet.gayan.org>
Authored: Thu Dec 4 20:01:47 2014 +0530
Committer: gayan <ga...@puppet.gayan.org>
Committed: Thu Dec 4 20:01:47 2014 +0530
----------------------------------------------------------------------
.../cartridgeagent/modules/event/instance/notifier/events.py | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/fbb4dda2/components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/event/instance/notifier/events.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/event/instance/notifier/events.py b/components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/event/instance/notifier/events.py
index eb7be55..c42182d 100644
--- a/components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/event/instance/notifier/events.py
+++ b/components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/event/instance/notifier/events.py
@@ -34,6 +34,8 @@ class ArtifactUpdatedEvent:
""" :type : int """
self.commit_enabled = None
""" :type : bool """
+ self.instance_id=None
+ """ :type : str """
@staticmethod
def create_from_json(json_str):
[4/5] stratos git commit: improving status calculation of cluster
Posted by re...@apache.org.
improving status calculation of cluster
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/ef6f5286
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/ef6f5286
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/ef6f5286
Branch: refs/heads/master
Commit: ef6f5286a9c23662f1fb21f40c43657a0c858350
Parents: bf4d3c2
Author: reka <rt...@gmail.com>
Authored: Thu Dec 4 20:02:59 2014 +0530
Committer: reka <rt...@gmail.com>
Committed: Thu Dec 4 20:03:10 2014 +0530
----------------------------------------------------------------------
.../context/cluster/ClusterInstanceContext.java | 8 ++++++++
.../autoscaler/context/cluster/VMClusterContext.java | 8 ++++----
.../processor/cluster/ClusterStatusActiveProcessor.java | 10 ++++------
.../cluster/ClusterStatusInActiveProcessor.java | 12 +++++++-----
4 files changed, 23 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/ef6f5286/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterInstanceContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterInstanceContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterInstanceContext.java
index 509ccfe..ab4bec3 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterInstanceContext.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/ClusterInstanceContext.java
@@ -438,4 +438,12 @@ public class ClusterInstanceContext extends InstanceContext {
return networkPartitionId;
}
+ public int getActiveMembers() {
+ int activeMembers = 0;
+ for(ClusterLevelPartitionContext partitionContext : this.partitionCtxts) {
+ activeMembers += partitionContext.getActiveInstanceCount();
+ }
+ return activeMembers;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ef6f5286/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMClusterContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMClusterContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMClusterContext.java
index 2cdef55..42639bd 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMClusterContext.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/context/cluster/VMClusterContext.java
@@ -240,16 +240,16 @@ public class VMClusterContext extends AbstractClusterContext {
ClusterInstanceContext clusterInstanceContext = clusterLevelNetworkPartitionContext.
getClusterInstanceContext(clusterInstance.getInstanceId());
- int maxInstances = 2;
+ int maxInstances = 1;
if (clusterInstanceContext == null) {
- int minInstances = 2;
+ int minInstances = 1;
ApplicationHolder.acquireReadLock();
try {
Application application = ApplicationHolder.getApplications().
getApplication(cluster.getAppId());
ClusterDataHolder dataHolder = application.getClusterData(AutoscalerUtil.getAliasFromClusterId(clusterId));
- //TODO minInstances = dataHolder.getMinInstances();
- //maxInstances = dataHolder.getMaxInstances();
+ minInstances = dataHolder.getMinInstances();
+ maxInstances = dataHolder.getMaxInstances();
} finally {
ApplicationHolder.releaseReadLock();
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ef6f5286/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusActiveProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusActiveProcessor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusActiveProcessor.java
index 1967a4b..8e9d99c 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusActiveProcessor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusActiveProcessor.java
@@ -70,16 +70,14 @@ public class ClusterStatusActiveProcessor extends ClusterStatusProcessor {
for (ClusterLevelNetworkPartitionContext clusterLevelNetworkPartitionContext : monitor.getNetworkPartitionCtxts()) {
//minimum check per partition
ClusterInstanceContext instanceContext = clusterLevelNetworkPartitionContext.getClusterInstanceContext(instanceId);
- for (ClusterLevelPartitionContext clusterMonitorPartitionContext : instanceContext.getPartitionCtxts()) {
- if (clusterMonitorPartitionContext.getMinimumMemberCount() == clusterMonitorPartitionContext.getActiveMemberCount()) {
- clusterActive = true;
- } else if (clusterMonitorPartitionContext.getActiveMemberCount() > clusterMonitorPartitionContext.getMinimumMemberCount()) {
- log.info("cluster already activated...");
+ if(instanceContext != null) {
+ if(instanceContext.getActiveMembers() >= instanceContext.getMaxInstanceCount()) {
clusterActive = true;
} else {
- return false;
+ clusterActive = false;
}
}
+
}
if(clusterActive) {
if (log.isInfoEnabled()) {
http://git-wip-us.apache.org/repos/asf/stratos/blob/ef6f5286/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusInActiveProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusInActiveProcessor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusInActiveProcessor.java
index c0773a4..490f914 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusInActiveProcessor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/status/processor/cluster/ClusterStatusInActiveProcessor.java
@@ -92,15 +92,17 @@ public class ClusterStatusInActiveProcessor extends ClusterStatusProcessor {
private boolean getClusterInactive(String instanceId, VMClusterMonitor monitor) {
boolean clusterInActive = false;
- for (ClusterLevelNetworkPartitionContext clusterLevelNetworkPartitionContext : monitor.getAllNetworkPartitionCtxts().values()) {
- ClusterInstanceContext instanceContext = clusterLevelNetworkPartitionContext.getClusterInstanceContext(instanceId);
- for (ClusterLevelPartitionContext partition : instanceContext.getPartitionCtxts()) {
- if (partition.getActiveMemberCount() <= partition.getMinimumMemberCount()) {
+ for (ClusterLevelNetworkPartitionContext clusterLevelNetworkPartitionContext :
+ monitor.getAllNetworkPartitionCtxts().values()) {
+ ClusterInstanceContext instanceContext = clusterLevelNetworkPartitionContext.
+ getClusterInstanceContext(instanceId);
+ if(instanceContext != null) {
+ if(instanceContext.getActiveMembers() < instanceContext.getMaxInstanceCount()) {
clusterInActive = true;
- return clusterInActive;
}
}
+
}
return clusterInActive;
}
[2/5] stratos git commit: Update the python agent publisher events
with instance_id
Posted by re...@apache.org.
Update the python agent publisher events with instance_id
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/102a039e
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/102a039e
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/102a039e
Branch: refs/heads/master
Commit: 102a039e081140112fd8670d8c0ff9bc546dbcad
Parents: fbb4dda
Author: gayan <ga...@puppet.gayan.org>
Authored: Thu Dec 4 20:02:20 2014 +0530
Committer: gayan <ga...@puppet.gayan.org>
Committed: Thu Dec 4 20:02:20 2014 +0530
----------------------------------------------------------------------
.../modules/event/instance/status/events.py | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/102a039e/components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/event/instance/status/events.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/event/instance/status/events.py b/components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/event/instance/status/events.py
index c000c55..5e5e8ab 100644
--- a/components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/event/instance/status/events.py
+++ b/components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/event/instance/status/events.py
@@ -19,7 +19,7 @@ import json
class InstanceActivatedEvent:
- def __init__(self, service_name, cluster_id, network_partition_id, parition_id, member_id):
+ def __init__(self, service_name, cluster_id, network_partition_id, parition_id, member_id, instance_id):
self.serviceName = service_name
""" :type : str """
self.clusterId = cluster_id
@@ -30,13 +30,15 @@ class InstanceActivatedEvent:
""" :type : str """
self.memberId = member_id
""" :type : str """
+ self.instanceId = instance_id
+ """ :type : str """
def to_json(self):
return to_json(self)
class InstanceStartedEvent:
- def __init__(self, service_name, cluster_id, network_partition_id, parition_id, member_id):
+ def __init__(self, service_name, cluster_id, network_partition_id, parition_id, member_id,instance_id):
self.serviceName = service_name
""" :type : str """
self.clusterId = cluster_id
@@ -47,6 +49,9 @@ class InstanceStartedEvent:
""" :type : str """
self.memberId = member_id
""" :type : str """
+ self.instanceId = instance_id
+ """ :type : str """
+
def to_json(self):
return to_json(self)
@@ -54,7 +59,7 @@ class InstanceStartedEvent:
class InstanceMaintenanceModeEvent:
- def __init__(self, service_name, cluster_id, network_partition_id, partition_id, member_id):
+ def __init__(self, service_name, cluster_id, network_partition_id, partition_id, member_id, instance_id):
self.serviceName = service_name
""" :type : str """
self.clusterId = cluster_id
@@ -65,6 +70,8 @@ class InstanceMaintenanceModeEvent:
""" :type : str """
self.memberId = member_id
""" :type : str """
+ self.instanceId = instance_id
+ """ :type : str """
def to_json(self):
return to_json(self)
@@ -72,7 +79,7 @@ class InstanceMaintenanceModeEvent:
class InstanceReadyToShutdownEvent:
- def __init__(self, service_name, cluster_id, network_partition_id, partition_id, member_id):
+ def __init__(self, service_name, cluster_id, network_partition_id, partition_id, member_id, instance_id):
self.serviceName = service_name
""" :type : str """
self.clusterId = cluster_id
@@ -83,6 +90,8 @@ class InstanceReadyToShutdownEvent:
""" :type : str """
self.memberId = member_id
""" :type : str """
+ self.instanceId = instance_id
+ """ :type : str """
def to_json(self):
return to_json(self)
[3/5] stratos git commit: Update the python agent publisher events
with instance_id
Posted by re...@apache.org.
Update the python agent publisher events with instance_id
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/41f3c318
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/41f3c318
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/41f3c318
Branch: refs/heads/master
Commit: 41f3c318cbd7167480cd764d9e9b42c8b1558de3
Parents: 102a039
Author: gayan <ga...@puppet.gayan.org>
Authored: Thu Dec 4 20:02:35 2014 +0530
Committer: gayan <ga...@puppet.gayan.org>
Committed: Thu Dec 4 20:02:35 2014 +0530
----------------------------------------------------------------------
.../modules/publisher/cartridgeagentpublisher.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/41f3c318/components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/publisher/cartridgeagentpublisher.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/publisher/cartridgeagentpublisher.py b/components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/publisher/cartridgeagentpublisher.py
index b218fbe..893b679 100644
--- a/components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/publisher/cartridgeagentpublisher.py
+++ b/components/org.apache.stratos.python.cartridge.agent/cartridgeagent/cartridgeagent/modules/publisher/cartridgeagentpublisher.py
@@ -46,9 +46,10 @@ def publish_instance_started_event():
network_partition_id = CartridgeAgentConfiguration().network_partition_id
parition_id = CartridgeAgentConfiguration().partition_id
member_id = CartridgeAgentConfiguration().member_id
+ instance_id = CartridgeAgentConfiguration().instance_id
instance_started_event = InstanceStartedEvent(service_name, cluster_id, network_partition_id, parition_id,
- member_id)
+ member_id,instance_id)
publisher = get_publisher(cartridgeagentconstants.INSTANCE_STATUS_TOPIC + cartridgeagentconstants.INSTANCE_STARTED_EVENT)
publisher.publish(instance_started_event)
started = True
@@ -66,9 +67,10 @@ def publish_instance_activated_event():
network_partition_id = CartridgeAgentConfiguration().network_partition_id
parition_id = CartridgeAgentConfiguration().partition_id
member_id = CartridgeAgentConfiguration().member_id
+ instance_id= CartridgeAgentConfiguration().instance_id
instance_activated_event = InstanceActivatedEvent(service_name, cluster_id, network_partition_id, parition_id,
- member_id)
+ member_id,instance_id)
publisher = get_publisher(cartridgeagentconstants.INSTANCE_STATUS_TOPIC + cartridgeagentconstants.INSTANCE_ACTIVATED_EVENT)
publisher.publish(instance_activated_event)
@@ -108,9 +110,10 @@ def publish_maintenance_mode_event():
network_partition_id = CartridgeAgentConfiguration().network_partition_id
parition_id = CartridgeAgentConfiguration().partition_id
member_id = CartridgeAgentConfiguration().member_id
+ instance_id = CartridgeAgentConfiguration().instance_id
instance_maintenance_mode_event = InstanceMaintenanceModeEvent(service_name, cluster_id, network_partition_id, parition_id,
- member_id)
+ member_id,instance_id)
publisher = get_publisher(cartridgeagentconstants.INSTANCE_STATUS_TOPIC + cartridgeagentconstants.INSTANCE_MAINTENANCE_MODE_EVENT)
publisher.publish(instance_maintenance_mode_event)
@@ -131,9 +134,10 @@ def publish_instance_ready_to_shutdown_event():
network_partition_id = CartridgeAgentConfiguration().network_partition_id
parition_id = CartridgeAgentConfiguration().partition_id
member_id = CartridgeAgentConfiguration().member_id
+ instance_id = CartridgeAgentConfiguration().instance_id
instance_shutdown_event = InstanceReadyToShutdownEvent(service_name, cluster_id, network_partition_id, parition_id,
- member_id)
+ member_id,instance_id)
publisher = get_publisher(cartridgeagentconstants.INSTANCE_STATUS_TOPIC + cartridgeagentconstants.INSTANCE_READY_TO_SHUTDOWN_EVENT)
publisher.publish(instance_shutdown_event)
[5/5] stratos git commit: Merge branch 'master' of
https://github.com/gayangunarathne/stratos This closes #135
Posted by re...@apache.org.
Merge branch 'master' of https://github.com/gayangunarathne/stratos
This closes #135
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/73202bce
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/73202bce
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/73202bce
Branch: refs/heads/master
Commit: 73202bcec7af7cbf5614bc027d146e842af03445
Parents: ef6f528 41f3c31
Author: reka <rt...@gmail.com>
Authored: Thu Dec 4 20:46:11 2014 +0530
Committer: reka <rt...@gmail.com>
Committed: Thu Dec 4 20:46:11 2014 +0530
----------------------------------------------------------------------
.../modules/event/instance/notifier/events.py | 2 ++
.../modules/event/instance/status/events.py | 17 +++++++++++++----
.../modules/publisher/cartridgeagentpublisher.py | 12 ++++++++----
3 files changed, 23 insertions(+), 8 deletions(-)
----------------------------------------------------------------------