Changeset: bd0abb9d0ed4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bd0abb9d0ed4
Modified Files:
clients/iotapi/src/Settings/iotlogger.py
clients/iotapi/src/Settings/mapiconnection.py
clients/iotapi/src/Streams/streampolling.py
clients/iotclient/src/Settings/iotlogger.py
clients/iotclient/src/Settings/mapiconnection.py
clients/iotclient/src/Streams/datatypes.py
clients/iotclient/src/main.py
Branch: iot
Log Message:
Small corrections
diffs (161 lines):
diff --git a/clients/iotapi/src/Settings/iotlogger.py
b/clients/iotapi/src/Settings/iotlogger.py
--- a/clients/iotapi/src/Settings/iotlogger.py
+++ b/clients/iotapi/src/Settings/iotlogger.py
@@ -3,6 +3,7 @@ import os
import sys
Logger = logging.getLogger("IOTAPILog")
+Logger.setLevel(logging.INFO)
if sys.platform in ("linux", "linux2", "darwin"):
DEFAULT_LOGGING = '/var/log/iot/iotapi.log'
diff --git a/clients/iotapi/src/Settings/mapiconnection.py
b/clients/iotapi/src/Settings/mapiconnection.py
--- a/clients/iotapi/src/Settings/mapiconnection.py
+++ b/clients/iotapi/src/Settings/mapiconnection.py
@@ -14,10 +14,10 @@ def init_monetdb_connection(hostname, po
database=database, autocommit=True)
Connection.execute("SET SCHEMA iot;")
log_message = 'User %s connected successfully to database %s' %
(user_name, database)
- print >> sys.stdout, log_message
+ print log_message
add_log(20, log_message)
except BaseException as ex:
- print >> sys.stdout, ex
+ print ex
add_log(50, ex)
sys.exit(1)
diff --git a/clients/iotapi/src/Streams/streampolling.py
b/clients/iotapi/src/Streams/streampolling.py
--- a/clients/iotapi/src/Streams/streampolling.py
+++ b/clients/iotapi/src/Streams/streampolling.py
@@ -33,20 +33,21 @@ def stream_polling():
new_streams = {}
array = fetch_streams() # TODO check whenever stream's columns are updated
- for key, group in groupby(array, lambda x:
Streams_Context.get_context_entry_name(x[0], x[1])):
- if key not in current_streams:
- columns = {}
+ if array is not None:
+ for key, group in groupby(array, lambda x:
Streams_Context.get_context_entry_name(x[0], x[1])):
+ if key not in current_streams:
+ columns = {}
- for elem in group:
- for entry in SWITCHER: # allocate the proper type wrapper
- if elem[3] in entry['types']:
- reflection_class = globals()[entry['class']] # import
everything from datatypes!!!
- new_column = reflection_class(*elem[2:])
- columns[elem[2]] = new_column # add new column to the
dictionary
- break
- new_streams[key] = IOTStream(schema_name=elem[0],
stream_name=elem[1], columns=columns)
- else:
- retained_streams.append(key)
+ for elem in group:
+ for entry in SWITCHER: # allocate the proper type wrapper
+ if elem[3] in entry['types']:
+ reflection_class = globals()[entry['class']] #
import everything from datatypes!!!
+ new_column = reflection_class(*elem[2:])
+ columns[elem[2]] = new_column # add new column to
the dictionary
+ break
+ new_streams[key] = IOTStream(schema_name=elem[0],
stream_name=elem[1], columns=columns)
+ else:
+ retained_streams.append(key)
retained_streams_final = [key for key in current_streams if key in
retained_streams]
Streams_Context.merge_context(retained_streams_final, new_streams)
diff --git a/clients/iotclient/src/Settings/iotlogger.py
b/clients/iotclient/src/Settings/iotlogger.py
--- a/clients/iotclient/src/Settings/iotlogger.py
+++ b/clients/iotclient/src/Settings/iotlogger.py
@@ -3,6 +3,7 @@ import sys
import os
Logger = logging.getLogger("IOTServerLog")
+Logger.setLevel(logging.INFO)
if sys.platform in ("linux", "linux2", "darwin"):
DEFAULT_LOGGING = '/var/log/iot/iotserver.log'
diff --git a/clients/iotclient/src/Settings/mapiconnection.py
b/clients/iotclient/src/Settings/mapiconnection.py
--- a/clients/iotclient/src/Settings/mapiconnection.py
+++ b/clients/iotclient/src/Settings/mapiconnection.py
@@ -60,12 +60,8 @@ def mapi_create_stream(schema, stream, c
Connection.execute("CREATE SCHEMA " + schema + ";")
except:
pass
-
- try: # attempt to create the stream table
- Connection.execute("SET SCHEMA " + schema + ";")
- Connection.execute(''.join(["CREATE STREAM TABLE ", stream, " (",
columns, ");"]))
- except BaseException as ex:
- add_log(40, ex)
+ Connection.execute("SET SCHEMA " + schema + ";")
+ Connection.execute(''.join(["CREATE STREAM TABLE ", stream, " (", columns,
");"]))
def mapi_flush_baskets(schema, stream, baskets):
@@ -73,7 +69,6 @@ def mapi_flush_baskets(schema, stream, b
Connection.execute("SET SCHEMA iot;")
except:
pass
-
try:
Connection.execute(''.join(["CALL iot.basket('", schema, "','",
stream, "','", baskets, "');"]))
except BaseException as ex:
diff --git a/clients/iotclient/src/Streams/datatypes.py
b/clients/iotclient/src/Streams/datatypes.py
--- a/clients/iotclient/src/Streams/datatypes.py
+++ b/clients/iotclient/src/Streams/datatypes.py
@@ -667,7 +667,7 @@ class TimeType(BaseDateTimeType): # Sto
if 'timezone' in kwargs:
self._has_timezone = kwargs['timezone']
else:
- self._has_timezone = True
+ self._has_timezone = False
def add_json_schema_entry(self, schema):
super(TimeType, self).add_json_schema_entry(schema)
@@ -695,7 +695,7 @@ class TimeType(BaseDateTimeType): # Sto
def process_sql_parameters(self, array):
if self._has_timezone:
- array[2] = 'time with timezone'
+ array[2] = 'time with time zone'
def to_json_representation(self):
json_value = super(TimeType, self).to_json_representation()
@@ -711,7 +711,7 @@ class TimestampType(BaseDateTimeType):
if 'timezone' in kwargs:
self._has_timezone = kwargs['timezone']
else:
- self._has_timezone = True
+ self._has_timezone = False
def add_json_schema_entry(self, schema):
super(TimestampType, self).add_json_schema_entry(schema)
@@ -743,7 +743,7 @@ class TimestampType(BaseDateTimeType):
def process_sql_parameters(self, array):
if self._has_timezone:
- array[2] = 'timestamp with timezone'
+ array[2] = 'timestamp with time zone'
def to_json_representation(self):
json_value = super(TimestampType, self).to_json_representation()
diff --git a/clients/iotclient/src/main.py b/clients/iotclient/src/main.py
--- a/clients/iotclient/src/main.py
+++ b/clients/iotclient/src/main.py
@@ -82,12 +82,12 @@ def main():
help='Host identifier name. If not provided, the
machine MAC address will be used')
parser.add_argument('-ih', '--ihost', type=check_ipv4_address, nargs='?',
default='0.0.0.0',
help='Administration server host (default: 0.0.0.0)',
metavar='HOST')
- parser.add_argument('-ip', '--iport', type=check_positive_int, nargs='?',
default=8000,
- help='Administration server port (default: 8000)',
metavar='PORT')
+ parser.add_argument('-ip', '--iport', type=check_positive_int, nargs='?',
default=8001,
+ help='Administration server port (default: 8001)',
metavar='PORT')
parser.add_argument('-ah', '--ahost', type=check_ipv4_address, nargs='?',
default='127.0.0.1',
help='Application server host (default: 127.0.0.1)',
metavar='HOST')
- parser.add_argument('-ap', '--aport', type=check_positive_int, nargs='?',
default=8001,
- help='Application server port (default: 8001)',
metavar='PORT')
+ parser.add_argument('-ap', '--aport', type=check_positive_int, nargs='?',
default=8000,
+ help='Application server port (default: 8000)',
metavar='PORT')
parser.add_argument('-h', '--host', nargs='?', default='127.0.0.1',
help='MonetDB database host (default: 127.0.0.1)',
metavar='HOST')
parser.add_argument('-p', '--port', type=check_positive_int, nargs='?',
default=50000,
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list