@@ -186,7 +186,7 @@ async def handle_server(user, server_name, server, max_age, inactive_limit):
186
186
log_name = f"{ user ['name' ]} /{ server_name } "
187
187
if server .get ("pending" ):
188
188
app_log .warning (
189
- "Not culling server %s with pending %s" , log_name , server [" pending" ]
189
+ f "Not culling server { log_name } with pending { server [' pending' ] } "
190
190
)
191
191
return False
192
192
@@ -199,7 +199,7 @@ async def handle_server(user, server_name, server, max_age, inactive_limit):
199
199
200
200
if not server .get ("ready" , bool (server ["url" ])):
201
201
app_log .warning (
202
- "Not culling not-ready not-pending server %s: %s" , log_name , server
202
+ f "Not culling not-ready not-pending server { log_name } : { server } "
203
203
)
204
204
return False
205
205
@@ -239,7 +239,7 @@ async def handle_server(user, server_name, server, max_age, inactive_limit):
239
239
)
240
240
if should_cull :
241
241
app_log .info (
242
- "Culling server %s (inactive for %s)" , log_name , format_td (inactive )
242
+ f "Culling server { log_name } (inactive for { format_td (inactive )} )"
243
243
)
244
244
245
245
if max_age and not should_cull :
@@ -293,7 +293,7 @@ async def handle_server(user, server_name, server, max_age, inactive_limit):
293
293
)
294
294
resp = await fetch (req )
295
295
if resp .code == 202 :
296
- app_log .warning ("Server %s is slow to stop" , log_name )
296
+ app_log .warning (f "Server { log_name } is slow to stop" )
297
297
# return False to prevent culling user with pending shutdowns
298
298
return False
299
299
return True
@@ -368,7 +368,7 @@ async def handle_user(user):
368
368
) and (cull_admin_users or not user_is_admin )
369
369
370
370
if should_cull :
371
- app_log .info ("Culling user %s (inactive for %s)" , user [ "name" ], inactive )
371
+ app_log .info (f "Culling user { user [ 'name' ] } " f" (inactive for { inactive } )" )
372
372
373
373
if max_age and not should_cull :
374
374
# only check created if max_age is specified
@@ -427,15 +427,16 @@ async def handle_user(user):
427
427
n_users += 1
428
428
futures .append ((user ["name" ], handle_user (user )))
429
429
430
- app_log .debug (
431
- "Got %d users%s" , n_users , (" with ready servers" if state_filter else "" )
432
- )
430
+ if state_filter :
431
+ app_log .debug (f"Got { n_users } users with ready servers" )
432
+ else :
433
+ app_log .debug (f"Got { n_users } users" )
433
434
434
435
for name , f in futures :
435
436
try :
436
437
result = await f
437
438
except Exception :
438
- app_log .exception ("Error processing %s" , name )
439
+ app_log .exception (f "Error processing { name } " )
439
440
else :
440
441
if result :
441
442
app_log .debug ("Finished culling %s" , name )
@@ -570,9 +571,8 @@ def main():
570
571
AsyncHTTPClient .configure ("tornado.curl_httpclient.CurlAsyncHTTPClient" )
571
572
except ImportError as e :
572
573
app_log .warning (
573
- "Could not load pycurl: %s\n "
574
- "pycurl is recommended if you have a large number of users." ,
575
- e ,
574
+ f"Could not load pycurl: { e } \n "
575
+ "pycurl is recommended if you have a large number of users."
576
576
)
577
577
578
578
loop = IOLoop .current ()
0 commit comments