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

Improve Activity History #188

Closed
dostuffthatmatters opened this issue Oct 24, 2023 · 0 comments
Closed

Improve Activity History #188

dostuffthatmatters opened this issue Oct 24, 2023 · 0 comments
Assignees
Labels
scope:ui status:implemented has been implemented in some dev branch

Comments

@dostuffthatmatters
Copy link
Member

dostuffthatmatters commented Oct 24, 2023

Right now, the logic of rendering the activity history is quite complicated and error-prone. Instead of logging the times of starting/stopping certain events (errors, etc.), we should log a datapoint about the current state every minute. I am doing this now, because I heavily simplified the frontend code for 4.1.0 anyways.

# old
class ActivityDatapoint(pydantic.BaseModel):
    """A datapoint of the activity history."""

    local_time: str
    event_label: Literal[
        "start-measurements",
        "stop-measurements",
        "error-occured",
        "errors-resolved",
        "start-core",
        "stop-core",
    ]

# new
class ActivityDatapoint(pydantic.BaseModel):
    """A datapoint of the activity history."""

    local_time: str
    is_measuring: bool = False
    has_errors: bool = False
    is_uploading: bool = False
    camtracker_startups: int = 0
    opus_startups: int = 0
    cli_calls: int = 0

Math when storing one of these datapoints per minute:

  • Filesize per day is 216KB = 150 characters per record * 1440 records per day
  • Filesize per year is 78MB which is fine
  • If we write out the files every 5 minutes, we write about 31MB per day

Writing the data every 5 minutes is enough because on a 24 hour plot, we are barely able to see anything more recent than 5 minutes ago. Nevertheless, we still plot a cell for every minute.

Notice that we have no field core_is_running because that is implied when records are present. Also, we have the new fields is_uploading, camtracker_startups, opus_startups and cli_calls :)

@dostuffthatmatters dostuffthatmatters added status:in-progress is being work on in some dev branch scope:ui labels Oct 24, 2023
@dostuffthatmatters dostuffthatmatters changed the title Simplify Activity History Improve Activity History Oct 24, 2023
dostuffthatmatters added a commit that referenced this issue Oct 24, 2023
Add new activity history component
dostuffthatmatters added a commit that referenced this issue Oct 24, 2023
Replace current activity logs with new ones
dostuffthatmatters added a commit that referenced this issue Oct 24, 2023
Simplify activity history dumping logic
dostuffthatmatters added a commit that referenced this issue Oct 24, 2023
Add all activity properties to interface
dostuffthatmatters added a commit that referenced this issue Oct 24, 2023
Add graceful teardown hook to write out activity logs
@dostuffthatmatters dostuffthatmatters added status:implemented has been implemented in some dev branch and removed status:in-progress is being work on in some dev branch labels Oct 24, 2023
dostuffthatmatters added a commit that referenced this issue Oct 24, 2023
Move graceful teardown hook out of loop
also listen to signal when closing the terminal
@dostuffthatmatters dostuffthatmatters self-assigned this Oct 24, 2023
dostuffthatmatters added a commit that referenced this issue Oct 25, 2023
Move activity history code from utils to interfaces and types
dostuffthatmatters added a commit that referenced this issue Oct 26, 2023
Move activity history code from utils to interfaces and types
dostuffthatmatters added a commit that referenced this issue Oct 26, 2023
Move activity history code from utils to interfaces and types
dostuffthatmatters added a commit that referenced this issue Oct 27, 2023
Render new activity history in UI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:ui status:implemented has been implemented in some dev branch
Projects
None yet
Development

No branches or pull requests

1 participant