Skip to content

Commit 595c078

Browse files
committed
Format monitor_pool_usage.py with black
1 parent abdf285 commit 595c078

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

monitor_pool_usage.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ def _fetch_user_creations(
4646
if not doc:
4747
continue
4848
# Keep the earliest audit entry per user record.
49-
if doc not in seen or audit.get("sys_created_on", "") < seen[doc].get("sys_created_on", ""):
49+
if doc not in seen or audit.get("sys_created_on", "") < seen[doc].get(
50+
"sys_created_on", ""
51+
):
5052
seen[doc] = audit
5153
if len(batch) < page_size:
5254
break
@@ -103,7 +105,9 @@ def _init_wandb(instance_name: str | None = None):
103105
try:
104106
import wandb
105107
except ImportError as exc:
106-
raise SystemExit("wandb is required for logging; install it to enable W&B logging.") from exc
108+
raise SystemExit(
109+
"wandb is required for logging; install it to enable W&B logging."
110+
) from exc
107111

108112
# Use instance name or "total" as the display name
109113
display_name = instance_name or "total"
@@ -158,11 +162,13 @@ def _log_time_series_to_wandb(
158162

159163
# Log in chronological order with human-readable date
160164
for bucket, metric_name, count in all_data:
161-
run.log({
162-
"timestamp": int(bucket.timestamp()),
163-
metric_name: count,
164-
"date": bucket, # Pass datetime object directly for W&B to format
165-
})
165+
run.log(
166+
{
167+
"timestamp": int(bucket.timestamp()),
168+
metric_name: count,
169+
"date": bucket, # Pass datetime object directly for W&B to format
170+
}
171+
)
166172

167173
run.finish()
168174

@@ -188,12 +194,8 @@ def main():
188194
url = entry["url"]
189195
logging.info("Querying %s", url)
190196
try:
191-
instance = SNowInstance(
192-
snow_url=url, snow_credentials=("admin", entry["password"])
193-
)
194-
creations = _fetch_user_creations(
195-
instance=instance, start_ts=start_ts, end_ts=end_ts
196-
)
197+
instance = SNowInstance(snow_url=url, snow_credentials=("admin", entry["password"]))
198+
creations = _fetch_user_creations(instance=instance, start_ts=start_ts, end_ts=end_ts)
197199
summaries.append((url, len(creations)))
198200
hourly = _hourly_counts(creations)
199201
for bucket, count in hourly.items():

0 commit comments

Comments
 (0)