[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [pytorctl/mysql-bwscanner] Ugh.. This is getting tiresome.



Author: Mike Perry <mikeperry-git@xxxxxxxxxx>
Date: Tue, 6 Jul 2010 12:38:48 -0700
Subject: Ugh.. This is getting tiresome.
Commit: af3ae9ed8a3cb7e152a2870bd9e846e0c9d23838

---
 SQLSupport.py |   34 +++++++++++++++++-----------------
 TorUtil.py    |    6 +++---
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/SQLSupport.py b/SQLSupport.py
index 2c3dad1..cdebd4c 100644
--- a/SQLSupport.py
+++ b/SQLSupport.py
@@ -295,25 +295,25 @@ class RouterStats(Entity):
     # http://www.sqlalchemy.org/docs/04/sqlexpression.html#sql_update
     to_s = tc_session.execute(select([func.count(Extension.id)],
         and_(stats_clause, Extension.table.c.to_node_idhex
-             == RouterStats.table.c.router_idhex)))
+             == RouterStats.table.c.router_idhex))).scalar()
     from_s = tc_session.execute(select([func.count(Extension.id)],
         and_(stats_clause, Extension.table.c.from_node_idhex
-             == RouterStats.table.c.router_idhex)))
+             == RouterStats.table.c.router_idhex))).scalar()
     f_to_s = tc_session.execute(select([func.count(FailedExtension.id)], 
         and_(stats_clause, FailedExtension.table.c.to_node_idhex
              == RouterStats.table.c.router_idhex,
           FailedExtension.table.c.row_type
-                  =='failedextension')))
+                  =='failedextension'))).scalar()
     f_from_s = tc_session.execute(select([func.count(FailedExtension.id)], 
         and_(stats_clause, FailedExtension.table.c.from_node_idhex
                        == RouterStats.table.c.router_idhex,
              FailedExtension.table.c.row_type
-                     =='failedextension')))
+                     =='failedextension'))).scalar()
     avg_ext = tc_session.execute(select([func.avg(Extension.delta)], 
         and_(stats_clause,
              Extension.table.c.to_node_idhex==RouterStats.table.c.router_idhex,
              Extension.table.c.hop==0, 
-             Extension.table.c.row_type=='extension')))
+             Extension.table.c.row_type=='extension'))).scalar()
 
     RouterStats.table.update(stats_clause, values=
       {RouterStats.table.c.circ_try_to:to_s,
@@ -375,19 +375,19 @@ class RouterStats(Entity):
     tc_session.clear()
     min_r = tc_session.execute(select([func.min(BwHistory.rank)],
         BwHistory.table.c.router_idhex
-            == RouterStats.table.c.router_idhex))
+            == RouterStats.table.c.router_idhex)).scalar()
     avg_r = tc_session.execute(select([func.avg(BwHistory.rank)],
         BwHistory.table.c.router_idhex
-            == RouterStats.table.c.router_idhex))
+            == RouterStats.table.c.router_idhex)).scalar()
     max_r = tc_session.execute(select([func.max(BwHistory.rank)],
         BwHistory.table.c.router_idhex
-            == RouterStats.table.c.router_idhex))
+            == RouterStats.table.c.router_idhex)).scalar()
     avg_bw = tc_session.execute(select([func.avg(BwHistory.bw)],
         BwHistory.table.c.router_idhex
-            == RouterStats.table.c.router_idhex))
+            == RouterStats.table.c.router_idhex)).scalar()
     avg_desc_bw = tc_session.execute(select([func.avg(BwHistory.desc_bw)],
         BwHistory.table.c.router_idhex
-            == RouterStats.table.c.router_idhex))
+            == RouterStats.table.c.router_idhex)).scalar()
 
     RouterStats.table.update(values=
        {RouterStats.table.c.min_rank:min_r,
@@ -397,9 +397,9 @@ class RouterStats(Entity):
         RouterStats.table.c.avg_desc_bw:avg_desc_bw}).execute()
 
     #min_avg_rank = \
-    #  tc_session.execute(select([func.min(RouterStats.avg_rank)]))
+    #  tc_session.execute(select([func.min(RouterStats.avg_rank)])).scalar()
     max_avg_rank = \
-       tc_session.execute(select([func.max(RouterStats.avg_rank)]))
+       tc_session.execute(select([func.max(RouterStats.avg_rank)])).scalar()
 
     RouterStats.table.update(values=
        {RouterStats.table.c.percentile:
@@ -411,18 +411,18 @@ class RouterStats(Entity):
     tc_session.clear()
     avg_from_rate = tc_session.execute(
                      select([func.avg(RouterStats.circ_from_rate)],
-                           stats_clause))
+                           stats_clause)).scalar()
     avg_to_rate = tc_session.execute(
                      select([func.avg(RouterStats.circ_to_rate)],
-                           stats_clause))
+                           stats_clause)).scalar()
     avg_bi_rate = tc_session.execute(
                      select([func.avg(RouterStats.circ_bi_rate)],
-                           stats_clause))
+                           stats_clause)).scalar()
     avg_ext = tc_session.execute(
                      select([func.avg(RouterStats.avg_first_ext)],
-                           stats_clause))
+                           stats_clause)).scalar()
     avg_sbw = tc_session.execute(select([func.avg(RouterStats.sbw)],
-                           stats_clause))
+                           stats_clause)).scalar()
 
     RouterStats.table.update(stats_clause, values=
        {RouterStats.table.c.circ_from_ratio:
diff --git a/TorUtil.py b/TorUtil.py
index 859a224..7319955 100644
--- a/TorUtil.py
+++ b/TorUtil.py
@@ -26,12 +26,12 @@ __all__ = ["Enum", "Enum2", "Callable", "sort_list", "quote", "escape_dots", "un
      "ListenSocket", "zprob", "logfile", "loglevel"]
 
 # TODO: This isn't the right place for these.. But at least it's unified.
-tor_port = 9060
+tor_port = 9050
 tor_host = '127.0.0.1'
 
-control_port = 9061
+control_port = 9051
 control_host = '127.0.0.1'
-control_pass = ""
+control_pass = "leggomytorgo"
 
 meta_port = 9052
 meta_host = '127.0.0.1'
-- 
1.7.1