Initial setup
This commit is contained in:
40
.gitignore
vendored
Normal file
40
.gitignore
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
||||
.Python
|
||||
venv/
|
||||
env/
|
||||
.venv
|
||||
|
||||
# IDE
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# Secrets
|
||||
.env
|
||||
*.pem
|
||||
*.key
|
||||
secrets/
|
||||
|
||||
# Database
|
||||
*.db
|
||||
*.sqlite3
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
logs/
|
||||
|
||||
# Profiling
|
||||
*.prof
|
||||
*.trace
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Docker
|
||||
.docker/
|
||||
499
README.md
Normal file
499
README.md
Normal file
@@ -0,0 +1,499 @@
|
||||
# Career Progression Repository Schema
|
||||
|
||||
## Overview
|
||||
|
||||
This repository contains an 8-week intensive program focused on Python, MariaDB, and Distributed Systems mastery. The structure is designed to track daily progress, build a portfolio, and prepare for senior-level technical interviews.
|
||||
|
||||
---
|
||||
|
||||
## Repository Structure
|
||||
|
||||
```
|
||||
career-progression-2026/
|
||||
│
|
||||
├── README.md # Overview, goals, and progress tracking
|
||||
├── .gitignore # Python, IDE, secrets, etc.
|
||||
├── LICENSE # MIT or your choice
|
||||
│
|
||||
├── docs/
|
||||
│ ├── syllabus.md # Markdown version of the syllabus
|
||||
│ ├── 8_week_career_progression_syllabus.pdf
|
||||
│ ├── progress-tracker.md # Weekly checkboxes and reflections
|
||||
│ ├── interview-prep/
|
||||
│ │ ├── behavioral-stories.md # STAR method stories
|
||||
│ │ ├── system-design-notes.md # Common patterns and solutions
|
||||
│ │ └── technical-questions.md # LeetCode-style prep
|
||||
│ └── resources/
|
||||
│ ├── reading-list.md # Articles, books, videos
|
||||
│ └── architecture-diagrams/ # Draw.io or Excalidraw files
|
||||
│
|
||||
├── week-01-python-internals/
|
||||
│ ├── README.md # Week overview and daily goals
|
||||
│ ├── day-01-gil/
|
||||
│ │ ├── notes.md # Learning notes
|
||||
│ │ ├── gil_demo.py # CPU-bound comparison
|
||||
│ │ └── interview-questions.md # Practice Q&A
|
||||
│ ├── day-02-asyncio/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── async_scraper.py
|
||||
│ │ └── requirements.txt
|
||||
│ ├── day-03-profiling/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── profiled_scraper.py
|
||||
│ │ └── profiling_results/ # cProfile, viztracer outputs
|
||||
│ ├── day-04-type-hints/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── typed_scraper.py
|
||||
│ │ └── mypy.ini
|
||||
│ ├── day-05-design-patterns/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── scraper_final.py # With context managers, decorators
|
||||
│ │ └── tests/
|
||||
│ └── weekly-retrospective.md # What worked, what didn't
|
||||
│
|
||||
├── week-02-mariadb-mastery/
|
||||
│ ├── README.md
|
||||
│ ├── day-01-innodb/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── docker-compose.yml # MariaDB setup
|
||||
│ │ ├── init.sql # Sample schema
|
||||
│ │ └── transaction_experiments.sql
|
||||
│ ├── day-02-indexing/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── slow_queries.sql
|
||||
│ │ ├── optimized_queries.sql
|
||||
│ │ └── explain_analysis.md # EXPLAIN output analysis
|
||||
│ ├── day-03-composite-indexes/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── composite_index_demo.sql
|
||||
│ │ └── performance_comparison.md
|
||||
│ ├── day-04-mariadb-features/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── json_columns.sql
|
||||
│ │ ├── virtual_columns.sql
|
||||
│ │ └── window_functions.sql
|
||||
│ ├── day-05-schema-design/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── twitter_schema.sql
|
||||
│ │ ├── ecommerce_schema.sql
|
||||
│ │ └── design-decisions.md
|
||||
│ └── weekly-retrospective.md
|
||||
│
|
||||
├── week-03-distributed-systems/
|
||||
│ ├── README.md
|
||||
│ ├── day-01-message-queues/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── docker-compose.yml # RabbitMQ
|
||||
│ │ ├── producer.py
|
||||
│ │ └── consumer.py
|
||||
│ ├── day-02-celery/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── celery_app/
|
||||
│ │ │ ├── __init__.py
|
||||
│ │ │ ├── tasks.py
|
||||
│ │ │ └── config.py
|
||||
│ │ └── docker-compose.yml
|
||||
│ ├── day-03-idempotency/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── outbox_pattern/
|
||||
│ │ │ ├── models.py
|
||||
│ │ │ ├── worker.py
|
||||
│ │ │ └── schema.sql
|
||||
│ │ └── failure-scenarios.md
|
||||
│ ├── day-04-cap-theorem/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── cap_examples.md
|
||||
│ │ └── pacelc_analysis.md
|
||||
│ ├── day-05-rate-limiter/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── rate_limiter.py # Redis-based
|
||||
│ │ ├── tests/
|
||||
│ │ └── system-design.md # Interview answer
|
||||
│ └── weekly-retrospective.md
|
||||
│
|
||||
├── week-04-infrastructure/
|
||||
│ ├── README.md
|
||||
│ ├── day-01-docker/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── Dockerfile
|
||||
│ │ ├── .dockerignore
|
||||
│ │ └── multi-stage-build.md
|
||||
│ ├── day-02-replication/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── docker-compose.yml # Primary-Replica
|
||||
│ │ └── replication-setup.md
|
||||
│ ├── day-03-read-write-split/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── app/
|
||||
│ │ │ ├── db_router.py
|
||||
│ │ │ └── config.py
|
||||
│ │ └── proxysql-config.cnf
|
||||
│ ├── day-04-scaling-strategies/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── partitioning_demo.sql
|
||||
│ │ └── scaling-interview-answers.md
|
||||
│ ├── day-05-docker-compose/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── docker-compose.yml # Full stack
|
||||
│ │ └── architecture-diagram.png
|
||||
│ └── weekly-retrospective.md
|
||||
│
|
||||
├── week-05-observability/
|
||||
│ ├── README.md
|
||||
│ ├── day-01-structured-logging/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── logging_config.py
|
||||
│ │ └── sample_logs.json
|
||||
│ ├── day-02-prometheus/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── instrumented_app/
|
||||
│ │ │ ├── main.py
|
||||
│ │ │ └── metrics.py
|
||||
│ │ └── prometheus.yml
|
||||
│ ├── day-03-grafana/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── dashboards/ # JSON exports
|
||||
│ │ └── dashboard-screenshots/
|
||||
│ ├── day-04-sentry/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── sentry_integration.py
|
||||
│ │ └── error-scenarios.md
|
||||
│ ├── day-05-outage-simulation/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── postmortem.md # STAR format
|
||||
│ │ └── incident-timeline.md
|
||||
│ └── weekly-retrospective.md
|
||||
│
|
||||
├── week-06-security/
|
||||
│ ├── README.md
|
||||
│ ├── day-01-oauth-jwt/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── auth_service/
|
||||
│ │ │ ├── main.py
|
||||
│ │ │ ├── jwt_handler.py
|
||||
│ │ │ └── models.py
|
||||
│ │ └── oauth-flows.md
|
||||
│ ├── day-02-password-hashing/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── auth.py
|
||||
│ │ └── password-comparison.md # bcrypt vs argon2
|
||||
│ ├── day-03-refresh-tokens/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── token_rotation.py
|
||||
│ │ └── security-tests.md
|
||||
│ ├── day-04-sql-injection-secrets/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── sql_injection_examples.md
|
||||
│ │ ├── vault_integration.py
|
||||
│ │ └── .env.example
|
||||
│ ├── day-05-owasp/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── security-audit.md
|
||||
│ │ └── owasp-checklist.md
|
||||
│ └── weekly-retrospective.md
|
||||
│
|
||||
├── week-07-system-design/
|
||||
│ ├── README.md
|
||||
│ ├── day-01-microservices/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── ecommerce-design.md
|
||||
│ │ └── service-boundaries.png
|
||||
│ ├── day-02-grpc/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── protos/
|
||||
│ │ │ └── user_service.proto
|
||||
│ │ ├── server.py
|
||||
│ │ └── client.py
|
||||
│ ├── day-03-refactoring/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── monolith/ # Before
|
||||
│ │ ├── microservices/ # After
|
||||
│ │ │ ├── user-service/
|
||||
│ │ │ └── order-service/
|
||||
│ │ └── migration-strategy.md
|
||||
│ ├── day-04-api-gateway/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── gateway/
|
||||
│ │ │ ├── main.py
|
||||
│ │ │ ├── routing.py
|
||||
│ │ │ └── middleware/
|
||||
│ │ └── architecture.png
|
||||
│ ├── day-05-mock-interviews/
|
||||
│ │ ├── notes.md
|
||||
│ │ ├── design-instagram.md
|
||||
│ │ ├── design-uber.md
|
||||
│ │ ├── design-netflix.md
|
||||
│ │ └── interview-recording-notes.md
|
||||
│ └── weekly-retrospective.md
|
||||
│
|
||||
├── week-08-final-project/
|
||||
│ ├── README.md # Project overview
|
||||
│ ├── architecture/
|
||||
│ │ ├── system-diagram.png
|
||||
│ │ ├── database-schema.sql
|
||||
│ │ └── api-specification.yaml # OpenAPI
|
||||
│ ├── src/
|
||||
│ │ ├── api/
|
||||
│ │ │ ├── main.py
|
||||
│ │ │ ├── routes/
|
||||
│ │ │ ├── models/
|
||||
│ │ │ └── middleware/
|
||||
│ │ ├── workers/
|
||||
│ │ │ ├── celery_app.py
|
||||
│ │ │ └── tasks/
|
||||
│ │ ├── database/
|
||||
│ │ │ ├── migrations/
|
||||
│ │ │ └── seeds/
|
||||
│ │ └── config/
|
||||
│ │ ├── settings.py
|
||||
│ │ └── logging.py
|
||||
│ ├── infrastructure/
|
||||
│ │ ├── docker-compose.yml
|
||||
│ │ ├── Dockerfile
|
||||
│ │ ├── prometheus/
|
||||
│ │ ├── grafana/
|
||||
│ │ └── nginx/
|
||||
│ ├── tests/
|
||||
│ │ ├── unit/
|
||||
│ │ ├── integration/
|
||||
│ │ └── load/
|
||||
│ ├── monitoring/
|
||||
│ │ ├── dashboards/
|
||||
│ │ └── alerts/
|
||||
│ ├── docs/
|
||||
│ │ ├── setup.md
|
||||
│ │ ├── deployment.md
|
||||
│ │ └── troubleshooting.md
|
||||
│ ├── requirements.txt
|
||||
│ ├── pyproject.toml
|
||||
│ └── weekly-retrospective.md
|
||||
│
|
||||
├── portfolio/
|
||||
│ ├── README.md # Portfolio overview for recruiters
|
||||
│ ├── project-showcase.md # Best projects with screenshots
|
||||
│ ├── technical-blog-posts/ # Write-ups of key learnings
|
||||
│ │ ├── gil-deep-dive.md
|
||||
│ │ ├── database-scaling.md
|
||||
│ │ └── microservices-migration.md
|
||||
│ └── resume-bullets.md # Achievement-focused bullets
|
||||
│
|
||||
└── scripts/
|
||||
├── setup.sh # Initial environment setup
|
||||
├── daily-commit.sh # Automated daily commit template
|
||||
└── week-summary.py # Generate weekly progress report
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Key Features
|
||||
|
||||
### 📁 Week-Based Structure
|
||||
Each week is self-contained with daily subdirectories for focused learning and implementation.
|
||||
|
||||
### 📝 Documentation-First
|
||||
Every directory includes:
|
||||
- `README.md` for overview and goals
|
||||
- `notes.md` for learning retention
|
||||
- Interview preparation materials
|
||||
|
||||
### 🔄 Retrospectives
|
||||
Weekly reflection documents to:
|
||||
- Track progress
|
||||
- Identify challenges
|
||||
- Adjust learning strategies
|
||||
|
||||
### 💼 Portfolio Section
|
||||
Ready-to-share materials including:
|
||||
- Project showcases with screenshots
|
||||
- Technical blog posts
|
||||
- Resume-ready achievement bullets
|
||||
|
||||
### 🧪 Tests Included
|
||||
Demonstrates production-ready code practices with unit, integration, and load tests.
|
||||
|
||||
### 🐳 Infrastructure as Code
|
||||
All Docker configurations versioned for reproducibility and easy environment setup.
|
||||
|
||||
### 📊 Interview Prep
|
||||
Dedicated sections for:
|
||||
- Behavioral interviews (STAR method)
|
||||
- Technical interviews (LeetCode-style)
|
||||
- System design practice
|
||||
|
||||
---
|
||||
|
||||
## Suggested `.gitignore`
|
||||
|
||||
```gitignore
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
||||
.Python
|
||||
venv/
|
||||
env/
|
||||
.venv
|
||||
|
||||
# IDE
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# Secrets
|
||||
.env
|
||||
*.pem
|
||||
*.key
|
||||
secrets/
|
||||
|
||||
# Database
|
||||
*.db
|
||||
*.sqlite3
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
logs/
|
||||
|
||||
# Profiling
|
||||
*.prof
|
||||
*.trace
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Docker
|
||||
.docker/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Daily Workflow
|
||||
|
||||
### 1. Start of Day
|
||||
```bash
|
||||
# Create daily branch
|
||||
git checkout -b week-01/day-01
|
||||
|
||||
# Navigate to daily directory
|
||||
cd week-01-python-internals/day-01-gil/
|
||||
```
|
||||
|
||||
### 2. During Learning
|
||||
- Take notes in `notes.md`
|
||||
- Write code with meaningful commits
|
||||
- Document interview questions and answers
|
||||
|
||||
### 3. End of Day
|
||||
```bash
|
||||
# Commit daily work
|
||||
git add .
|
||||
git commit -m "Week 1 Day 1: GIL deep dive and CPU-bound comparison"
|
||||
|
||||
# Merge to main
|
||||
git checkout main
|
||||
git merge week-01/day-01
|
||||
git push origin main
|
||||
```
|
||||
|
||||
### 4. End of Week
|
||||
- Complete `weekly-retrospective.md`
|
||||
- Update `docs/progress-tracker.md`
|
||||
- Review and refactor code
|
||||
|
||||
---
|
||||
|
||||
## Portfolio Building
|
||||
|
||||
### During the Program
|
||||
- Document key learnings in `technical-blog-posts/`
|
||||
- Take screenshots of working projects
|
||||
- Write achievement-focused bullets for resume
|
||||
|
||||
### After Completion
|
||||
- Make repository public on GitHub
|
||||
- Add comprehensive README with project highlights
|
||||
- Link to portfolio in resume and LinkedIn
|
||||
|
||||
---
|
||||
|
||||
## Benefits of This Structure
|
||||
|
||||
✅ **Granular Progress Tracking** — Daily commits show consistent effort
|
||||
✅ **Interview-Ready** — Easy to reference specific projects during interviews
|
||||
✅ **Portfolio-Friendly** — Clean structure for sharing with recruiters
|
||||
✅ **Reproducible** — Anyone can clone and follow along
|
||||
✅ **Scalable** — Easy to add more weeks or topics
|
||||
✅ **Professional** — Demonstrates software engineering best practices
|
||||
|
||||
---
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. **Initialize Repository**
|
||||
```bash
|
||||
git init career-progression-2026
|
||||
cd career-progression-2026
|
||||
```
|
||||
|
||||
2. **Create Directory Structure**
|
||||
```bash
|
||||
# Use the provided setup script
|
||||
bash scripts/setup.sh
|
||||
```
|
||||
|
||||
3. **Start Week 1**
|
||||
```bash
|
||||
cd week-01-python-internals/day-01-gil/
|
||||
# Begin learning and coding!
|
||||
```
|
||||
|
||||
4. **Track Progress**
|
||||
- Update `docs/progress-tracker.md` daily
|
||||
- Commit frequently with descriptive messages
|
||||
- Review weekly retrospectives
|
||||
|
||||
---
|
||||
|
||||
## Success Metrics
|
||||
|
||||
By the end of 8 weeks, you should have:
|
||||
|
||||
- ✅ **40+ days** of documented learning and code
|
||||
- ✅ **8 major projects** demonstrating different skills
|
||||
- ✅ **Portfolio-ready** GitHub repository
|
||||
- ✅ **Interview stories** using STAR method
|
||||
- ✅ **System design** practice for senior roles
|
||||
- ✅ **Technical blog posts** showcasing expertise
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
||||
After completing the 8-week program:
|
||||
|
||||
1. **Apply to positions** with your portfolio repository
|
||||
2. **Continue contributing** to open-source projects
|
||||
3. **Publish blog posts** on Medium or Dev.to
|
||||
4. **Practice interviews** on Pramp or interviewing.io
|
||||
5. **Network** by sharing your learnings on LinkedIn
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
Choose an appropriate license (MIT recommended for portfolio projects).
|
||||
|
||||
---
|
||||
|
||||
## Contact
|
||||
|
||||
Add your contact information and links:
|
||||
- GitHub: [your-username]
|
||||
- LinkedIn: [your-profile]
|
||||
- Email: [your-email]
|
||||
|
||||
---
|
||||
|
||||
**Good luck with your career progression journey! 🚀**
|
||||
@@ -0,0 +1,49 @@
|
||||
### Day 1 — GIL + CPU-bound vs I/O-bound threading
|
||||
|
||||
#### Goals (what "done" means)
|
||||
- [ ] I can explain the GIL in 2–3 sentences and why it impacts **CPU-bound** threading more than **I/O-bound** threading.
|
||||
- [ ] I can choose between threads, processes, and asyncio for a given workload and justify it.
|
||||
- [ ] I have benchmark results (numbers) that demonstrate the above.
|
||||
|
||||
#### Reading (mostly)
|
||||
- [ ] Read: [What Is the Python Global Interpreter Lock (GIL)? (Real Python)](https://realpython.com/python-gil/)
|
||||
- [ ] Write 5 bullets: what the GIL is, what it is *not*, and why it exists.
|
||||
- [ ] Read: [Understanding the Python GIL (PDF)](http://www.dabeaz.com/python/UnderstandingGIL.pdf)
|
||||
- [ ] Write 5 bullets: where threads *do* help, where they don’t, and what "switch interval" means (high level).
|
||||
- [ ] Skim (reference): [concurrent.futures — Python docs](https://docs.python.org/3/library/concurrent.futures.html)
|
||||
- [ ] Note the difference between `ThreadPoolExecutor` vs `ProcessPoolExecutor`.
|
||||
|
||||
#### Hands-on (benchmark + notes)
|
||||
- [ ] Create a benchmark script that compares these variants for a **CPU-bound** function:
|
||||
- [ ] Serial (single process, no threads)
|
||||
- [ ] `ThreadPoolExecutor`
|
||||
- [ ] `ProcessPoolExecutor`
|
||||
- [ ] Use a **repeatable** timing method (pick one):
|
||||
- [ ] `timeit` (preferred for small benchmarks): [timeit — Python docs](https://docs.python.org/3/library/timeit.html)
|
||||
- [ ] or wall-clock timing with `time.perf_counter()` (fine for longer tasks)
|
||||
- [ ] Record results in a small table (example format):
|
||||
- [ ] workload size parameters (so you can reproduce)
|
||||
- [ ] runtime for each approach
|
||||
- [ ] notes on CPU utilization / behavior
|
||||
- [ ] Add an **I/O-bound** comparison:
|
||||
- [ ] Serial loop calling `time.sleep(x)`
|
||||
- [ ] Thread pool version (expect improvement)
|
||||
- [ ] Write "Conclusions" (minimum 6 sentences):
|
||||
- [ ] What happened for CPU-bound?
|
||||
- [ ] What happened for I/O-bound?
|
||||
- [ ] What I would choose in real systems and why
|
||||
|
||||
#### Stretch (optional)
|
||||
- [ ] Skim: [PEP 703 – Making the Global Interpreter Lock Optional in CPython](https://peps.python.org/pep-0703/)
|
||||
- [ ] Write 3 bullets: what changes, tradeoffs, and why it matters.
|
||||
|
||||
#### Deliverables (to commit)
|
||||
- [ ] `notes.md` updated with:
|
||||
- [ ] explanation bullets
|
||||
- [ ] benchmark table
|
||||
- [ ] conclusions
|
||||
- [ ] `benchmark.py` (or similar) added with instructions to run
|
||||
|
||||
#### Suggested commits
|
||||
- [ ] `day01: add GIL notes + benchmark scaffolding`
|
||||
- [ ] `day01: record CPU vs IO benchmark results and conclusions`
|
||||
@@ -0,0 +1,60 @@
|
||||
### Day 2 — asyncio fundamentals (event loop, tasks, gather)
|
||||
|
||||
#### Goals (what "done" means)
|
||||
- [ ] I can explain the event loop + coroutines + tasks in plain language.
|
||||
- [ ] I can write a small asyncio program using `create_task` + `gather`.
|
||||
- [ ] I can add timeouts, cancellation handling, and concurrency limits.
|
||||
|
||||
#### Reading (official first)
|
||||
- [ ] Read (core usage): [Coroutines and Tasks — Python docs](https://docs.python.org/3/library/asyncio-task.html)
|
||||
- [ ] Note what each does: `asyncio.run`, `asyncio.create_task`, `asyncio.gather`, cancellation.
|
||||
- [ ] Read (practical walkthrough): [Python’s asyncio: A Hands-On Walkthrough (Real Python)](https://realpython.com/async-io-python/)
|
||||
- [ ] Write 5 bullets: when asyncio is a good fit, and when it’s not.
|
||||
- [ ] Read (debugging): [Developing with asyncio — Python docs](https://docs.python.org/3/library/asyncio-dev.html#debug-mode)
|
||||
- [ ] Note 2 debugging tips you can reuse later.
|
||||
|
||||
#### Hands-on (build incrementally)
|
||||
1. **Minimal concurrency demo (no external libs)**
|
||||
- [ ] Write `async def worker(i):` that does `await asyncio.sleep(...)` and returns a value
|
||||
- [ ] Run N workers concurrently with `asyncio.gather`
|
||||
- [ ] Print start/end timestamps to show concurrency
|
||||
|
||||
2. **Add concurrency limit**
|
||||
- [ ] Add `asyncio.Semaphore(k)` and wrap the worker body so only `k` run at once
|
||||
- [ ] Demonstrate by running N=50 with k=5 and showing batching behavior
|
||||
|
||||
3. **Add timeouts + error isolation**
|
||||
- [ ] Wrap each worker with `asyncio.wait_for(..., timeout=...)`
|
||||
- [ ] Make some workers intentionally exceed timeout
|
||||
- [ ] Use `gather(..., return_exceptions=True)` and summarize:
|
||||
- [ ] successes
|
||||
- [ ] timeouts
|
||||
- [ ] other exceptions
|
||||
|
||||
4. **Cancellation behavior**
|
||||
- [ ] Trigger cancellation of a running task and confirm you handle `asyncio.CancelledError` cleanly
|
||||
- [ ] Write 3 bullets: what cancellation means and how to design for it
|
||||
|
||||
#### Write-up (in notes)
|
||||
- [ ] "Mental model" section (8–10 bullets):
|
||||
- [ ] coroutine vs task
|
||||
- [ ] scheduling
|
||||
- [ ] awaiting vs creating tasks
|
||||
- [ ] why blocking calls break concurrency
|
||||
- [ ] "Pitfalls" section (at least 5 bullets):
|
||||
- [ ] blocking I/O
|
||||
- [ ] CPU-bound work in asyncio
|
||||
- [ ] forgetting to await
|
||||
- [ ] unhandled exceptions in tasks
|
||||
- [ ] cancellation edge cases
|
||||
|
||||
#### Deliverables (to commit)
|
||||
- [ ] `notes.md` updated with:
|
||||
- [ ] mental model bullets
|
||||
- [ ] code snippets or links to your local scripts
|
||||
- [ ] brief results/observations
|
||||
- [ ] `asyncio_demo.py` (or similar) added with instructions to run
|
||||
|
||||
#### Suggested commits
|
||||
- [ ] `day02: add asyncio notes + minimal gather demo`
|
||||
- [ ] `day02: add semaphore, timeout, and cancellation examples`
|
||||
Reference in New Issue
Block a user