未验证 提交 becb301c 编写于 作者: J Julian 提交者: GitHub

[CLIENT-PY] Fixed print statements with logging output. Added Exceptions...

[CLIENT-PY] Fixed print statements with logging output. Added Exceptions instead of empty returns (#2968)

* [CLIENT-PY] Fixed print statements with logging output. Added Exceptions instead of empty returns.
[CLIENT-PY] Applied flake8 and black for reformatting.
[CLIENT-PY] Added release script to do a pypi release.
[CLIENT-PY] Improved Release Documentation.
上级 a344eb75
...@@ -190,4 +190,20 @@ Both can be run by `black .` or `flake8 .` respectively. ...@@ -190,4 +190,20 @@ Both can be run by `black .` or `flake8 .` respectively.
To do a release just ensure that you have the right set of generated thrift files. To do a release just ensure that you have the right set of generated thrift files.
Then run linting and auto-formatting. Then run linting and auto-formatting.
Then, ensure that all tests work (via `pytest .`). Then, ensure that all tests work (via `pytest .`).
Then you are good to go to do a release! Then you are good to go to do a release!
\ No newline at end of file
### Preparing your environment
First, install all necessary dev dependencies via `pip install -r requirements_dev.txt`.
### Doing the Release
There is a convenient script `release.sh` to do all steps for a release.
Namely, these are
* Remove all transient directories from last release (if exists)
* (Re-)generate all generated sources via mvn
* Run Linting (flake8)
* Run Tests via pytest
* Build
* Release to pypi
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# #
import logging
import struct import struct
import time import time
...@@ -53,6 +53,8 @@ from .thrift.rpc.ttypes import TSDeleteDataReq, TSProtocolVersion, TSSetTimeZone ...@@ -53,6 +53,8 @@ from .thrift.rpc.ttypes import TSDeleteDataReq, TSProtocolVersion, TSSetTimeZone
# from iotdb.rpc.ttypes import TSDeleteDataReq, TSProtocolVersion, TSSetTimeZoneReq # from iotdb.rpc.ttypes import TSDeleteDataReq, TSProtocolVersion, TSSetTimeZoneReq
from .utils.IoTDBConstants import TSDataType from .utils.IoTDBConstants import TSDataType
logger = logging.getLogger("IoTDB")
class Session(object): class Session(object):
SUCCESS_CODE = 200 SUCCESS_CODE = 200
...@@ -94,7 +96,7 @@ class Session(object): ...@@ -94,7 +96,7 @@ class Session(object):
try: try:
self.__transport.open() self.__transport.open()
except TTransport.TTransportException as e: except TTransport.TTransportException as e:
print("TTransportException: ", e) logger.exception("TTransportException!", exc_info=e)
if enable_rpc_compression: if enable_rpc_compression:
self.__client = Client(TCompactProtocol.TCompactProtocol(self.__transport)) self.__client = Client(TCompactProtocol.TCompactProtocol(self.__transport))
...@@ -112,7 +114,7 @@ class Session(object): ...@@ -112,7 +114,7 @@ class Session(object):
open_resp = self.__client.openSession(open_req) open_resp = self.__client.openSession(open_req)
if self.protocol_version != open_resp.serverProtocolVersion: if self.protocol_version != open_resp.serverProtocolVersion:
print( logger.exception(
"Protocol differ, Client version is {}, but Server version is {}".format( "Protocol differ, Client version is {}, but Server version is {}".format(
self.protocol_version, open_resp.serverProtocolVersion self.protocol_version, open_resp.serverProtocolVersion
) )
...@@ -126,7 +128,7 @@ class Session(object): ...@@ -126,7 +128,7 @@ class Session(object):
except Exception as e: except Exception as e:
self.__transport.close() self.__transport.close()
print("session closed because: ", e) logger.exception("session closed because: ", exc_info=e)
if self.__zone_id is not None: if self.__zone_id is not None:
self.set_time_zone(self.__zone_id) self.set_time_zone(self.__zone_id)
...@@ -145,9 +147,9 @@ class Session(object): ...@@ -145,9 +147,9 @@ class Session(object):
try: try:
self.__client.closeSession(req) self.__client.closeSession(req)
except TTransport.TException as e: except TTransport.TException as e:
print( logger.exception(
"Error occurs when closing session at server. Maybe server is down. Error message: ", "Error occurs when closing session at server. Maybe server is down. Error message: ",
e, exc_info=e,
) )
finally: finally:
self.__is_close = True self.__is_close = True
...@@ -160,7 +162,9 @@ class Session(object): ...@@ -160,7 +162,9 @@ class Session(object):
:param group_name: String, storage group name (starts from root) :param group_name: String, storage group name (starts from root)
""" """
status = self.__client.setStorageGroup(self.__session_id, group_name) status = self.__client.setStorageGroup(self.__session_id, group_name)
print("setting storage group {} message: {}".format(group_name, status.message)) logger.debug(
"setting storage group {} message: {}".format(group_name, status.message)
)
return Session.verify_success(status) return Session.verify_success(status)
...@@ -178,7 +182,7 @@ class Session(object): ...@@ -178,7 +182,7 @@ class Session(object):
:param storage_group_lst: List, paths of the target storage groups. :param storage_group_lst: List, paths of the target storage groups.
""" """
status = self.__client.deleteStorageGroups(self.__session_id, storage_group_lst) status = self.__client.deleteStorageGroups(self.__session_id, storage_group_lst)
print( logger.debug(
"delete storage group(s) {} message: {}".format( "delete storage group(s) {} message: {}".format(
storage_group_lst, status.message storage_group_lst, status.message
) )
...@@ -201,7 +205,9 @@ class Session(object): ...@@ -201,7 +205,9 @@ class Session(object):
self.__session_id, ts_path, data_type, encoding, compressor self.__session_id, ts_path, data_type, encoding, compressor
) )
status = self.__client.createTimeseries(request) status = self.__client.createTimeseries(request)
print("creating time series {} message: {}".format(ts_path, status.message)) logger.debug(
"creating time series {} message: {}".format(ts_path, status.message)
)
return Session.verify_success(status) return Session.verify_success(status)
...@@ -223,7 +229,7 @@ class Session(object): ...@@ -223,7 +229,7 @@ class Session(object):
self.__session_id, ts_path_lst, data_type_lst, encoding_lst, compressor_lst self.__session_id, ts_path_lst, data_type_lst, encoding_lst, compressor_lst
) )
status = self.__client.createMultiTimeseries(request) status = self.__client.createMultiTimeseries(request)
print( logger.debug(
"creating multiple time series {} message: {}".format( "creating multiple time series {} message: {}".format(
ts_path_lst, status.message ts_path_lst, status.message
) )
...@@ -237,7 +243,7 @@ class Session(object): ...@@ -237,7 +243,7 @@ class Session(object):
:param paths_list: List of time series path, which should be complete (starts from root) :param paths_list: List of time series path, which should be complete (starts from root)
""" """
status = self.__client.deleteTimeseries(self.__session_id, paths_list) status = self.__client.deleteTimeseries(self.__session_id, paths_list)
print( logger.debug(
"deleting multiple time series {} message: {}".format( "deleting multiple time series {} message: {}".format(
paths_list, status.message paths_list, status.message
) )
...@@ -265,9 +271,11 @@ class Session(object): ...@@ -265,9 +271,11 @@ class Session(object):
request = TSDeleteDataReq(self.__session_id, paths_list, timestamp) request = TSDeleteDataReq(self.__session_id, paths_list, timestamp)
try: try:
status = self.__client.deleteData(request) status = self.__client.deleteData(request)
print("delete data from {}, message: {}".format(paths_list, status.message)) logger.debug(
"delete data from {}, message: {}".format(paths_list, status.message)
)
except TTransport.TException as e: except TTransport.TException as e:
print("data deletion fails because: ", e) logger.exception("data deletion fails because: ", e)
def insert_str_record(self, device_id, timestamp, measurements, string_values): def insert_str_record(self, device_id, timestamp, measurements, string_values):
""" special case for inserting one row of String (TEXT) value """ """ special case for inserting one row of String (TEXT) value """
...@@ -280,7 +288,7 @@ class Session(object): ...@@ -280,7 +288,7 @@ class Session(object):
device_id, timestamp, measurements, data_types, string_values device_id, timestamp, measurements, data_types, string_values
) )
status = self.__client.insertStringRecord(request) status = self.__client.insertStringRecord(request)
print( logger.debug(
"insert one record to device {} message: {}".format( "insert one record to device {} message: {}".format(
device_id, status.message device_id, status.message
) )
...@@ -305,7 +313,7 @@ class Session(object): ...@@ -305,7 +313,7 @@ class Session(object):
device_id, timestamp, measurements, data_types, values device_id, timestamp, measurements, data_types, values
) )
status = self.__client.insertRecord(request) status = self.__client.insertRecord(request)
print( logger.debug(
"insert one record to device {} message: {}".format( "insert one record to device {} message: {}".format(
device_id, status.message device_id, status.message
) )
...@@ -333,7 +341,7 @@ class Session(object): ...@@ -333,7 +341,7 @@ class Session(object):
device_ids, times, measurements_lst, type_values_lst, values_lst device_ids, times, measurements_lst, type_values_lst, values_lst
) )
status = self.__client.insertRecords(request) status = self.__client.insertRecords(request)
print( logger.debug(
"insert multiple records to devices {} message: {}".format( "insert multiple records to devices {} message: {}".format(
device_ids, status.message device_ids, status.message
) )
...@@ -358,7 +366,7 @@ class Session(object): ...@@ -358,7 +366,7 @@ class Session(object):
device_id, timestamp, measurements, data_types, values device_id, timestamp, measurements, data_types, values
) )
status = self.__client.testInsertRecord(request) status = self.__client.testInsertRecord(request)
print( logger.debug(
"testing! insert one record to device {} message: {}".format( "testing! insert one record to device {} message: {}".format(
device_id, status.message device_id, status.message
) )
...@@ -386,7 +394,9 @@ class Session(object): ...@@ -386,7 +394,9 @@ class Session(object):
device_ids, times, measurements_lst, type_values_lst, values_lst device_ids, times, measurements_lst, type_values_lst, values_lst
) )
status = self.__client.testInsertRecords(request) status = self.__client.testInsertRecords(request)
print("testing! insert multiple records, message: {}".format(status.message)) logger.debug(
"testing! insert multiple records, message: {}".format(status.message)
)
return Session.verify_success(status) return Session.verify_success(status)
...@@ -394,9 +404,9 @@ class Session(object): ...@@ -394,9 +404,9 @@ class Session(object):
self, device_id, timestamp, measurements, data_types, values self, device_id, timestamp, measurements, data_types, values
): ):
if (len(values) != len(data_types)) or (len(values) != len(measurements)): if (len(values) != len(data_types)) or (len(values) != len(measurements)):
print("length of data types does not equal to length of values!") raise RuntimeError(
# could raise an error here. "length of data types does not equal to length of values!"
return )
values_in_bytes = Session.value_to_bytes(data_types, values) values_in_bytes = Session.value_to_bytes(data_types, values)
return TSInsertRecordReq( return TSInsertRecordReq(
self.__session_id, device_id, measurements, values_in_bytes, timestamp self.__session_id, device_id, measurements, values_in_bytes, timestamp
...@@ -406,9 +416,9 @@ class Session(object): ...@@ -406,9 +416,9 @@ class Session(object):
self, device_id, timestamp, measurements, data_types, values self, device_id, timestamp, measurements, data_types, values
): ):
if (len(values) != len(data_types)) or (len(values) != len(measurements)): if (len(values) != len(data_types)) or (len(values) != len(measurements)):
print("length of data types does not equal to length of values!") raise RuntimeError(
# could raise an error here. "length of data types does not equal to length of values!"
return )
return TSInsertStringRecordReq( return TSInsertStringRecordReq(
self.__session_id, device_id, measurements, values, timestamp self.__session_id, device_id, measurements, values, timestamp
) )
...@@ -422,22 +432,18 @@ class Session(object): ...@@ -422,22 +432,18 @@ class Session(object):
or (len(device_ids) != len(times)) or (len(device_ids) != len(times))
or (len(times) != len(values_lst)) or (len(times) != len(values_lst))
): ):
print( raise RuntimeError(
"deviceIds, times, measurementsList and valuesList's size should be equal" "deviceIds, times, measurementsList and valuesList's size should be equal"
) )
# could raise an error here.
return
value_lst = [] value_lst = []
for values, data_types, measurements in zip( for values, data_types, measurements in zip(
values_lst, types_lst, measurements_lst values_lst, types_lst, measurements_lst
): ):
if (len(values) != len(data_types)) or (len(values) != len(measurements)): if (len(values) != len(data_types)) or (len(values) != len(measurements)):
print( raise RuntimeError(
"deviceIds, times, measurementsList and valuesList's size should be equal" "deviceIds, times, measurementsList and valuesList's size should be equal"
) )
# could raise an error here.
return
values_in_bytes = Session.value_to_bytes(data_types, values) values_in_bytes = Session.value_to_bytes(data_types, values)
value_lst.append(values_in_bytes) value_lst.append(values_in_bytes)
...@@ -458,7 +464,7 @@ class Session(object): ...@@ -458,7 +464,7 @@ class Session(object):
:param tablet: a tablet specified above :param tablet: a tablet specified above
""" """
status = self.__client.insertTablet(self.gen_insert_tablet_req(tablet)) status = self.__client.insertTablet(self.gen_insert_tablet_req(tablet))
print( logger.debug(
"insert one tablet to device {} message: {}".format( "insert one tablet to device {} message: {}".format(
tablet.get_device_id(), status.message tablet.get_device_id(), status.message
) )
...@@ -472,7 +478,7 @@ class Session(object): ...@@ -472,7 +478,7 @@ class Session(object):
:param tablet_lst: List of tablets :param tablet_lst: List of tablets
""" """
status = self.__client.insertTablets(self.gen_insert_tablets_req(tablet_lst)) status = self.__client.insertTablets(self.gen_insert_tablets_req(tablet_lst))
print("insert multiple tablets, message: {}".format(status.message)) logger.debug("insert multiple tablets, message: {}".format(status.message))
return Session.verify_success(status) return Session.verify_success(status)
...@@ -514,15 +520,15 @@ class Session(object): ...@@ -514,15 +520,15 @@ class Session(object):
or size != len(types_list) or size != len(types_list)
or size != len(values_list) or size != len(values_list)
): ):
print( raise RuntimeError(
"insert records of one device error: types, times, measurementsList and valuesList's size should be equal" "insert records of one device error: types, times, measurementsList and valuesList's size should be equal"
) )
return
# check sorted # check sorted
if not Session.check_sorted(times_list): if not Session.check_sorted(times_list):
print("insert records of one device error: timestamp not sorted") raise RuntimeError(
return "insert records of one device error: timestamp not sorted"
)
request = self.gen_insert_records_of_one_device_request( request = self.gen_insert_records_of_one_device_request(
device_id, times_list, measurements_list, values_list, types_list device_id, times_list, measurements_list, values_list, types_list
...@@ -530,7 +536,7 @@ class Session(object): ...@@ -530,7 +536,7 @@ class Session(object):
# send request # send request
status = self.__client.insertRecordsOfOneDevice(request) status = self.__client.insertRecordsOfOneDevice(request)
print("insert records of one device, message: {}".format(status.message)) logger.debug("insert records of one device, message: {}".format(status.message))
return Session.verify_success(status) return Session.verify_success(status)
...@@ -543,11 +549,9 @@ class Session(object): ...@@ -543,11 +549,9 @@ class Session(object):
): ):
data_types = [data_type.value for data_type in data_types] data_types = [data_type.value for data_type in data_types]
if (len(values) != len(data_types)) or (len(values) != len(measurements)): if (len(values) != len(data_types)) or (len(values) != len(measurements)):
print( raise RuntimeError(
"insert records of one device error: deviceIds, times, measurementsList and valuesList's size should be equal" "insert records of one device error: deviceIds, times, measurementsList and valuesList's size should be equal"
) )
# could raise an error here.
return
values_in_bytes = Session.value_to_bytes(data_types, values) values_in_bytes = Session.value_to_bytes(data_types, values)
binary_value_list.append(values_in_bytes) binary_value_list.append(values_in_bytes)
...@@ -566,7 +570,7 @@ class Session(object): ...@@ -566,7 +570,7 @@ class Session(object):
:param tablet: a tablet of data :param tablet: a tablet of data
""" """
status = self.__client.testInsertTablet(self.gen_insert_tablet_req(tablet)) status = self.__client.testInsertTablet(self.gen_insert_tablet_req(tablet))
print( logger.debug(
"testing! insert one tablet to device {} message: {}".format( "testing! insert one tablet to device {} message: {}".format(
tablet.get_device_id(), status.message tablet.get_device_id(), status.message
) )
...@@ -583,7 +587,9 @@ class Session(object): ...@@ -583,7 +587,9 @@ class Session(object):
status = self.__client.testInsertTablets( status = self.__client.testInsertTablets(
self.gen_insert_tablets_req(tablet_list) self.gen_insert_tablets_req(tablet_list)
) )
print("testing! insert multiple tablets, message: {}".format(status.message)) logger.debug(
"testing! insert multiple tablets, message: {}".format(status.message)
)
return Session.verify_success(status) return Session.verify_success(status)
...@@ -657,13 +663,12 @@ class Session(object): ...@@ -657,13 +663,12 @@ class Session(object):
try: try:
resp = self.__client.executeUpdateStatement(request) resp = self.__client.executeUpdateStatement(request)
status = resp.status status = resp.status
print( logger.debug(
"execute non-query statement {} message: {}".format(sql, status.message) "execute non-query statement {} message: {}".format(sql, status.message)
) )
return Session.verify_success(status) return Session.verify_success(status)
except TTransport.TException as e: except TTransport.TException as e:
print("execution of non-query statement fails because: ", e) raise RuntimeError("execution of non-query statement fails because: ", e)
return -1
@staticmethod @staticmethod
def value_to_bytes(data_types, values): def value_to_bytes(data_types, values):
...@@ -705,9 +710,7 @@ class Session(object): ...@@ -705,9 +710,7 @@ class Session(object):
values_tobe_packed.append(len(value_bytes)) values_tobe_packed.append(len(value_bytes))
values_tobe_packed.append(value_bytes) values_tobe_packed.append(value_bytes)
else: else:
print("Unsupported data type:" + str(data_type)) raise RuntimeError("Unsupported data type:" + str(data_type))
# could raise an error here.
return
format_str = "".join(format_str_list) format_str = "".join(format_str_list)
return struct.pack(format_str, *values_tobe_packed) return struct.pack(format_str, *values_tobe_packed)
...@@ -717,22 +720,20 @@ class Session(object): ...@@ -717,22 +720,20 @@ class Session(object):
try: try:
resp = self.__client.getTimeZone(self.__session_id) resp = self.__client.getTimeZone(self.__session_id)
except TTransport.TException as e: except TTransport.TException as e:
print("Could not get time zone because: ", e) raise RuntimeError("Could not get time zone because: ", e)
raise Exception
return resp.timeZone return resp.timeZone
def set_time_zone(self, zone_id): def set_time_zone(self, zone_id):
request = TSSetTimeZoneReq(self.__session_id, zone_id) request = TSSetTimeZoneReq(self.__session_id, zone_id)
try: try:
status = self.__client.setTimeZone(request) status = self.__client.setTimeZone(request)
print( logger.debug(
"setting time zone_id as {}, message: {}".format( "setting time zone_id as {}, message: {}".format(
zone_id, status.message zone_id, status.message
) )
) )
except TTransport.TException as e: except TTransport.TException as e:
print("Could not set time zone because: ", e) raise RuntimeError("Could not set time zone because: ", e)
raise Exception
self.__zone_id = zone_id self.__zone_id = zone_id
@staticmethod @staticmethod
...@@ -751,5 +752,5 @@ class Session(object): ...@@ -751,5 +752,5 @@ class Session(object):
if status.code == Session.SUCCESS_CODE: if status.code == Session.SUCCESS_CODE:
return 0 return 0
print("error status is", status) logger.debug("error status is", status)
return -1 return -1
...@@ -17,10 +17,14 @@ ...@@ -17,10 +17,14 @@
# #
# for package # for package
import logging
from thrift.transport import TTransport from thrift.transport import TTransport
from iotdb.thrift.rpc.TSIService import TSFetchResultsReq, TSCloseOperationReq from iotdb.thrift.rpc.TSIService import TSFetchResultsReq, TSCloseOperationReq
from iotdb.utils.IoTDBConstants import TSDataType from iotdb.utils.IoTDBConstants import TSDataType
logger = logging.getLogger("IoTDB")
class IoTDBRpcDataSet(object): class IoTDBRpcDataSet(object):
TIMESTAMP_STR = "Time" TIMESTAMP_STR = "Time"
...@@ -107,14 +111,15 @@ class IoTDBRpcDataSet(object): ...@@ -107,14 +111,15 @@ class IoTDBRpcDataSet(object):
status = self.__client.closeOperation( status = self.__client.closeOperation(
TSCloseOperationReq(self.__session_id, self.__query_id) TSCloseOperationReq(self.__session_id, self.__query_id)
) )
print( logger.debug(
"close session {}, message: {}".format( "close session {}, message: {}".format(
self.__session_id, status.message self.__session_id, status.message
) )
) )
except TTransport.TException as e: except TTransport.TException as e:
print("close session {} failed because: ".format(self.__session_id), e) raise RuntimeError(
raise Exception "close session {} failed because: ".format(self.__session_id), e
)
self.__is_closed = True self.__is_closed = True
self.__client = None self.__client = None
...@@ -173,8 +178,7 @@ class IoTDBRpcDataSet(object): ...@@ -173,8 +178,7 @@ class IoTDBRpcDataSet(object):
self.__value[i] = value_buffer[4 : 4 + length] self.__value[i] = value_buffer[4 : 4 + length]
self.__query_data_set.valueList[i] = value_buffer[4 + length :] self.__query_data_set.valueList[i] = value_buffer[4 + length :]
else: else:
print("unsupported data type {}.".format(data_type)) raise RuntimeError("unsupported data type {}.".format(data_type))
# could raise exception here
self.__rows_index += 1 self.__rows_index += 1
self.__has_cached_record = True self.__has_cached_record = True
...@@ -196,7 +200,9 @@ class IoTDBRpcDataSet(object): ...@@ -196,7 +200,9 @@ class IoTDBRpcDataSet(object):
self.__query_data_set = resp.queryDataSet self.__query_data_set = resp.queryDataSet
return resp.hasResultSet return resp.hasResultSet
except TTransport.TException as e: except TTransport.TException as e:
print("Cannot fetch result from server, because of network connection: ", e) raise RuntimeError(
"Cannot fetch result from server, because of network connection: ", e
)
def is_null(self, index, row_num): def is_null(self, index, row_num):
bitmap = self.__current_bitmap[index] bitmap = self.__current_bitmap[index]
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# #
import logging
import struct import struct
from iotdb.utils.Field import Field from iotdb.utils.Field import Field
...@@ -27,6 +27,8 @@ from iotdb.utils.RowRecord import RowRecord ...@@ -27,6 +27,8 @@ from iotdb.utils.RowRecord import RowRecord
import pandas as pd import pandas as pd
logger = logging.getLogger("IoTDB")
class SessionDataSet(object): class SessionDataSet(object):
def __init__( def __init__(
...@@ -114,8 +116,7 @@ class SessionDataSet(object): ...@@ -114,8 +116,7 @@ class SessionDataSet(object):
elif data_type == TSDataType.TEXT: elif data_type == TSDataType.TEXT:
field.set_binary_value(value_bytes) field.set_binary_value(value_bytes)
else: else:
print("unsupported data type {}.".format(data_type)) raise RuntimeError("unsupported data type {}.".format(data_type))
# could raise exception here
else: else:
field = Field(None) field = Field(None)
out_fields.append(field) out_fields.append(field)
......
...@@ -40,8 +40,9 @@ class Tablet(object): ...@@ -40,8 +40,9 @@ class Tablet(object):
:param timestamps: List. :param timestamps: List.
""" """
if len(timestamps) != len(values): if len(timestamps) != len(values):
print("Input error! len(timestamps) does not equal to len(values)!") raise RuntimeError(
# could raise an error here. "Input error! len(timestamps) does not equal to len(values)!"
)
if not Tablet.check_sorted(timestamps): if not Tablet.check_sorted(timestamps):
sorted_zipped = sorted(zip(timestamps, values)) sorted_zipped = sorted(zip(timestamps, values))
...@@ -124,9 +125,7 @@ class Tablet(object): ...@@ -124,9 +125,7 @@ class Tablet(object):
values_tobe_packed.append(len(value_bytes)) values_tobe_packed.append(len(value_bytes))
values_tobe_packed.append(value_bytes) values_tobe_packed.append(value_bytes)
else: else:
print("Unsupported data type:" + str(self.__data_types[i])) raise RuntimeError("Unsupported data type:" + str(self.__data_types[i]))
# could raise an error here.
return
format_str = "".join(format_str_list) format_str = "".join(format_str_list)
return struct.pack(format_str, *values_tobe_packed) return struct.pack(format_str, *values_tobe_packed)
#!/usr/bin/env bash
#
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, 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.
#
rm -Rf build
rm -Rf dist
rm -Rf iotdb_session.egg_info
# (Re-)build generated code
(cd ..; mvn clean generate-sources -pl client-py -am)
# Run Linting
flake8
# Run unit tests
pytest .
# See https://packaging.python.org/tutorials/packaging-projects/
python setup.py sdist bdist_wheel
twine upload --repository pypi dist/*
\ No newline at end of file
...@@ -21,4 +21,7 @@ ...@@ -21,4 +21,7 @@
pytest==6.2.2 pytest==6.2.2
thrift==0.13.0 thrift==0.13.0
flake8==3.9.0 flake8==3.9.0
black==20.8b1 black==20.8b1
\ No newline at end of file # For releases
twine==3.4.1
wheel==0.36.2
\ No newline at end of file
...@@ -597,6 +597,10 @@ ...@@ -597,6 +597,10 @@
<!-- exclude go.mod and go.sum in iotdb-client-go submodule--> <!-- exclude go.mod and go.sum in iotdb-client-go submodule-->
<exclude>**/go.mod</exclude> <exclude>**/go.mod</exclude>
<exclude>**/go.sum</exclude> <exclude>**/go.sum</exclude>
<!-- python -->
<exclude>.pytest_cache/**</exclude>
<exclude>venv/**</exclude>
<exclude>apache_iotdb.egg-info/**</exclude>
</excludes> </excludes>
</configuration> </configuration>
</plugin> </plugin>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册