Skip to content

Feature/set preview limit#19

Open
xtomflo wants to merge 93 commits into
mainfrom
feature/set-preview-limit
Open

Feature/set preview limit#19
xtomflo wants to merge 93 commits into
mainfrom
feature/set-preview-limit

Conversation

@xtomflo

@xtomflo xtomflo commented Apr 1, 2023

Copy link
Copy Markdown
Collaborator

Added the set preview limit, worked as far as I've tested it

Removed redundant call of setup_logger() as it was resulting in triplicated logging output. ie everything that was logged after it, was printed 3 times.

@sungchun12

Copy link
Copy Markdown
Owner

Cool I'll take a deeper look at this on Monday! Thanks for the PR. Love that we're evolving this together :)

Comment thread fst/main.py Outdated
@@ -22,7 +24,6 @@ def start_streamlit() -> None:
subprocess.run(["streamlit", "run", streamlit_app_path])

def start_directory_watcher(path: str, log_queue: multiprocessing.Queue) -> None:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Suggested change
def start_directory_watcher(path: str, log_queue: multiprocessing.Queue) -> None:
def start_directory_watcher(path: str, log_queue: multiprocessing.Queue) -> None:
setup_logger(log_queue)

This is needed or else none of the logs show up.

before

image

after

image

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Show me a screenshot where you're seeing duplicate logs

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

My gut tells me this is a quirk using WSL. See if you can run this on linux using the github codespace.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Which logs do you have in mind?
In the screenshots you're showing different parts of the output in different scenarios, one is failure and one is success.
If it's about 'dbt build' logs (I assume it's this one), then in the second one they're also visible ("Completed successfully").

If it's about the query & build time, they're not visible in case of failure independent of whether 'setup_logger' is added here or not.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Here with the setup_logger() in start_directory_watcher ( duplicated output)
image
image

Here without - current state of the PR:
image

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

That's so interesting. I've never seen the duplicate logs before in my setup. This is affirming my point that something may be going on in WSL

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

double checked in Codespace and the result is similar, instead of triplicating the log output, it's duplicated now (and without the setup_logger() in start_directory_watcher it runs correctly), super weird. I wonder how it's possible that on Mac you don't get the log outputs without the duplicated logging setup.
It's being called already in main() which should be enough for the logs to show up.
Here the screens

image

image

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I'll check on codespaces once you update the code for my review. I wouldn't be surprised if there's a confounding variable in my local setup that's preventing duplicates logs.

Comment thread fst/main.py Outdated
Comment thread fst/main.py Outdated
@sungchun12

Copy link
Copy Markdown
Owner

The preview limit isn't working for me because from fst.config_defaults import CONFIG on L20 is read by the query_handler.py before it can be reset with the --preview-limit flag. I recommend following some general guidance from GPT4 below that'll point you in the right direction.

image

image

@sungchun12 sungchun12 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

See my earlier feedback to refactor this and then I'll review it again!

xtomflo and others added 2 commits April 11, 2023 13:59
Co-authored-by: Sung Won Chung <sungwonchung3@gmail.com>
Co-authored-by: Sung Won Chung <sungwonchung3@gmail.com>
@sungchun12

Copy link
Copy Markdown
Owner

I'm going to hold off on merging this until 4/19 because I want to present a couple wild features to my company on 4/18. I'll give you a shoutout for all your help!

@xtomflo

xtomflo commented Apr 14, 2023

Copy link
Copy Markdown
Collaborator Author

sounds good to me! thanks a lot for the shoutout :) I'm traveling at the moment so out of the working routine but will be back next week to make some more progress. good luck with the presentation!

@xtomflo

xtomflo commented Apr 14, 2023

Copy link
Copy Markdown
Collaborator Author

The preview limit isn't working for me because from fst.config_defaults import CONFIG on L20 is read by the query_handler.py before it can be reset with the --preview-limit flag. I recommend following some general guidance from GPT4 below that'll point you in the right direction.

This is strange as well. It's working on WSL and it's working in Codespaces as well as expected. I'm still updating to your suggestion, it's indeed a bit cleaner

Comment thread fst/config_defaults.py Outdated
Comment thread fst/query_handler.py Outdated
Comment thread fst/query_handler.py Outdated
Comment thread fst/main.py Outdated
@@ -22,7 +24,6 @@ def start_streamlit() -> None:
subprocess.run(["streamlit", "run", streamlit_app_path])

def start_directory_watcher(path: str, log_queue: multiprocessing.Queue) -> None:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I'll check on codespaces once you update the code for my review. I wouldn't be surprised if there's a confounding variable in my local setup that's preventing duplicates logs.

xtomflo added 2 commits April 25, 2023 23:17
- Add `rows_preview_limit` parameter to `start_directory_watcher` function in `main.py`
- Add `rows_preview_limit` parameter to `DynamicQueryHandler` class in `query_handler.py`
- Pass `rows_preview_limit` parameter to `handle_query` function in `query_handler.py`
- Use `rows_preview_limit` parameter instead of `preview_limit_rows` variable in `handle_query` function in `query_handler.py`
@xtomflo

xtomflo commented Apr 26, 2023

Copy link
Copy Markdown
Collaborator Author

Added a bunch of changes and should be ready for review.
The duplicated log outputs should be resolved by a check in setup_logger() for an already existing handler.
rows_preview_limit is passed through to the query handler without setting config variable

@xtomflo
xtomflo requested a review from sungchun12 April 26, 2023 09:28
@sungchun12

Copy link
Copy Markdown
Owner

Lovely! I'll take a look this week and add comments!

@sungchun12

Copy link
Copy Markdown
Owner

Can you show me a screenshot of this working?

I can't get it to work at all with or without the preview flag: fst start fst start --preview-limit 10.

Please resolve the conflicts of the files above listed by Github!

Comment thread fst/db_utils.py

@lru_cache(maxsize=128)
def execute_query(query: str, db_file: str) -> Tuple[List[Tuple[Any]], List[str]]:
def execute_query(query: str, db_file: str, limit:int = 5) -> Tuple[List[Tuple[Any]], List[str]]:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I like this

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.

set the preview limit row setting: ex: 5 rows, 10 rows, 100, etc. any value that's an integer

2 participants