Skip to content

Commit

Permalink
Fix the problem W1203
Browse files Browse the repository at this point in the history
  • Loading branch information
a-masterov committed Jul 9, 2024
1 parent d554a3f commit 5545371
Show file tree
Hide file tree
Showing 93 changed files with 559 additions and 559 deletions.
4 changes: 2 additions & 2 deletions scripts/benchmark_durations.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ def main(args: argparse.Namespace):
for row in rows:
pytest_name = f"{row['parent_suite'].replace('.', '/')}/{row['suite']}.py::{row['name']}"
duration = row["percentile_ms"] / 1000
logging.info(f"\t{pytest_name}: {duration}")
logging.info("\t%s: %s", pytest_name, duration)
res[pytest_name] = duration

logging.info(f"saving results to {output.name}")
logging.info("saving results to %s", output.name)
json.dump(res, output, indent=2)


Expand Down
4 changes: 2 additions & 2 deletions scripts/flaky_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ def get_pageserver_default_tenant_config_compaction_algorithm() -> Optional[Dict
res[row["parent_suite"]][row["suite"]][parametrized_test] = True

logging.info(
f"\t{row['parent_suite'].replace('.', '/')}/{row['suite']}.py::{parametrized_test}"
"\t%s/%s.py::%s", row['parent_suite'].replace('.', '/'), row['suite'], parametrized_test
)

logging.info(f"saving results to {output.name}")
logging.info("saving results to %s", output.name)
json.dump(res, output, indent=2)


Expand Down
12 changes: 6 additions & 6 deletions scripts/force_layer_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ async def do_timeline(client: Client, tenant_id, timeline_id):

while True:
st = await client.timeline_poll_download_remote_layers_status(tenant_id, timeline_id)
logging.info(f"{tenant_id}:{timeline_id} state is: {st}")
logging.info("%s:%s state is: %s", tenant_id, timeline_id, st)

if spawned["task_id"] != st["task_id"]:
raise ClientException("download task ids changed while polling")
Expand Down Expand Up @@ -161,7 +161,7 @@ async def taskq_handler(task_q, result_q):
except asyncio.QueueEmpty:
logging.debug("taskq_handler observed empty task_q, returning")
return
logging.info(f"starting task {id}")
logging.info("starting task %s", id)
try:
res = await fut
except Exception as e:
Expand All @@ -172,7 +172,7 @@ async def taskq_handler(task_q, result_q):
async def print_progress(result_q, tasks):
while True:
await asyncio.sleep(10)
logging.info(f"{result_q.qsize()} / {len(tasks)} tasks done")
logging.info("%s / %s tasks done", result_q.qsize(), len(tasks))


async def main_impl(args, report_out, client: Client):
Expand Down Expand Up @@ -205,13 +205,13 @@ async def main_impl(args, report_out, client: Client):

logging.info("expanded spec:")
for tid, tlid in tenant_and_timline_ids:
logging.info(f"{tid}:{tlid}")
logging.info("%s:%s", tid, tlid)

logging.info("remove duplicates after expanding spec")
tmp = list(set(tenant_and_timline_ids))
assert len(tmp) <= len(tenant_and_timline_ids)
if len(tmp) != len(tenant_and_timline_ids):
logging.info(f"spec had {len(tenant_and_timline_ids) - len(tmp)} duplicates")
logging.info("spec had %s duplicates", len(tenant_and_timline_ids) - len(tmp))
tenant_and_timline_ids = tmp

logging.info("create tasks and process them at specified concurrency")
Expand Down Expand Up @@ -244,7 +244,7 @@ async def main_impl(args, report_out, client: Client):

report = defaultdict(list)
for id, result in results:
logging.info(f"result for {id}: {result}")
logging.info("result for %s: %s", id, result)
if isinstance(result, Completed):
if result.status["failed_download_count"] == 0:
report["completed_without_errors"].append(id)
Expand Down
18 changes: 9 additions & 9 deletions scripts/sk_cleanup_tenants/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

trash_dir: Path = args.trash_dir
dry_run: bool = args.dry_run
logging.info(f"dry_run={dry_run}")
logging.info("dry_run=%s", dry_run)
sk_id: int = args.safekeeper_id
sk_host: str = args.safekeeper_host

Expand Down Expand Up @@ -94,10 +94,10 @@ def cleanup_tenant(tenant_id):
assert tenant_dir.exists(), f"{tenant_dir}"
assert tenant_dir.is_dir(), f"{tenant_dir}"

logging.info(f"copying {tenant_dir} to {tenant_dir_in_trash}")
logging.info("copying %s to %s", tenant_dir, tenant_dir_in_trash)
shutil.copytree(src=tenant_dir, dst=tenant_dir_in_trash, symlinks=False, dirs_exist_ok=False)

logging.info(f"deleting {tenant_dir}")
logging.info("deleting %s", tenant_dir)
call_delete_tenant_api(tenant_id)

logging.info("tenant is now deleted, checking that it's gone")
Expand All @@ -106,27 +106,27 @@ def cleanup_tenant(tenant_id):

if os.path.exists("script.pid"):
logging.info(
f"script is already running, with pid={Path('script.pid').read_text()}. Terminate it first."
"script is already running, with pid=%s. Terminate it first.", Path('script.pid').read_text()
)
exit(1)

with open("script.pid", "w", encoding="utf-8") as f:
f.write(str(os.getpid()))

logging.info(f"started script.py, pid={os.getpid()}")
logging.info("started script.py, pid=%s", os.getpid())

for line in sys.stdin:
tenant_id = line.strip()
try:
logging.info(f"start tenant {tenant_id}")
logging.info("start tenant %s", tenant_id)
cleanup_tenant(tenant_id)
logging.info(f"done tenant {tenant_id}")
logging.info("done tenant %s", tenant_id)
except KeyboardInterrupt:
print("KeyboardInterrupt exception is caught")
break
except: # noqa: E722
logging.exception(f"failed to clean up tenant {tenant_id}")
logging.exception("failed to clean up tenant %s", tenant_id)

logging.info(f"finished script.py, pid={os.getpid()}")
logging.info("finished script.py, pid=%s", os.getpid())

os.remove("script.pid")
4 changes: 2 additions & 2 deletions test_runner/fixtures/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ def check_status(self):

def try_start(self):
if self.handle is not None:
log.debug(f"storage_broker is already running on port {self.port}")
log.debug("storage_broker is already running on port %s", self.port)
return

listen_addr = self.listen_addr()
log.info(f'starting storage_broker to listen incoming connections at "{listen_addr}"')
log.info('starting storage_broker to listen incoming connections at "%s"', listen_addr)
with open(self.logfile, "wb") as logfile:
args = [
str(self.neon_binpath / "storage_broker"),
Expand Down
2 changes: 1 addition & 1 deletion test_runner/fixtures/compute_reconfigure.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def compute_reconfigure_listener(make_httpserver):
def handler(request: Request):
assert request.json is not None
body: dict[str, Any] = request.json
log.info(f"notify-attach request: {body}")
log.info("notify-attach request: %s", body)

if self.on_notify is not None:
self.on_notify(body)
Expand Down
4 changes: 2 additions & 2 deletions test_runner/fixtures/flaky.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def pytest_collection_modifyitems(config: Config, items: List[pytest.Item]):
try:
flaky_tests = json.loads(content)
except ValueError:
log.error(f"Can't parse {content} as json")
log.error("Can't parse %s as json", content)
return

for item in items:
Expand All @@ -54,7 +54,7 @@ def pytest_collection_modifyitems(config: Config, items: List[pytest.Item]):

if flaky_tests.get(parent_suite, {}).get(suite, {}).get(name, False):
# Rerun 3 times = 1 original run + 2 reruns
log.info(f"Marking {item.nodeid} as flaky. It will be rerun up to 3 times")
log.info("Marking %s as flaky. It will be rerun up to 3 times", item.nodeid)
item.add_marker(pytest.mark.flaky(reruns=2))

# pytest-rerunfailures is not compatible with pytest-timeout (timeout is not set for reruns),
Expand Down
4 changes: 2 additions & 2 deletions test_runner/fixtures/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def get_metric_value(
metrics = self.get_metrics()
results = metrics.query_all(name, filter=filter)
if not results:
log.info(f'could not find metric "{name}"')
log.info('could not find metric "%s"', name)
return None
assert len(results) == 1, f"metric {name} with given filters is not unique, got: {results}"
return results[0].value
Expand Down Expand Up @@ -81,7 +81,7 @@ def get_metrics_values(

if not absence_ok:
if len(result) != len(names):
log.info(f"Metrics found: {metrics.metrics}")
log.info("Metrics found: %s", metrics.metrics)
raise RuntimeError(f"could not find all metrics {' '.join(names)}")

return result
Expand Down
Loading

0 comments on commit 5545371

Please sign in to comment.