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

add evaluate time to the progress counter #4722

Merged
merged 1 commit into from
Feb 1, 2025
Merged
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
33 changes: 22 additions & 11 deletions reflex/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,20 +945,16 @@ def get_compilation_time() -> str:

should_compile = self._should_compile()

for route in self._unevaluated_pages:
console.debug(f"Evaluating page: {route}")
self._compile_page(route, save_page=should_compile)
if not should_compile:
for route in self._unevaluated_pages:
console.debug(f"Evaluating page: {route}")
self._compile_page(route, save_page=should_compile)

# Add the optional endpoints (_upload)
self._add_optional_endpoints()
# Add the optional endpoints (_upload)
self._add_optional_endpoints()

if not should_compile:
return

self._validate_var_dependencies()
self._setup_overlay_component()
self._setup_error_boundary()

# Create a progress bar.
progress = Progress(
*Progress.get_default_columns()[:-1],
Expand All @@ -967,16 +963,31 @@ def get_compilation_time() -> str:
)

# try to be somewhat accurate - but still not 100%
adhoc_steps_without_executor = 6
adhoc_steps_without_executor = 7
fixed_pages_within_executor = 5
progress.start()
task = progress.add_task(
f"[{get_compilation_time()}] Compiling:",
total=len(self._pages)
+ (len(self._unevaluated_pages) * 2)
+ fixed_pages_within_executor
+ adhoc_steps_without_executor,
)

for route in self._unevaluated_pages:
console.debug(f"Evaluating page: {route}")
self._compile_page(route, save_page=should_compile)
progress.advance(task)

# Add the optional endpoints (_upload)
self._add_optional_endpoints()

self._validate_var_dependencies()
self._setup_overlay_component()
self._setup_error_boundary()

progress.advance(task)

# Get the env mode.
config = get_config()

Expand Down