hockey-blast-common-lib 0.1.44__py3-none-any.whl → 0.1.46__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hockey_blast_common_lib/aggregate_human_stats.py +11 -11
- hockey_blast_common_lib/dump_sample_db.sh +4 -0
- hockey_blast_common_lib/hockey_blast_sample_backup.sql.gz +0 -0
- hockey_blast_common_lib/restore_sample_db.sh +12 -5
- {hockey_blast_common_lib-0.1.44.dist-info → hockey_blast_common_lib-0.1.46.dist-info}/METADATA +1 -1
- {hockey_blast_common_lib-0.1.44.dist-info → hockey_blast_common_lib-0.1.46.dist-info}/RECORD +8 -8
- {hockey_blast_common_lib-0.1.44.dist-info → hockey_blast_common_lib-0.1.46.dist-info}/WHEEL +0 -0
- {hockey_blast_common_lib-0.1.44.dist-info → hockey_blast_common_lib-0.1.46.dist-info}/top_level.txt +0 -0
@@ -440,17 +440,17 @@ def run_aggregate_human_stats():
|
|
440
440
|
aggregate_human_stats(session, aggregation_type='org', aggregation_id=org_id, names_to_filter_out=not_human_names, human_id_filter=human_id_to_debug, aggregation_window='Daily')
|
441
441
|
|
442
442
|
# Aggregate by level
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
443
|
+
level_ids = session.query(Division.level_id).distinct().all()
|
444
|
+
level_ids = [level_id[0] for level_id in level_ids]
|
445
|
+
total_levels = len(level_ids)
|
446
|
+
processed_levels = 0
|
447
|
+
for level_id in level_ids:
|
448
|
+
if level_id is None:
|
449
|
+
continue
|
450
|
+
if human_id_to_debug is None:
|
451
|
+
print(f"\rProcessed {processed_levels}/{total_levels} levels ({(processed_levels/total_levels)*100:.2f}%)", end="")
|
452
|
+
processed_levels += 1
|
453
|
+
aggregate_human_stats(session, aggregation_type='level', aggregation_id=level_id, names_to_filter_out=not_human_names, human_id_filter=human_id_to_debug)
|
454
454
|
|
455
455
|
if __name__ == "__main__":
|
456
456
|
run_aggregate_human_stats()
|
@@ -14,6 +14,10 @@ export PGPASSWORD=$DB_PASSWORD
|
|
14
14
|
|
15
15
|
# Dump the database schema and data
|
16
16
|
pg_dump --username=$DB_USER --host=$DB_HOST --port=$DB_PORT --format=custom --file=$DUMP_FILE $DB_NAME
|
17
|
+
if [ $? -ne 0 ]; then
|
18
|
+
echo "Error: Database dump failed."
|
19
|
+
exit 1
|
20
|
+
fi
|
17
21
|
|
18
22
|
# Compress the backup file
|
19
23
|
gzip -c $DUMP_FILE > $COMPRESSED_DUMP_FILE
|
Binary file
|
@@ -9,15 +9,22 @@ DB_PORT=${DB_PORT:-"5432"}
|
|
9
9
|
COMPRESSED_DUMP_FILE="hockey_blast_sample_backup.sql.gz"
|
10
10
|
|
11
11
|
# Superuser credentials
|
12
|
-
SUPERUSER="
|
13
|
-
SUPERUSER_PASSWORD
|
12
|
+
SUPERUSER="your_superuser"
|
13
|
+
SUPERUSER_PASSWORD="your_superuser_password"
|
14
14
|
|
15
15
|
# Export PGPASSWORD to avoid password prompt
|
16
16
|
export PGPASSWORD=$SUPERUSER_PASSWORD
|
17
17
|
|
18
|
-
#
|
19
|
-
|
20
|
-
|
18
|
+
# Generate a unique timestamp
|
19
|
+
TIMESTAMP=$(date +%Y%m%d%H%M%S)
|
20
|
+
BACKUP_DB_NAME="${DB_NAME}_backup_${TIMESTAMP}"
|
21
|
+
|
22
|
+
# Check if the database exists and rename it if it does
|
23
|
+
DB_EXISTS=$(psql --username=$SUPERUSER --host=$DB_HOST --port=$DB_PORT -d postgres --tuples-only --command="SELECT 1 FROM pg_database WHERE datname = '$DB_NAME'")
|
24
|
+
if [ "$DB_EXISTS" = "1" ]; then
|
25
|
+
psql --username=$SUPERUSER --host=$DB_HOST --port=$DB_PORT -d postgres --command="SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$DB_NAME' AND pid <> pg_backend_pid();"
|
26
|
+
psql --username=$SUPERUSER --host=$DB_HOST --port=$DB_PORT -d postgres --command="ALTER DATABASE $DB_NAME RENAME TO $BACKUP_DB_NAME"
|
27
|
+
fi
|
21
28
|
|
22
29
|
# Create a new database
|
23
30
|
psql --username=$SUPERUSER --host=$DB_HOST --port=$DB_PORT -d postgres --command="CREATE DATABASE $DB_NAME OWNER $SUPERUSER"
|
{hockey_blast_common_lib-0.1.44.dist-info → hockey_blast_common_lib-0.1.46.dist-info}/RECORD
RENAMED
@@ -1,23 +1,23 @@
|
|
1
1
|
hockey_blast_common_lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
hockey_blast_common_lib/aggregate_all_stats.py,sha256=MUjT23mdOMfCTx-kRSY-LGrLHZ9HNlR6OMqv5KLdzR4,1056
|
3
3
|
hockey_blast_common_lib/aggregate_goalie_stats.py,sha256=FcYL40NP0-sPY7UI7F8Ny_RaPKz3mfkmhQnPVbeRtOc,12178
|
4
|
-
hockey_blast_common_lib/aggregate_human_stats.py,sha256=
|
4
|
+
hockey_blast_common_lib/aggregate_human_stats.py,sha256=VmUAMbqtWRPFM64V8ECJ3eJjRXvblNbeVU9HFYNoPp0,23898
|
5
5
|
hockey_blast_common_lib/aggregate_referee_stats.py,sha256=FszWLTygddDQNcUgbmevQ-eGPrW8Y0nXpRvUluPRKnU,11920
|
6
6
|
hockey_blast_common_lib/aggregate_skater_stats.py,sha256=FBc6enJNnFXYg7mVPiXssleTA1vZRAXCTFUa-3eOGdo,17199
|
7
7
|
hockey_blast_common_lib/assign_skater_skill.py,sha256=p-0fbodGpM8BCjKHDpxNb7BH2FcIlBsJwON844KNrUY,1817
|
8
8
|
hockey_blast_common_lib/db_connection.py,sha256=HvPxDvOj7j5H85RfslGvHVNevfg7mKCd0syJ6NX21mU,1890
|
9
|
-
hockey_blast_common_lib/dump_sample_db.sh,sha256=
|
10
|
-
hockey_blast_common_lib/hockey_blast_sample_backup.sql.gz,sha256
|
9
|
+
hockey_blast_common_lib/dump_sample_db.sh,sha256=MY3lnzTXBoWd76-ZlZr9nWsKMEVgyRsUn-LZ2d1JWZs,810
|
10
|
+
hockey_blast_common_lib/hockey_blast_sample_backup.sql.gz,sha256=EqpH7UlG-5L4FXnMDNpafIZbwUpDPPr3uIIJipBV880,1256779
|
11
11
|
hockey_blast_common_lib/models.py,sha256=xne38KwdBDcWvzdLyU6toozqkuatB9wiQhyiQ4xvAgU,16413
|
12
12
|
hockey_blast_common_lib/options.py,sha256=ejwDM2LVzeARlE5UwUNDt2Zzolat7OkXddhOZpzn1bw,823
|
13
|
-
hockey_blast_common_lib/restore_sample_db.sh,sha256
|
13
|
+
hockey_blast_common_lib/restore_sample_db.sh,sha256=7W3lzRZeu9zXIu1Bvtnaw8EHc1ulHmFM4mMh86oUQJo,2205
|
14
14
|
hockey_blast_common_lib/skills_in_divisions.py,sha256=m-UEwMwn1KM7wOYvDstgsOEeH57M9V6yrkBoghzGYKE,7005
|
15
15
|
hockey_blast_common_lib/skills_propagation.py,sha256=x6yy7fJ6IX3YiHqiP_v7-p_S2Expb8JJ-mWuajEFBdY,16388
|
16
16
|
hockey_blast_common_lib/stats_models.py,sha256=NWigeIowIJU6o1Sk1cP08kEy4t594LZpecKUnl-O6as,25552
|
17
17
|
hockey_blast_common_lib/stats_utils.py,sha256=DXsPO4jw8XsdRUN46TGF_IiBAfz3GCIVBswCGp5ELDk,284
|
18
18
|
hockey_blast_common_lib/utils.py,sha256=Sy5Pk40Tk3gsMrhMsUMlBD7i7jiVZmWLUBc94qI3zOA,5235
|
19
19
|
hockey_blast_common_lib/wsgi.py,sha256=7LGUzioigviJp-EUhSEaQcd4jBae0mxbkyBscQfZhlc,730
|
20
|
-
hockey_blast_common_lib-0.1.
|
21
|
-
hockey_blast_common_lib-0.1.
|
22
|
-
hockey_blast_common_lib-0.1.
|
23
|
-
hockey_blast_common_lib-0.1.
|
20
|
+
hockey_blast_common_lib-0.1.46.dist-info/METADATA,sha256=mcYIRcZadOh_NKp-NXSx6rn5FZ2jEDNApYB8IfaUmHI,318
|
21
|
+
hockey_blast_common_lib-0.1.46.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
22
|
+
hockey_blast_common_lib-0.1.46.dist-info/top_level.txt,sha256=wIR4LIkE40npoA2QlOdfCYlgFeGbsHR8Z6r0h46Vtgc,24
|
23
|
+
hockey_blast_common_lib-0.1.46.dist-info/RECORD,,
|
File without changes
|
{hockey_blast_common_lib-0.1.44.dist-info → hockey_blast_common_lib-0.1.46.dist-info}/top_level.txt
RENAMED
File without changes
|