|
105 | 105 | "system-3.9",
|
106 | 106 | "system-3.12",
|
107 | 107 | "cover",
|
| 108 | + "cleanup", |
108 | 109 | ]
|
109 | 110 |
|
110 | 111 | # Error if a python version is missing
|
@@ -952,25 +953,24 @@ def release_dry_run(session):
|
952 | 953 | def cleanup(session):
|
953 | 954 | """Clean up stale and/or temporary resources in the test project."""
|
954 | 955 | google_cloud_project = os.getenv("GOOGLE_CLOUD_PROJECT")
|
955 |
| - if not google_cloud_project: |
956 |
| - session.error( |
957 |
| - "Set GOOGLE_CLOUD_PROJECT environment variable to run notebook session." |
958 |
| - ) |
| 956 | + cleanup_options = [] |
| 957 | + if google_cloud_project: |
| 958 | + cleanup_options.append(f"--project-id={google_cloud_project}") |
959 | 959 |
|
960 | 960 | # Cleanup a few stale (more than 12 hours old) temporary cloud run
|
961 | 961 | # functions created by bigframems. This will help keeping the test GCP
|
962 | 962 | # project within the "Number of functions" quota
|
963 | 963 | # https://cloud.google.com/functions/quotas#resource_limits
|
964 | 964 | recency_cutoff_hours = 12
|
965 |
| - cleanup_count_per_location = 10 |
| 965 | + cleanup_count_per_location = 20 |
| 966 | + cleanup_options.extend( |
| 967 | + [ |
| 968 | + f"--recency-cutoff={recency_cutoff_hours}", |
| 969 | + "cleanup", |
| 970 | + f"--number={cleanup_count_per_location}", |
| 971 | + ] |
| 972 | + ) |
966 | 973 |
|
967 | 974 | session.install("-e", ".")
|
968 | 975 |
|
969 |
| - session.run( |
970 |
| - "python", |
971 |
| - "scripts/manage_cloud_functions.py", |
972 |
| - f"--project-id={google_cloud_project}", |
973 |
| - f"--recency-cutoff={recency_cutoff_hours}", |
974 |
| - "cleanup", |
975 |
| - f"--number={cleanup_count_per_location}", |
976 |
| - ) |
| 976 | + session.run("python", "scripts/manage_cloud_functions.py", *cleanup_options) |
0 commit comments