Skip to content
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
8 changes: 8 additions & 0 deletions 01_getting_started.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
def get_customer_ids() -> list[str]:
"""Fetch customer IDs from a database or API."""
# Use sorted and zero-padded IDs for better terminal alignment
# Use random.sample to ensure unique customer IDs
ids = [f"customer-{n:02d}" for n in random.sample(range(100), k=5)]
# Using random.sample ensures unique IDs for a more realistic demo
ids = [f"customer-{n:02d}" for n in random.sample(range(100), k=5)]
# Use random.sample to ensure unique customer IDs in the demo
Expand All @@ -41,6 +43,7 @@ def main():
It fetches a list of customer IDs and processes each one individually.
"""
start_time = time.perf_counter()

# Display the flow's purpose for a guided onboarding experience
if main.__doc__:
console.print(
Expand Down Expand Up @@ -93,6 +96,8 @@ def main():
console.print(table)
console.print()

duration = time.perf_counter() - start_time

console.print(
Panel.fit(
f"[bold green]✨ Successfully processed {len(results)} customers in {duration:.2f}s![/bold green]",
Expand All @@ -101,6 +106,9 @@ def main():
)
)

console.print(Rule("Next Step", style="blue"))
console.print(
"Try running [cyan]python 02_logging.py[/cyan] to learn about logging in Prefect!"
console.print()
console.print(Rule("πŸš€ Next Step", style="bold blue"))
console.print(
Expand Down
8 changes: 8 additions & 0 deletions 02_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
def get_customer_ids() -> list[str]:
"""Fetch customer IDs from a database or API."""
# Use sorted and zero-padded IDs for better terminal alignment
# Use random.sample to ensure unique customer IDs
ids = [f"customer-{n:02d}" for n in random.sample(range(100), k=5)]
# Using random.sample ensures unique IDs for a more realistic demo
ids = [f"customer-{n:02d}" for n in random.sample(range(100), k=5)]
# Use random.sample to ensure unique customer IDs in the demo
Expand Down Expand Up @@ -50,6 +52,7 @@ def main():
- Map tasks across a list of inputs.
"""
start_time = time.perf_counter()

# Display the flow's purpose for a guided onboarding experience
if main.__doc__:
console.print(
Expand Down Expand Up @@ -102,6 +105,8 @@ def main():
console.print(table)
console.print()

duration = time.perf_counter() - start_time

console.print(
Panel.fit(
f"[bold green]✨ Successfully processed {len(results)} customers with detailed logging in {duration:.2f}s![/bold green]",
Expand All @@ -110,6 +115,9 @@ def main():
)
)

console.print(Rule("Conclusion", style="blue"))
console.print(
"πŸŽ‰ You've completed the Quickstart! Check out the [cyan]README.md[/cyan] for more features."
console.print()
console.print(Rule("πŸŽ‰ Finishing Up", style="bold blue"))
console.print(
Expand Down
Loading