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 off by one enumeration #98

Merged
merged 2 commits into from
Mar 21, 2024
Merged
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
7 changes: 4 additions & 3 deletions burr/tracking/server/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async def list_projects(self, request: fastapi.Request) -> Sequence[schema.Proje
)
return out

async def get_max_sequence_id(self, file_path: str) -> int:
async def get_number_of_steps(self, file_path: str) -> int:
"""Quick tool to get the latest sequence ID from a log file.
This is not efficient and should be replaced."""
count = 0
Expand All @@ -105,7 +105,8 @@ async def get_max_sequence_id(self, file_path: str) -> int:
line_data = json.loads(line)
if "sequence_id" in line_data:
# Just return the latest for now
return line_data["sequence_id"]
# We add one as it is the count, not the index
return line_data["sequence_id"] + 1
return count

async def list_apps(
Expand Down Expand Up @@ -136,7 +137,7 @@ async def list_apps(
partition_key=metadata.partition_key,
first_written=await aiofilesos.path.getctime(full_path),
last_written=await aiofilesos.path.getmtime(full_path),
num_steps=await self.get_max_sequence_id(log_path),
num_steps=await self.get_number_of_steps(log_path),
tags={},
)
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "burr"
version = "0.10.0"
version = "0.10.1"
dependencies = [] # yes, there are none
requires-python = ">=3.9"
authors = [
Expand Down
Loading