astronomy-commons / adc-streaming

Core Python(ic) client libraries and utilities for alert streaming
BSD 3-Clause "New" or "Revised" License
6 stars 6 forks source link

Remove HEARTBEAT_SENTINEL #22

Closed spenczar closed 4 years ago

spenczar commented 4 years ago

The HEARTBEAT_SENTINEL logic doesn't really do anything right now. It all happens in pure-python, and doesn't reflect any health state about the Kafka broker. I think it can be removed entirely.

mjuric commented 4 years ago

This gets used to provide a way to update progress bars and alike.

The logic is as follows:

Maybe a better subject for this Issue would be to restore progress bar functionality?

spenczar commented 4 years ago

I'd like to design a better progress bar API than calling tqdm directly. This feels like the wrong direction for the dependency to flow - we make a lot of assumptions by directly calling tqdm. The caller could provide us with something that we should update with progress information; that could be done with something other than the heartbeat-through-the-iterator design here, maybe?

That's based on my understanding that this library is relatively low-level. The caller will be other code like SCiMMA's hop - that would be the place where tqdm would be chosen.

spenczar commented 4 years ago

I should add - thanks a lot for the walkthrough! I think step 1 is still to remove the heartbeat, and then step 2 is to redesign progress bar stuff, possibly adding heartbeats back in (but hopefully not?).

mjuric commented 4 years ago

Sounds good. The progress API does need to be generalized -- the tqdm stuff was an expedient hack (so was the shameful hardcoding of many constants -- e.g., 1 second for timeout in c.consume(...), etc.).

That said, making it easy to show progress makes for a world of difference in usability (even for a relatively low-level library). We should brainstorm how to get a good generalized equivalent of for msg in stream(progress=True): ..., but there should be one.

spenczar commented 4 years ago

This was done in the v1.0.0 release.