-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathcleanup_ci.py
More file actions
50 lines (40 loc) · 1.3 KB
/
cleanup_ci.py
File metadata and controls
50 lines (40 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from time import sleep
import boto3
from tqdm import tqdm
from google.cloud import bigtable
from google.cloud.bigtable import enums
def cleanup_dynamo_ci():
db = boto3.resource("dynamodb")
num_to_delete = 0
all_tables = db.tables.all()
for table in all_tables:
if "integration_test" in table.name:
num_to_delete += 1
with tqdm(total=num_to_delete) as progress:
for table in all_tables:
if "integration_test" in table.name:
table.delete()
progress.update()
print(f"Deleted {num_to_delete} CI DynamoDB tables")
def cleanup_bigtable_ci():
client = bigtable.Client(project="kf-feast", admin=True)
instance = client.instance("feast-integration-tests")
if instance.exists():
print(f"Deleted Bigtable CI instance")
instance.delete()
location_id = "us-central1-f"
serve_nodes = 1
storage_type = enums.StorageType.SSD
cluster = instance.cluster(
"feast-integration-tests-c1",
location_id=location_id,
serve_nodes=serve_nodes,
default_storage_type=storage_type,
)
instance.create(clusters=[cluster])
print(f"Created new Bigtable CI tables")
def main() -> None:
cleanup_dynamo_ci()
cleanup_bigtable_ci()
if __name__ == "__main__":
main()