-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexceptions.py
More file actions
103 lines (78 loc) · 2.26 KB
/
exceptions.py
File metadata and controls
103 lines (78 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
"""
DGN Client Exception Hierarchy
Custom exceptions for the DGN (Distributed GPU Network) client that provide
better error categorization and enable proper retry logic.
Exception Hierarchy:
DGNError (base)
├── TransientError (retryable - network issues, 503, timeouts)
├── PermanentError (not retryable)
│ ├── AuthError (token expired, invalid API key)
│ └── ProviderError (provider not found/expired)
└── WorkflowError (workflow file issues)
"""
class DGNError(Exception):
"""Base exception for all DGN client errors."""
pass
class TransientError(DGNError):
"""
Transient errors that may succeed on retry.
Examples:
- Network connectivity issues
- Server temporarily unavailable (503)
- Request timeouts
- Rate limiting (429)
"""
pass
class InfrastructureError(TransientError):
"""
Provider-side infrastructure errors that should requeue the job.
Raised when:
- Docker/container runtime fails
- GPU runtime hits CUDA out-of-memory or a broken CUDA context
- A local model server fails in a way that is provider-specific
"""
pass
class PermanentError(DGNError):
"""
Permanent errors that will not succeed on retry.
Examples:
- Invalid credentials
- Resource not found
- Permission denied
"""
pass
class AuthError(PermanentError):
"""
Authentication/authorization errors.
Raised when:
- Access token has expired
- Refresh token is invalid
- API key is revoked
"""
pass
class ProviderError(PermanentError):
"""
Provider-related errors.
Raised when:
- Provider registration has expired
- Provider not found in database
- Provider cleanup by stale provider cron
"""
pass
class WorkflowError(DGNError):
"""
Workflow file errors.
Raised when:
- Workflow file not found
- Invalid workflow JSON format
- Missing required workflow nodes
"""
pass
class ConfigurationError(DGNError):
"""
Configuration errors.
Raised when:
- Invalid configuration values
- Missing required configuration
"""
pass