@@ 477-493 (lines=17) @@ | ||
474 | continue |
|
475 | ||
476 | print('bad list: ' + str(bad_list)) |
|
477 | while len(bad_list) > 0: |
|
478 | update_100 = bad_list[:100] |
|
479 | bad_list = bad_list[100:] |
|
480 | try: |
|
481 | update = (" UPDATE tbl_energy_value " |
|
482 | " SET is_bad = 1 " |
|
483 | " WHERE id IN (" + ', '.join(map(str, update_100)) + ")") |
|
484 | cursor_historical.execute(update, ) |
|
485 | cnx_historical.commit() |
|
486 | except Exception as e: |
|
487 | logger.error("Error in step 3.2 of clean_energy_value.process " + str(e)) |
|
488 | if cursor_historical: |
|
489 | cursor_historical.close() |
|
490 | if cnx_historical: |
|
491 | cnx_historical.close() |
|
492 | time.sleep(60) |
|
493 | continue |
|
494 | ||
495 | ################################################################################################################ |
|
496 | # TODO: bad case 2.8 |
|
@@ 251-267 (lines=17) @@ | ||
248 | bad_list.append(row_energy_value[0]) |
|
249 | ||
250 | print('bad list: ' + str(bad_list)) |
|
251 | while len(bad_list) > 0: |
|
252 | update_100 = bad_list[:100] |
|
253 | bad_list = bad_list[100:] |
|
254 | try: |
|
255 | update = (" UPDATE tbl_energy_value " |
|
256 | " SET is_bad = 1 " |
|
257 | " WHERE id IN (" + ', '.join(map(str, update_100)) + ")") |
|
258 | cursor_historical.execute(update, ) |
|
259 | cnx_historical.commit() |
|
260 | except Exception as e: |
|
261 | logger.error("Error in step 2.3 of clean_energy_value.process " + str(e)) |
|
262 | if cursor_historical: |
|
263 | cursor_historical.close() |
|
264 | if cnx_historical: |
|
265 | cnx_historical.close() |
|
266 | time.sleep(60) |
|
267 | continue |
|
268 | ||
269 | ################################################################################################################ |
|
270 | # Step 3: check bad case class 2 which is in concave shape model. |