Skip to content

Commit

Permalink
Define lag as int (#196)
Browse files Browse the repository at this point in the history
* Closes #195

* Bump to 8.2

* Ruff formating
  • Loading branch information
JulienPeloton authored Jun 4, 2024
1 parent 2a9a2e2 commit 0739d83
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fink_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = "8.1"
__version__ = "8.2"
__schema_version__ = "distribution_schema_fink_ztf_{}.avsc"
10 changes: 6 additions & 4 deletions fink_client/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,21 +371,23 @@ def return_offsets(
offset = "%d" % (partition.offset)

if hi < 0:
lag = "no hwmark" # Unlikely
lag = 0 # Unlikely
elif partition.offset < 0:
# No committed offset, show total message count as lag.
# The actual message count may be lower due to compaction
# and record deletions.
lag = "%d" % (hi - lo)
lag = hi - lo
partition.offset = 0
else:
lag = "%d" % (hi - partition.offset)
lag = hi - partition.offset
#
total_offsets = total_offsets + partition.offset
total_lag = total_lag + int(lag)

if verbose:
if (hide_empty_partition and offset != "-") or (not hide_empty_partition):
if (hide_empty_partition and (offset != "-" or int(lag) > 0)) or (
not hide_empty_partition
):
print(
"%-50s %9s %9s"
% (
Expand Down

0 comments on commit 0739d83

Please sign in to comment.