Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

Commit

Permalink
Merge pull request #15 from waggle-sensor/revert-14-branch-py2-to-py3
Browse files Browse the repository at this point in the history
Revert "Branch merging"
  • Loading branch information
MuffinSpawn authored Aug 12, 2016
2 parents eddf596 + 6736441 commit 977217c
Show file tree
Hide file tree
Showing 63 changed files with 22 additions and 23,233 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
FROM ubuntu:14.04

RUN apt-get update ; apt-get install -y git \
python-dev python-pip \
python3-dev python3-pip
python-dev python-pip

ADD . /usr/lib/waggle/beehive-server/

Expand Down
6 changes: 3 additions & 3 deletions Server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
"""
This module sets up and runs the waggle server.
"""
Expand Down Expand Up @@ -173,12 +173,12 @@ def flush(self):

#Declare all of the appropriate exchanges, queues, and bindings

for queueName in list(queue_bindings.keys()):
for queueName in queue_bindings.keys():
rabbitChannel.queue_declare(queueName)

for exchName in exchage_list:
rabbitChannel.exchange_declare(exchName)
for key in list(queue_bindings.keys()):
for key in queue_bindings.keys():
bind = queue_bindings[key]
rabbitChannel.queue_bind(exchange=bind[0], queue=key, routing_key=bind[1])

Expand Down
4 changes: 1 addition & 3 deletions WaggleRouter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python3

# WaggleRouter.py
import sys
sys.path.append("..")
Expand Down Expand Up @@ -108,7 +106,7 @@ def gotPacket(self,ch,method,props,body):
recipient = recipient_node['queue']
self.channel.basic_publish(exchange='internal', routing_key = recipient, body=body)
except Exception as e:
print(str(e))
print str(e)
finally:
ch.basic_ack(delivery_tag =method.delivery_tag)

Expand Down
12 changes: 6 additions & 6 deletions config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#!/usr/bin/env python

import sys, os, io, configparser, logging, pika, ssl, re
import sys, os, StringIO, ConfigParser, logging, pika, ssl, re
import time, datetime


Expand Down Expand Up @@ -41,7 +41,7 @@ def read_value(key, defaultval):
value=None
try:
value=my_config.get("root", key)
except configparser.NoOptionError:
except ConfigParser.NoOptionError:
value=""

if not value:
Expand All @@ -56,8 +56,8 @@ def read_value(key, defaultval):
if os.path.isfile(CONFIG_FILE):
ini_str = ini_str + open(CONFIG_FILE, 'r').read()

ini_fp = io.StringIO(ini_str)
my_config = configparser.RawConfigParser()
ini_fp = StringIO.StringIO(ini_str)
my_config = ConfigParser.RawConfigParser()
my_config.readfp(ini_fp)

RABBITMQ_HOST=read_value("rabbitmq-host", "rabbitmq")
Expand Down Expand Up @@ -171,7 +171,7 @@ def unix_time(dt):
return delta.total_seconds()

def unix_time_millis(dt):
return int(unix_time(dt) * 1000.0)
return long(unix_time(dt) * 1000.0)



Expand Down
23 changes: 3 additions & 20 deletions dataprocess.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python3

# dataprocess.py

import sys
Expand Down Expand Up @@ -73,7 +71,7 @@ def __init__(self):
def callback(self,ch,method,props,body):
#TODO: this simply drops failed messages, might find a better solution!? Keeping them has the risk of spamming RabbitMQ
try:
header, opt, data = unpack(body)
header,data = unpack(body)
except Exception as e:
logger.error("Error unpacking data: %s" % (str(e)))
ch.basic_ack(delivery_tag=method.delivery_tag)
Expand Down Expand Up @@ -139,23 +137,8 @@ def cassandra_insert(self,header,data):
logger.error("Error preparing statement: (%s) %s" % (type(e).__name__, str(e)) )
raise

# TODO: Later we will fix this issue
idx = [0, 1, 3, 5, 6]
for i in idx:
if (type(data[i]) == bytes):
data[i] = data[i].decode('iso-8859-1')

tmp = []
for entity in data[7]:
if (type(entity) == bytes):
tmp.append(entity.decode('iso-8859-1'))
else:
tmp.append(entity)
data[7] = tmp

# for entity in data[7]:
# if (type(entity) == bytes):
# entity = data[i].decode('iso-8859-1')



if not data[3]:
data[3] = 'default'
Expand Down
9 changes: 0 additions & 9 deletions install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@ pip install crcmod
cd pika-0.9.14/
python setup.py install

cd ../../
cd packages_o/
pip3 install blist
pip3 install cassandra-driver
pip3 install crcmod

cd pika-0.10.0/
python3 setup.py install

cd ../../

# cqlshlib for the cassandra client
Expand Down
25 changes: 0 additions & 25 deletions packages_o/pika-0.10.0/LICENSE

This file was deleted.

2 changes: 0 additions & 2 deletions packages_o/pika-0.10.0/MANIFEST.in

This file was deleted.

122 changes: 0 additions & 122 deletions packages_o/pika-0.10.0/PKG-INFO

This file was deleted.

94 changes: 0 additions & 94 deletions packages_o/pika-0.10.0/README.rst

This file was deleted.

Loading

0 comments on commit 977217c

Please sign in to comment.