moved cursor.close before cnx.close in myems aggregation service
parent
d881705193
commit
2533f834df
|
@ -250,20 +250,20 @@ def main(logger):
|
|||
break
|
||||
|
||||
# end of for combined equipment loop
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
if cursor_billing_db:
|
||||
cursor_billing_db.close()
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
print("go to sleep 300 seconds...")
|
||||
time.sleep(300)
|
||||
print("wake from sleep, and continue to work...")
|
||||
|
|
|
@ -250,20 +250,20 @@ def main(logger):
|
|||
break
|
||||
|
||||
# end of for combined equipment loop
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
if cursor_billing_db:
|
||||
cursor_billing_db.close()
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
print("go to sleep 300 seconds...")
|
||||
time.sleep(300)
|
||||
print("wake from sleep, and continue to work...")
|
||||
|
|
|
@ -250,20 +250,20 @@ def main(logger):
|
|||
break
|
||||
|
||||
# end of for combined equipment loop
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
if cursor_billing_db:
|
||||
cursor_billing_db.close()
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
print("go to sleep 300 seconds...")
|
||||
time.sleep(300)
|
||||
print("wake from sleep, and continue to work...")
|
||||
|
|
|
@ -249,20 +249,20 @@ def main(logger):
|
|||
break
|
||||
|
||||
# end of for equipment loop
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
if cursor_billing_db:
|
||||
cursor_billing_db.close()
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
print("go to sleep 300 seconds...")
|
||||
time.sleep(300)
|
||||
print("wake from sleep, and continue to work...")
|
||||
|
|
|
@ -249,20 +249,20 @@ def main(logger):
|
|||
break
|
||||
|
||||
# end of for equipment loop
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
if cursor_billing_db:
|
||||
cursor_billing_db.close()
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
print("go to sleep 300 seconds...")
|
||||
time.sleep(300)
|
||||
print("wake from sleep, and continue to work...")
|
||||
|
|
|
@ -249,20 +249,20 @@ def main(logger):
|
|||
break
|
||||
|
||||
# end of for equipment loop
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
if cursor_billing_db:
|
||||
cursor_billing_db.close()
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
print("go to sleep 300 seconds...")
|
||||
time.sleep(300)
|
||||
print("wake from sleep, and continue to work...")
|
||||
|
|
|
@ -246,20 +246,20 @@ def main(logger):
|
|||
break
|
||||
|
||||
# end of for meter loop
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
if cursor_billing_db:
|
||||
cursor_billing_db.close()
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
print("go to sleep 300 seconds...")
|
||||
time.sleep(300)
|
||||
print("wake from sleep, and continue to work...")
|
||||
|
|
|
@ -247,20 +247,20 @@ def main(logger):
|
|||
break
|
||||
|
||||
# end of for meter loop
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
|
||||
if cnx_carbon_db:
|
||||
cnx_carbon_db.close()
|
||||
if cursor_carbon_db:
|
||||
cursor_carbon_db.close()
|
||||
if cnx_carbon_db:
|
||||
cnx_carbon_db.close()
|
||||
print("go to sleep 300 seconds...")
|
||||
time.sleep(300)
|
||||
print("wake from sleep, and continue to work...")
|
||||
|
|
|
@ -246,20 +246,20 @@ def main(logger):
|
|||
break
|
||||
|
||||
# end of for offline_meter loop
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
if cursor_billing_db:
|
||||
cursor_billing_db.close()
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
print("go to sleep 300 seconds...")
|
||||
time.sleep(300)
|
||||
print("wake from sleep, and continue to work...")
|
||||
|
|
|
@ -247,20 +247,20 @@ def main(logger):
|
|||
break
|
||||
|
||||
# end of for offline meter loop
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
|
||||
if cnx_carbon_db:
|
||||
cnx_carbon_db.close()
|
||||
if cursor_carbon_db:
|
||||
cursor_carbon_db.close()
|
||||
if cnx_carbon_db:
|
||||
cnx_carbon_db.close()
|
||||
print("go to sleep 300 seconds...")
|
||||
time.sleep(300)
|
||||
print("wake from sleep, and continue to work...")
|
||||
|
|
|
@ -249,20 +249,20 @@ def main(logger):
|
|||
break
|
||||
|
||||
# end of for shopfloor loop
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
if cursor_billing_db:
|
||||
cursor_billing_db.close()
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
print("go to sleep 300 seconds...")
|
||||
time.sleep(300)
|
||||
print("wake from sleep, and continue to work...")
|
||||
|
|
|
@ -249,20 +249,20 @@ def main(logger):
|
|||
break
|
||||
|
||||
# end of for shopfloor loop
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
if cursor_billing_db:
|
||||
cursor_billing_db.close()
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
print("go to sleep 300 seconds...")
|
||||
time.sleep(300)
|
||||
print("wake from sleep, and continue to work...")
|
||||
|
|
|
@ -249,20 +249,20 @@ def main(logger):
|
|||
break
|
||||
|
||||
# end of for store loop
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
if cursor_billing_db:
|
||||
cursor_billing_db.close()
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
print("go to sleep 300 seconds...")
|
||||
time.sleep(300)
|
||||
print("wake from sleep, and continue to work...")
|
||||
|
|
|
@ -249,20 +249,20 @@ def main(logger):
|
|||
break
|
||||
|
||||
# end of for store loop
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
if cursor_billing_db:
|
||||
cursor_billing_db.close()
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
print("go to sleep 300 seconds...")
|
||||
time.sleep(300)
|
||||
print("wake from sleep, and continue to work...")
|
||||
|
|
|
@ -36,10 +36,10 @@ def get_energy_category_tariffs(cost_center_id, energy_category_id, start_dateti
|
|||
rows_tariffs = cursor.fetchall()
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
if cnx:
|
||||
cnx.close()
|
||||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.close()
|
||||
return dict()
|
||||
|
||||
if rows_tariffs is None or len(rows_tariffs) == 0:
|
||||
|
@ -63,10 +63,10 @@ def get_energy_category_tariffs(cost_center_id, energy_category_id, start_dateti
|
|||
rows_timeofuse_tariffs = cursor.fetchall()
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
if cnx:
|
||||
cnx.close()
|
||||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.close()
|
||||
return dict()
|
||||
|
||||
if cursor:
|
||||
|
@ -137,10 +137,10 @@ def get_energy_item_tariffs(cost_center_id, energy_item_id, start_datetime_utc,
|
|||
rows_tariffs = cursor.fetchall()
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
if cnx:
|
||||
cnx.close()
|
||||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.close()
|
||||
return dict()
|
||||
|
||||
if rows_tariffs is None or len(rows_tariffs) == 0:
|
||||
|
@ -164,10 +164,10 @@ def get_energy_item_tariffs(cost_center_id, energy_item_id, start_datetime_utc,
|
|||
rows_timeofuse_tariffs = cursor.fetchall()
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
if cnx:
|
||||
cnx.close()
|
||||
if cursor:
|
||||
cursor.close()
|
||||
if cnx:
|
||||
cnx.close()
|
||||
return dict()
|
||||
|
||||
if cursor:
|
||||
|
|
|
@ -248,20 +248,20 @@ def main(logger):
|
|||
break
|
||||
|
||||
# end of for tenant loop
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
if cursor_billing_db:
|
||||
cursor_billing_db.close()
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
print("go to sleep 300 seconds...")
|
||||
time.sleep(300)
|
||||
print("wake from sleep, and continue to work...")
|
||||
|
|
|
@ -248,20 +248,20 @@ def main(logger):
|
|||
break
|
||||
|
||||
# end of for tenant loop
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
if cursor_billing_db:
|
||||
cursor_billing_db.close()
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
print("go to sleep 300 seconds...")
|
||||
time.sleep(300)
|
||||
print("wake from sleep, and continue to work...")
|
||||
|
|
|
@ -246,20 +246,20 @@ def main(logger):
|
|||
break
|
||||
|
||||
# end of for virtual_meter loop
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
if cursor_billing_db:
|
||||
cursor_billing_db.close()
|
||||
if cnx_billing_db:
|
||||
cnx_billing_db.close()
|
||||
print("go to sleep 300 seconds...")
|
||||
time.sleep(300)
|
||||
print("wake from sleep, and continue to work...")
|
||||
|
|
|
@ -247,20 +247,20 @@ def main(logger):
|
|||
break
|
||||
|
||||
# end of for virtual_meter loop
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
if cursor_system_db:
|
||||
cursor_system_db.close()
|
||||
if cnx_system_db:
|
||||
cnx_system_db.close()
|
||||
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
if cursor_energy_db:
|
||||
cursor_energy_db.close()
|
||||
if cnx_energy_db:
|
||||
cnx_energy_db.close()
|
||||
|
||||
if cnx_carbon_db:
|
||||
cnx_carbon_db.close()
|
||||
if cursor_carbon_db:
|
||||
cursor_carbon_db.close()
|
||||
if cnx_carbon_db:
|
||||
cnx_carbon_db.close()
|
||||
print("go to sleep 300 seconds...")
|
||||
time.sleep(300)
|
||||
print("wake from sleep, and continue to work...")
|
||||
|
|
Loading…
Reference in New Issue