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

WIP: Add replay logging mechanism #802

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

KIRA009
Copy link
Contributor

@KIRA009 KIRA009 commented Jun 25, 2024

What kind of change does this PR introduce?
This PR addresses #757

Summary
It adds logging to database during replay that will then be displayed on the dashboard. The database bloats very quickly because the logs include images, and python objects

Checklist

  • My code follows the style guidelines of OpenAdapt
  • I have performed a self-review of my code
  • If applicable, I have added tests to prove my fix is functional/effective
  • I have linted my code locally prior to submission
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (e.g. README.md, requirements.txt)
  • New and existing unit tests pass locally with my changes

How can your code be run and tested?

Other information

@KIRA009 KIRA009 changed the title Add replay logging mechanism WIP: Add replay logging mechanism Jun 25, 2024
Copy link
Member

@abrichr abrichr left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together @KIRA009 ! It's probably the screenshots that are taking up most of the disk space, right? I think it should be manageable for now.

logs = sa.orm.relationship("ReplayLog", back_populates="replay")


class ReplayLog(db.Base):
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about renaming "Replay" to "Execution" and "ReplayLog" to "ExecutionLog"?

@@ -181,6 +181,26 @@ def __init__(self, **kwargs: dict) -> None:
for key, value in properties.items():
setattr(self, key, value)

def to_log_dict(self) -> dict[str, Any]:
Copy link
Member

@abrichr abrichr Jul 15, 2024

Choose a reason for hiding this comment

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

Why not just use asdict()?

Edit: if the goal is to remove unnecessary properties, what do you think about overriding asdict, calling the super method, then removing the unnecessary keys?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that makes more sense

@KIRA009
Copy link
Contributor Author

KIRA009 commented Jul 23, 2024

@abrichr I have added the segmentation logging for visual replay strategy

@abrichr
Copy link
Member

abrichr commented Jul 24, 2024

Excellent! Can you please share screenshots? 🙏

@KIRA009
Copy link
Contributor Author

KIRA009 commented Jul 24, 2024

newmovie.mov

@abrichr

@abrichr
Copy link
Member

abrichr commented Jul 24, 2024

Thank you @KIRA009. Those images don't look right. If you set DEBUG = True at the top of visual.py and run the strategy again, you will see the images that are generated at each step. These are the images I would expect to see in the dashboard. Please let me know if I can help clarify further!

@KIRA009
Copy link
Contributor Author

KIRA009 commented Jul 24, 2024

@abrichr I see images like these, the replay stops arbitrarily for me though, with the exception
2024-07-25 01:52:21.720 | WARNING | openadapt.strategies.visual:get_next_action_event:253 - exc=ValueError("'Settings gear icon' is not in list")

I am not sure if its because my recording is not great, or my prompt is not good, but this should log any segmentation returned by get_window_segmentation in visual.py

image
image
image

@abrichr
Copy link
Member

abrichr commented Jul 24, 2024

exc=ValueError("'Settings gear icon' is not in list")

This is tracked here: #658

this should log any segmentation returned by get_window_segmentation in visual.py

Those images you pasted are indeed the image I was referring to in my previous comment. However, I don't see them in the video you shared.

@KIRA009
Copy link
Contributor Author

KIRA009 commented Jul 25, 2024

@abrichr here's the video after merging the fix

Screen.Recording.2024-07-25.at.11.52.59.PM.mov

@abrichr
Copy link
Member

abrichr commented Jul 25, 2024

@KIRA009 it looks like the screenshot is blank. Any idea why that is? Which application was open when the screenshot was taken?

@KIRA009
Copy link
Contributor Author

KIRA009 commented Jul 25, 2024

@abrichr it was vs code I believe. You could try this branch on a recording you have and check the results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants