Skip to content

Commit 8c50a78

Browse files
committed
[DOP-25451] Improve worker log messages
1 parent f4908f0 commit 8c50a78

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

syncmaster/worker/transfer.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,20 @@ def run_transfer(run_id: int, engine: Engine, settings: WorkerAppSettings):
4848
),
4949
)
5050
if run is None:
51-
logger.info("Run not found or already executed by someone else")
51+
logger.info("Run %r not found or already executed by someone else", run_id)
5252
return
5353

5454
source_connection = run.transfer.source_connection
55-
q_source_auth_data = select(AuthData).where(AuthData.connection_id == run.transfer.source_connection.id)
56-
source_auth_data = decrypt_auth_data(session.scalar(q_source_auth_data).value, settings)
55+
source_auth_data_query = select(AuthData).where(AuthData.connection_id == run.transfer.source_connection.id)
56+
source_auth_data_encrypted = session.scalar(source_auth_data_query)
57+
source_auth_data = decrypt_auth_data(source_auth_data_encrypted.value, settings)
5758

58-
q_target_auth_data = select(AuthData).where(AuthData.connection_id == run.transfer.target_connection.id)
5959
target_connection = run.transfer.target_connection
60-
target_auth_data = decrypt_auth_data(session.scalar(q_target_auth_data).value, settings)
60+
target_auth_data_query = select(AuthData).where(AuthData.connection_id == run.transfer.target_connection.id)
61+
target_auth_data_encrypted = session.scalar(target_auth_data_query)
62+
target_auth_data = decrypt_auth_data(target_auth_data_encrypted.value, settings)
6163

62-
logger.info("Starting run")
64+
logger.info("Starting run %r", run_id)
6365
run.status = Status.STARTED
6466
run.started_at = datetime.now(tz=timezone.utc)
6567
run.log_url = Template(settings.worker.log_url_template).render(
@@ -90,7 +92,7 @@ def run_transfer(run_id: int, engine: Engine, settings: WorkerAppSettings):
9092
with Session(engine) as session:
9193
run = session.get(Run, run_id)
9294
if run:
93-
logger.info("Updating run status in DB")
95+
logger.info("Updating run %r status in DB", run_id)
9496
run.status = status
9597
run.ended_at = datetime.now(tz=timezone.utc)
9698
session.commit()

0 commit comments

Comments
 (0)