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

Threaded telemetry #436

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Turning your comment into a thread:

TBH, it's hard for me to exactly explain the problem. All I can say: I can't reproduce it at home, but I regularly encounter the problem on the train, probably during the moments where the mobile connection is slow / lost. So my mac still "sees" a connection, but can't reach then endpoint. And the process is always the same:

  • I'm working on the code
  • Suddenly, stuff does not execute anymore
  • I think I broke something and start debugging
  • A few mins later, I realize: connection problems.
  • I simply disable WIFI and execution works again.

So the problem is not telemetry itself but some of our code parts that are blocking. I can try to reproduce and figure out next time I'm on the train and run into the problem.

But regardless of whether we keep the threading approach or not, we can still leverage some of the improvements of this PR, i.e. deletion of dead code, lazy telemetry loading, cleanup into small functions, ...

Copy link
Collaborator

Choose a reason for hiding this comment

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

not being able to reproduce and not knowing the exact source of the issue, were you already able to verify the new solution fixes your issue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well, I think it cannot "not" fix the issue since there is no nothing left that could be blocking. At least in principle, the entire execution of the original telemetry.py was in the main thread, so whatever happened there would block the further execution of the baybe code (not talking about the actual telemetry calls but the pure import of the module). This is now all gone.

But we can delay the discussion until I have more evidence, if you prefer

Copy link
Collaborator

Choose a reason for hiding this comment

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

I really dont like this approach coding auf sicht

if you know the issue we can merge without test, based on clearly seeing the cause being fixed in the code

if we dont know the code its not even clear any of the code in this PR addresses anything relevant

Copy link
Collaborator

Choose a reason for hiding this comment

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

Imo, this should be discussed in our meeting instead of here.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `CustomDiscreteParameter` does not allow duplicated rows in `data` anymore
- De-/activating Polars via `BAYBE_DEACTIVATE_POLARS` now requires passing values
compatible with `strtobool`
- Telemetry now runs in a daemon thread

### Fixed
- Rare bug arising from degenerate `SubstanceParameter.comp_df` rows that caused
Expand Down
262 changes: 0 additions & 262 deletions baybe/telemetry.py

This file was deleted.

22 changes: 22 additions & 0 deletions baybe/telemetry/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Telemetry functionality for BayBE.

For more details, see https://emdgroup.github.io/baybe/stable/userguide/envvars.html#telemetry
"""

from baybe.telemetry.api import (
TELEM_LABELS,
VARNAME_TELEMETRY_ENABLED,
VARNAME_TELEMETRY_HOSTNAME,
VARNAME_TELEMETRY_USERNAME,
telemetry_record_recommended_measurement_percentage,
telemetry_record_value,
)

__all__ = [
"TELEM_LABELS",
"VARNAME_TELEMETRY_ENABLED",
"VARNAME_TELEMETRY_HOSTNAME",
"VARNAME_TELEMETRY_USERNAME",
"telemetry_record_recommended_measurement_percentage",
"telemetry_record_value",
]
Loading
Loading