Skip to content

Commit 1e31f82

Browse files
Make telemetry authentication more persistent
- Wait for user input instead of continuing automatically - Prompt for GitHub token with interactive input - Try up to 2 additional times if user tries to skip - Show encouraging messages about community benefit - Test token immediately when entered - Only continue without telemetry after 3 attempts - Update documentation to reflect interactive setup process 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 6896c3d commit 1e31f82

File tree

2 files changed

+89
-41
lines changed

2 files changed

+89
-41
lines changed

docs/src/tutorials/autotune.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -308,30 +308,34 @@ By default, autotune results are shared with the LinearSolve.jl community to hel
308308

309309
### GitHub Authentication for Telemetry
310310

311-
When telemetry is enabled, the system will check for GitHub authentication:
311+
When telemetry is enabled, the system will prompt you to set up GitHub authentication if not already configured:
312312

313313
```julia
314-
# This will show setup instructions if GITHUB_TOKEN not found
314+
# This will prompt for GitHub token setup if GITHUB_TOKEN not found
315315
results = autotune_setup(telemetry = true)
316316
```
317317

318-
**Quick Setup (30 seconds):**
318+
The system will wait for you to create and paste a GitHub token. This helps the community by sharing performance data across different hardware configurations.
319319

320-
1. **Create GitHub Token**: Open [https://github.com/settings/tokens?type=beta](https://github.com/settings/tokens?type=beta)
321-
- Click "Generate new token"
322-
- Name: "LinearSolve Autotune"
323-
- Expiration: 90 days (or longer)
324-
- Repository access: "Public Repositories (read-only)"
325-
- Generate and copy the token
320+
**Interactive Setup:**
321+
The autotune process will show step-by-step instructions and wait for you to:
322+
1. Create a GitHub token at the provided link
323+
2. Paste the token when prompted
324+
3. Proceed with benchmarking and automatic result sharing
326325

327-
2. **Set Environment Variable**:
328-
```bash
329-
export GITHUB_TOKEN=paste_your_token_here
330-
```
331-
332-
3. **Restart Julia** and run autotune again
326+
**Alternative - Pre-setup Environment Variable**:
327+
```bash
328+
export GITHUB_TOKEN=your_token_here
329+
julia
330+
```
333331

334-
That's it! Your results will automatically be shared to help the community.
332+
**Creating the GitHub Token:**
333+
1. Open [https://github.com/settings/tokens?type=beta](https://github.com/settings/tokens?type=beta)
334+
2. Click "Generate new token"
335+
3. Set name: "LinearSolve Autotune"
336+
4. Set expiration: 90 days
337+
5. Repository access: "Public Repositories (read-only)"
338+
6. Generate and copy the token
335339

336340
### Disabling Telemetry
337341

lib/LinearSolveAutotune/src/telemetry.jl

Lines changed: 69 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,76 @@ function setup_github_authentication()
2020
end
2121
end
2222

23-
# No environment variable - provide setup instructions
24-
println()
25-
println("🚀 Help Improve LinearSolve.jl for Everyone!")
26-
println("="^50)
27-
println("Your benchmark results help the community by improving automatic")
28-
println("algorithm selection. Setting up GitHub authentication takes 30 seconds:")
29-
println()
30-
println("📋 Quick Setup (copy & paste these commands):")
31-
println()
32-
println("1️⃣ Create a GitHub token:")
33-
println(" Open: https://github.com/settings/tokens?type=beta")
34-
println(" • Click 'Generate new token'")
35-
println(" • Name: 'LinearSolve Autotune'")
36-
println(" • Expiration: 90 days (or longer)")
37-
println(" • Repository access: 'Public Repositories (read-only)'")
38-
println(" • Click 'Generate token' and copy it")
39-
println()
40-
println("2️⃣ Set the token (paste your token after the =):")
41-
println(" export GITHUB_TOKEN=paste_your_token_here")
42-
println()
43-
println("3️⃣ Restart Julia and run autotune again")
44-
println()
45-
println("That's it! Your results will automatically be shared to help everyone.")
46-
println("="^50)
23+
# No environment variable - provide setup instructions and wait for token
24+
attempts = 0
25+
max_attempts = 3
26+
27+
while attempts < max_attempts
28+
println()
29+
println("🚀 Help Improve LinearSolve.jl for Everyone!")
30+
println("="^50)
31+
println("Your benchmark results help the community by improving automatic")
32+
println("algorithm selection across different hardware configurations.")
33+
println()
34+
println("📋 Quick GitHub Token Setup (takes 30 seconds):")
35+
println()
36+
println("1️⃣ Open: https://github.com/settings/tokens?type=beta")
37+
println("2️⃣ Click 'Generate new token'")
38+
println("3️⃣ Set:")
39+
println(" • Name: 'LinearSolve Autotune'")
40+
println(" • Expiration: 90 days")
41+
println(" • Repository access: 'Public Repositories (read-only)'")
42+
println("4️⃣ Click 'Generate token' and copy it")
43+
println()
44+
45+
print("🔑 Paste your GitHub token here (or press Enter to skip): ")
46+
token = strip(readline())
47+
48+
if !isempty(token)
49+
try
50+
# Test the token
51+
ENV["GITHUB_TOKEN"] = token
52+
auth = GitHub.authenticate(token)
53+
println("✅ Perfect! Authentication successful - your results will help everyone!")
54+
return auth
55+
catch e
56+
println("❌ Token authentication failed: $e")
57+
println("💡 Make sure the token has 'public_repo' or 'Public Repositories' access")
58+
delete!(ENV, "GITHUB_TOKEN")
59+
attempts += 1
60+
if attempts < max_attempts
61+
println("🔄 Let's try again...")
62+
continue
63+
end
64+
end
65+
else
66+
attempts += 1
67+
if attempts < max_attempts
68+
println()
69+
println("⏰ Hold on! This really helps the LinearSolve.jl community.")
70+
println(" Your hardware's benchmark data improves algorithm selection for everyone.")
71+
println(" It only takes 30 seconds and makes LinearSolve.jl better for all users.")
72+
println()
73+
print("🤝 Please help the community - try setting up the token? (y/n): ")
74+
response = strip(lowercase(readline()))
75+
if response == "n" || response == "no"
76+
attempts += 1
77+
if attempts < max_attempts
78+
println("🙏 One more chance - the community really benefits from diverse hardware data!")
79+
continue
80+
end
81+
else
82+
# Reset attempts if they want to try again
83+
attempts = 0
84+
continue
85+
end
86+
end
87+
end
88+
end
89+
4790
println()
48-
println("⏭️ Continuing without telemetry for now (results saved locally)")
91+
println("📊 Okay, continuing without telemetry. Results will be saved locally.")
92+
println("💡 You can always run `export GITHUB_TOKEN=your_token` and restart Julia later.")
4993

5094
return nothing
5195
end

0 commit comments

Comments
 (0)