Skip to content

Commit 852bf50

Browse files
committed
initial scaffold
0 parents  commit 852bf50

File tree

222 files changed

+50596
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+50596
-0
lines changed

.env.example

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# ==============================================================================
2+
# MEMORY TRACKER - DOCKER ENVIRONMENT CONFIGURATION
3+
# ==============================================================================
4+
# This file provides example environment variables for running the Memory Tracker
5+
# application with Docker. Copy this file to .env and update the values for your
6+
# deployment.
7+
8+
# ==============================================================================
9+
# DATABASE CONFIGURATION
10+
# ==============================================================================
11+
# Database connection URL - PostgreSQL is used in Docker setup
12+
# Format: postgresql+asyncpg://username:password@host:port/database
13+
DATABASE_URL=postgresql+asyncpg://memory_tracker_user:memory_tracker_password@db:5432/memory_tracker
14+
15+
# PostgreSQL database configuration (used by Docker Compose)
16+
POSTGRES_DB=memory_tracker
17+
POSTGRES_USER=memory_tracker_user
18+
POSTGRES_PASSWORD=memory_tracker_password
19+
20+
# ==============================================================================
21+
# GITHUB OAUTH CONFIGURATION
22+
# ==============================================================================
23+
# GitHub OAuth app credentials for user authentication
24+
# Create a GitHub OAuth app at: https://github.com/settings/applications/new
25+
GITHUB_CLIENT_ID=your_github_client_id_here
26+
GITHUB_CLIENT_SECRET=your_github_client_secret_here
27+
28+
# OAuth redirect URI - update with your domain
29+
OAUTH_REDIRECT_URI=http://localhost:3000/auth/callback
30+
31+
# Secret key for OAuth state parameter - change in production
32+
OAUTH_STATE_SECRET=your-secret-key-change-me-in-production
33+
34+
# ==============================================================================
35+
# ADMIN AUTHENTICATION
36+
# ==============================================================================
37+
# Initial admin username (REQUIRED)
38+
# This user will be created with admin privileges during database initialization
39+
ADMIN_INITIAL_USERNAME=your_github_username
40+
41+
# ==============================================================================
42+
# API SERVER CONFIGURATION
43+
# ==============================================================================
44+
# API server host and port
45+
API_HOST=0.0.0.0
46+
API_PORT=8000
47+
48+
# CORS origins - comma-separated list of allowed origins
49+
CORS_ORIGINS=http://localhost:3000,http://localhost:9002
50+
51+
# ==============================================================================
52+
# FRONTEND CONFIGURATION
53+
# ==============================================================================
54+
# Frontend API base URL - should point to your backend
55+
NEXT_PUBLIC_API_BASE=http://localhost:8000
56+
57+
# ==============================================================================
58+
# WORKER AUTHENTICATION
59+
# ==============================================================================
60+
# Authentication token for worker operations (optional)
61+
# Alternative to using --auth-token command line argument
62+
# Generate using: python backend/scripts/manage_tokens.py create "Worker Name"
63+
MEMORY_TRACKER_TOKEN=your_worker_token_here

.github/workflows/benchmark.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Memory Tracker Benchmark
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
commit_range:
7+
description: 'Commit range to benchmark (e.g., HEAD~10..HEAD)'
8+
required: true
9+
default: 'HEAD~5..HEAD'
10+
binary_id:
11+
description: 'Binary ID to use for benchmarking'
12+
required: true
13+
default: 'default'
14+
environment_id:
15+
description: 'Environment ID'
16+
required: true
17+
default: 'linux-x86_64'
18+
server_url:
19+
description: 'Memory tracker server URL'
20+
required: false
21+
default: 'https://memory.python.org'
22+
cpython_repo:
23+
description: 'CPython repository URL'
24+
required: false
25+
default: 'https://github.com/python/cpython.git'
26+
27+
jobs:
28+
benchmark:
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- name: Checkout memory tracker
33+
uses: actions/checkout@v4
34+
35+
- name: Set up Python
36+
uses: actions/setup-python@v4
37+
with:
38+
python-version: '3.11'
39+
40+
- name: Clone CPython repository
41+
run: |
42+
git clone ${{ github.event.inputs.cpython_repo }} cpython
43+
cd cpython
44+
git fetch --depth=50
45+
46+
- name: Install memory tracker worker
47+
run: |
48+
cd worker
49+
pip install -e .
50+
51+
- name: Install build dependencies
52+
run: |
53+
# Install CPython dependencies using their script
54+
cd cpython
55+
sudo .github/workflows/posix-deps-apt.sh
56+
57+
# Install Memray dependencies
58+
sudo apt-get install -y \
59+
python3-dev \
60+
libdebuginfod-dev \
61+
libunwind-dev \
62+
liblz4-dev
63+
64+
- name: Run memory benchmarks
65+
env:
66+
MEMORY_TRACKER_TOKEN: ${{ secrets.MEMORY_TRACKER_TOKEN }}
67+
run: |
68+
# Build command with preconfigured options
69+
CMD="memory-tracker benchmark ./cpython ${{ github.event.inputs.commit_range }}"
70+
CMD="$CMD --binary-id ${{ github.event.inputs.binary_id }}"
71+
CMD="$CMD --environment-id ${{ github.event.inputs.environment_id }}"
72+
CMD="$CMD --api-base ${{ github.event.inputs.server_url }}"
73+
CMD="$CMD --configure-flags='-C'"
74+
CMD="$CMD --make-flags='-j4'"
75+
CMD="$CMD --output-dir='./benchmark_results'"
76+
CMD="$CMD --force"
77+
CMD="$CMD --local-checkout"
78+
CMD="$CMD -vv"
79+
80+
echo "Running: $CMD"
81+
eval $CMD
82+
83+
- name: Upload benchmark results (if failed)
84+
if: failure()
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: benchmark-logs
88+
path: |
89+
*.log
90+
./benchmark_results/
91+
retention-days: 7
92+
93+
- name: Upload benchmark results (on success)
94+
if: success()
95+
uses: actions/upload-artifact@v4
96+
with:
97+
name: benchmark-results
98+
path: ./benchmark_results/
99+
retention-days: 30

.gitignore

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# Python
4+
__pycache__/
5+
*.py[cod]
6+
*$py.class
7+
*.so
8+
.Python
9+
build/
10+
develop-eggs/
11+
dist/
12+
downloads/
13+
eggs/
14+
.eggs/
15+
backend/lib/
16+
lib64/
17+
parts/
18+
sdist/
19+
var/
20+
wheels/
21+
share/python-wheels/
22+
*.egg-info/
23+
.installed.cfg
24+
*.egg
25+
MANIFEST
26+
.venv/
27+
venv/
28+
ENV/
29+
env/
30+
.env
31+
.env.*
32+
!.env.example
33+
pip-log.txt
34+
pip-delete-this-directory.txt
35+
.tox/
36+
.nox/
37+
.coverage
38+
.coverage.*
39+
.cache
40+
nosetests.xml
41+
coverage.xml
42+
*.cover
43+
*.py,cover
44+
.hypothesis/
45+
.pytest_cache/
46+
cover/
47+
48+
# FastAPI / SQLAlchemy
49+
*.db
50+
*.sqlite
51+
*.sqlite3
52+
database.db
53+
test.db
54+
55+
# IDEs
56+
.vscode/
57+
.idea/
58+
*.swp
59+
*.swo
60+
*~
61+
62+
# OS
63+
.DS_Store
64+
.DS_Store?
65+
._*
66+
.Spotlight-V100
67+
.Trashes
68+
ehthumbs.db
69+
Thumbs.db
70+
71+
# Node.js / Frontend
72+
node_modules/
73+
/.pnp
74+
.pnp.*
75+
.yarn/*
76+
!.yarn/patches
77+
!.yarn/plugins
78+
!.yarn/releases
79+
!.yarn/versions
80+
npm-debug.log*
81+
yarn-debug.log*
82+
yarn-error.log*
83+
.pnpm-debug.log*
84+
85+
# Next.js
86+
/.next/
87+
/out/
88+
next-env.d.ts
89+
*.tsbuildinfo
90+
91+
# Testing
92+
/coverage
93+
.nyc_output
94+
95+
# Production builds
96+
/build
97+
/dist
98+
99+
# Vercel
100+
.vercel
101+
102+
# Logs
103+
*.log
104+
logs/
105+
106+
# Runtime data
107+
pids
108+
*.pid
109+
*.seed
110+
*.pid.lock
111+
112+
# Temporary files
113+
*.tmp
114+
*.temp
115+
.tmp/
116+
.temp/
117+
118+
# Firebase
119+
firebase-debug.log
120+
firestore-debug.log
121+
122+
# Genkit
123+
.genkit/*
124+
125+
# Jupyter Notebook
126+
.ipynb_checkpoints
127+
128+
# pyenv
129+
.python-version
130+
131+
# pipenv
132+
Pipfile.lock
133+
134+
# PEP 582
135+
__pypackages__/
136+
137+
# Celery
138+
celerybeat-schedule
139+
celerybeat.pid
140+
141+
# SageMath parsed files
142+
*.sage.py
143+
144+
# Spyder project settings
145+
.spyderproject
146+
.spyproject
147+
148+
# Rope project settings
149+
.ropeproject
150+
151+
# mkdocs documentation
152+
/site
153+
154+
# mypy
155+
.mypy_cache/
156+
.dmypy.json
157+
dmypy.json
158+
159+
# Pyre type checker
160+
.pyre/
161+
162+
# pytype static type analyzer
163+
.pytype/
164+
165+
# Cython debug symbols
166+
cython_debug/
167+
168+
#Nextjs stuff
169+
frontend/*.next

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) [year] [fullname]
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)