Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicate logs in run_simulation #3354

Merged
merged 17 commits into from
Apr 30, 2024
Merged

Fix duplicate logs in run_simulation #3354

merged 17 commits into from
Apr 30, 2024

Conversation

chongshenng
Copy link
Contributor

@chongshenng chongshenng commented Apr 29, 2024

Issue

Description

When executing run_simulation in Google Colab, duplicate logs appear in the output.

Current behaviour:

INFO :      Flower ECE: Starting Driver API (gRPC-rere) on 0.0.0.0:9091
INFO:flwr:Flower ECE: Starting Driver API (gRPC-rere) on 0.0.0.0:9091
INFO :      Starting Flower ServerApp, config: num_rounds=3, no round_timeout
INFO:flwr:Starting Flower ServerApp, config: num_rounds=3, no round_timeout
INFO :      Registered 10 nodes
INFO:flwr:Registered 10 nodes
INFO :      
INFO:flwr:
INFO :      Supported backends: ['ray']
INFO:flwr:Supported backends: ['ray']
INFO :      Initialising: RayBackend
INFO:flwr:Initialising: RayBackend
INFO :      Backend config: {'client_resources': None}
INFO:flwr:Backend config: {'client_resources': None}
INFO :      [INIT]
INFO:flwr:[INIT]
INFO :      Using initial global parameters provided by strategy
INFO:flwr:Using initial global parameters provided by strategy
INFO :      Evaluating initial global parameters
INFO:flwr:Evaluating initial global parameters
INFO :      
INFO:flwr:
INFO :      [ROUND 1]
INFO:flwr:[ROUND 1]

This behaviour is unintended.

This behaviour is also not observed when running local notebooks in VSCode or JupyterLab.

Related issues/PRs

N/A

Proposal

Explanation

Set logger.propagate = False when an asyncio event is detected. This allows only the child logger to print the message and not the parent logger. See this SO thread.

With fix:

INFO :      Flower ECE: Starting Driver API (gRPC-rere) on 0.0.0.0:9091
INFO :      Starting Flower ServerApp, config: num_rounds=3, no round_timeout
INFO :      
INFO :      Registered 10 nodes
INFO :      Supported backends: ['ray']
INFO :      [INIT]
INFO :      Using initial global parameters provided by strategy
INFO :      Evaluating initial global parameters
INFO :      
INFO :      [ROUND 1]
INFO :      Initialising: RayBackend
INFO :      Backend config: {'client_resources': None}
2024-04-29 11:54:21,628	WARNING worker.py:1419 -- SIGTERM handler is not set because current thread is not the main thread.
INFO :      DriverServicer.CreateRun
INFO :      configure_fit: strategy sampled 3 clients (out of 10)

Checklist

  • Implement proposed change
  • [ ] Write tests
  • [ ] Update documentation
  • Update the changelog entry below
  • Make CI checks pass

Changelog entry

Any other comments?

@chongshenng chongshenng marked this pull request as ready for review April 29, 2024 13:22
@chongshenng chongshenng marked this pull request as draft April 29, 2024 14:35
@chongshenng chongshenng marked this pull request as ready for review April 29, 2024 15:37
@jafermarq jafermarq enabled auto-merge (squash) April 29, 2024 17:34
jafermarq
jafermarq previously approved these changes Apr 29, 2024
Copy link
Contributor

@jafermarq jafermarq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is gold!

@jafermarq jafermarq merged commit bf9358f into main Apr 30, 2024
28 checks passed
@jafermarq jafermarq deleted the fix-duplicate-logs branch April 30, 2024 09:56
mohammadnaseri pushed a commit that referenced this pull request May 2, 2024
Co-authored-by: jafermarq <javier@flower.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants