Skip to content

Commit

Permalink
[tests/scenarios] always print side-type after "Admin" in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
khoaguin committed Sep 27, 2024
1 parent 83ac856 commit bb13be4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tests/scenariosv2/flows/admin_bigquery_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def __create_endpoint(
endpoint: Any,
path: str,
):
msg = f"Admin: Endpoint '{path}' on {server_info(admin_client)}"
msg = f"Admin {admin_client.metadata.server_side_type}: Endpoint '{path}' on {server_info(admin_client)}"
ctx.logger.info(f"{msg} - Creating")

# Create the endpoint
Expand Down
5 changes: 4 additions & 1 deletion tests/scenariosv2/flows/admin_bigquery_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ def bq_create_pool(
f"RUN uv pip install db-dtypes google-cloud-bigquery"
)

msg = f"Admin: Worker Pool tag '{worker_image_tag}' on {server_info(admin_client)}"
msg = (
f"Admin {admin_client.metadata.server_side_type}: "
f"Worker Pool tag '{worker_image_tag}' on {server_info(admin_client)}"
)

ctx.logger.info(f"{msg} - Creating")
build_and_launch_worker_pool_from_docker_str(
Expand Down
2 changes: 1 addition & 1 deletion tests/scenariosv2/flows/admin_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


def register_user(ctx: SimulatorContext, admin_client: sy.DatasiteClient, user: dict):
msg = f"Admin: User {user['email']} on {server_info(admin_client)}"
msg = f"Admin {admin_client.metadata.server_side_type}: User {user['email']} on {server_info(admin_client)}"
ctx.logger.info(f"{msg} - Creating")
_ = admin_client.register(
name=user["name"],
Expand Down
12 changes: 6 additions & 6 deletions tests/scenariosv2/l0_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ async def admin_high_triage_requests(
@sim_activity(trigger=Event.ADMIN_HIGHSIDE_FLOW_COMPLETED)
async def admin_high_side_flow(ctx: SimulatorContext, admin_auth):
admin_client = sy.login(**admin_auth)
ctx.logger.info("Admin high-side: logged in")
ctx.logger.info("Admin high: logged in")

await asyncio.gather(
admin_high_create_bq_pool(ctx, admin_client),
Expand All @@ -274,7 +274,7 @@ async def admin_high_side_flow(ctx: SimulatorContext, admin_auth):
@sim_activity(trigger=Event.ADMIN_LOWSIDE_FLOW_COMPLETED)
async def admin_low_side_flow(ctx: SimulatorContext, admin_auth, users):
admin_client = sy.login(**admin_auth)
ctx.logger.info("Admin low-side: logged in")
ctx.logger.info("Admin low: logged in")

await asyncio.gather(
admin_register_users(ctx, admin_client, users),
Expand Down Expand Up @@ -302,19 +302,19 @@ async def admin_sync(
while not ctx.events.is_set(exit_after):
await asyncio.sleep(random.uniform(5, 10))

ctx.logger.info(f"Admin: Sync {from_}->{to_} - Checking")
ctx.logger.info(f"Admin {from_}: Sync {from_}->{to_} - Checking")
result = sy.sync(from_client, to_client)
if isinstance(result, sy.SyftSuccess):
continue

ctx.logger.info(f"Admin: Sync {from_}->{to_} - Result={result}")
ctx.logger.info(f"Admin {from_}: Sync {from_}->{to_} - Result={result}")
result._share_all()
result._sync_all()

ctx.events.trigger(trigger)
ctx.logger.info(f"Admin: Sync {from_}->{to_} - Synced")
ctx.logger.info(f"Admin {from_}: Sync {from_}->{to_} - Synced")

ctx.logger.info(f"Admin: Sync {from_}->{to_} - Closed")
ctx.logger.info(f"Admin {from_}: Sync {from_}->{to_} - Closed")


@sim_activity(trigger=Event.ADMIN_SYNC_COMPLETED)
Expand Down

0 comments on commit bb13be4

Please sign in to comment.