-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
176 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,4 @@ pytz==2022.7.1 | |
python-dateutil==2.8.2 | ||
eth_keys==0.4.0 | ||
pycryptodome==3.18.0 | ||
pymemcache==4.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env python3 | ||
from lib_const import * | ||
from decorators import * | ||
from lib_dpow_const import SEASONS_INFO | ||
from lib_query_ntx import select_from_notarised_tbl_where | ||
from lib_update_ntx import delete_from_notarised_tbl_where, update_ntx_row | ||
import lib_helper as helper | ||
import lib_ntx | ||
|
||
|
||
def archive_past_seasons(current_seasons=["Season_7"]): | ||
for season in SEASONS_INFO: | ||
print(season) | ||
if season not in current_seasons: | ||
print(season) | ||
data = select_from_notarised_tbl_where(season=season) | ||
for i in data: | ||
txid = i[1] | ||
coin = i[2] | ||
block_hash = i[3] | ||
block_time = i[4] | ||
block_datetime = i[5] | ||
block_height = i[6] | ||
notaries = i[7] | ||
ac_ntx_blockhash = i[8] | ||
ac_ntx_height = i[9] | ||
opret = i[10] | ||
season = i[11] | ||
notary_addresses = i[12] | ||
scored = i[13] | ||
server = i[14] | ||
score_value = i[15] | ||
epoch = i[16] | ||
|
||
row_data = (coin, block_height, | ||
block_time, block_datetime, block_hash, | ||
notaries, notary_addresses, | ||
ac_ntx_blockhash, ac_ntx_height, txid, | ||
opret, season, server, scored, | ||
score_value, epoch) | ||
update_ntx_row(row_data, table='notarised_archive', unique='unique_txid_archive') | ||
delete_from_notarised_tbl_where(season=season) | ||
|
||
|
||
|
||
|
||
if __name__ == '__main__': | ||
current_seasons = ["Season_7"] | ||
archive_past_seasons(current_seasons) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env python3 | ||
from decorators import print_runtime | ||
import lib_ntx | ||
|
||
''' | ||
Run after season ends to ensure full ntx coverage | ||
and epoch scores alignment. Runtime 4-5hrs. | ||
''' | ||
|
||
@print_runtime | ||
def rescan_season(season="Season_7"): | ||
notarised_table = lib_ntx.notarised(season, rescan=True) | ||
# Revalidates existing data, run after epoch changes to correct the scores. | ||
notarised_table.clean_up() | ||
# Scan all season blocks for missing txids | ||
notarised_table.update_table() | ||
|
||
ntx_season_tables = lib_ntx.ntx_season_stats(season) | ||
# Deletes all season ntx aggregate data for a clean slate | ||
ntx_season_tables.clean_up() | ||
# Recalculates season ntx aggregate data | ||
ntx_season_tables.update_ntx_season_stats_tables() | ||
|
||
ntx_daily_tables = lib_ntx.ntx_daily_stats(season, rescan=True) | ||
# Recalculate all daily ntx stats data | ||
ntx_daily_tables.update_daily_ntx_tables() | ||
|
||
if __name__ == "__main__": | ||
rescan_season() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters