Skip to content

Commit

Permalink
info namespace modified for migrate column:
Browse files Browse the repository at this point in the history
  column name changed from migrate to Pending Migrate
  column values changed to show floor of actual float percentages
  • Loading branch information
hbpatre committed Mar 9, 2016
1 parent 21866e8 commit 067d6c8
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import math

from lib.table import Table, Extractors, TitleFormats, Styles
import sys
Expand Down Expand Up @@ -190,7 +191,7 @@ def infoNamespace(stats, cluster, **ignore):
, ('_prole-objects', 'Replica Objects')
, 'repl-factor'
, 'stop-writes'
, ('_migrates', 'Migrates (tx%,rx%)')
, ('_migrates', 'Pending Migrates (tx%,rx%)')
, ('_used-bytes-disk', 'Disk Used')
, ('_used-disk-pct', 'Disk Used%')
, ('high-water-disk-pct', 'HWM Disk%')
Expand Down Expand Up @@ -314,34 +315,34 @@ def infoNamespace(stats, cluster, **ignore):
pass

try:
total_res[ns]["migrate-tx-partitions-remaining"] += float(ns_stats["migrate-tx-partitions-remaining"])
total_res[ns]["migrate-tx-partitions-remaining"] += int(ns_stats["migrate-tx-partitions-remaining"])
except:
pass

try:
total_res[ns]["migrate-rx-partitions-remaining"] += float(ns_stats["migrate-rx-partitions-remaining"])
total_res[ns]["migrate-rx-partitions-remaining"] += int(ns_stats["migrate-rx-partitions-remaining"])
except:
pass

try:
total_res[ns]["migrate-tx-partitions-initial"] += float(ns_stats["migrate-tx-partitions-initial"])
total_res[ns]["migrate-tx-partitions-initial"] += int(ns_stats["migrate-tx-partitions-initial"])
except:
pass

try:
total_res[ns]["migrate-rx-partitions-initial"] += float(ns_stats["migrate-rx-partitions-initial"])
total_res[ns]["migrate-rx-partitions-initial"] += int(ns_stats["migrate-rx-partitions-initial"])
except:
pass

row['namespace'] = ns
row['real_node_id'] = node.node_id
row['node'] = prefixes[node_key]
try:
row["migrate-rx-partitions-remaining-pct"] = "%.2f"%((float(ns_stats["migrate-rx-partitions-remaining"])/float(ns_stats["migrate-rx-partitions-initial"]))*100)
row["migrate-rx-partitions-remaining-pct"] = "%d"%(math.floor((float(ns_stats["migrate-rx-partitions-remaining"])/float(ns_stats["migrate-rx-partitions-initial"]))*100))
except:
row["migrate-rx-partitions-remaining-pct"] = "0"
try:
row["migrate-tx-partitions-remaining-pct"] = "%.2f"%((float(ns_stats["migrate-tx-partitions-remaining"])/float(ns_stats["migrate-tx-partitions-initial"]))*100)
row["migrate-tx-partitions-remaining-pct"] = "%d"%(math.floor((float(ns_stats["migrate-tx-partitions-remaining"])/float(ns_stats["migrate-tx-partitions-initial"]))*100))
except:
row["migrate-tx-partitions-remaining-pct"] = "0"
t.insertRow(row)
Expand Down Expand Up @@ -369,11 +370,11 @@ def infoNamespace(stats, cluster, **ignore):
row["migrate-rx-partitions-remaining"] = str(total_res[ns]["migrate-rx-partitions-remaining"])

try:
row["migrate-rx-partitions-remaining-pct"] = "%.2f"%((total_res[ns]["migrate-rx-partitions-remaining"]/total_res[ns]["migrate-rx-partitions-initial"])*100)
row["migrate-rx-partitions-remaining-pct"] = "%d"%(math.floor((float(total_res[ns]["migrate-rx-partitions-remaining"])/float(total_res[ns]["migrate-rx-partitions-initial"]))*100))
except:
row["migrate-rx-partitions-remaining-pct"] = "0"
try:
row["migrate-tx-partitions-remaining-pct"] = "%.2f"%((total_res[ns]["migrate-tx-partitions-remaining"]/total_res[ns]["migrate-tx-partitions-initial"])*100)
row["migrate-tx-partitions-remaining-pct"] = "%d"%(math.floor((float(total_res[ns]["migrate-tx-partitions-remaining"])/float(total_res[ns]["migrate-tx-partitions-initial"]))*100))
except:
row["migrate-tx-partitions-remaining-pct"] = "0"

Expand Down

0 comments on commit 067d6c8

Please sign in to comment.