or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

index.mdjob-management.mdmanagement-commands.mdmonitoring-integration.mdqueue-operations.mdscheduling.mdweb-dashboard.md

web-dashboard.mddocs/

0

# Web Dashboard

1

2

Web-based monitoring interface for queues, jobs, workers, and statistics with Django admin integration. Provides a comprehensive dashboard for managing and monitoring RQ operations.

3

4

## Capabilities

5

6

### URL Configuration

7

8

Include Django-RQ URLs in your Django application.

9

10

```python { .api }

11

# urls.py

12

from django.urls import path, include

13

14

urlpatterns = [

15

path('django-rq/', include('django_rq.urls')),

16

# other URL patterns...

17

]

18

```

19

20

### Main Dashboard Views

21

22

Core views for monitoring queue status and operations.

23

24

```python { .api }

25

def stats(request):

26

"""

27

Main statistics dashboard showing overview of all queues.

28

29

Displays:

30

- Queue status and job counts

31

- Worker information

32

- Failed job summaries

33

- Scheduler status

34

35

URL: /django-rq/

36

"""

37

38

def stats_json(request, token=None):

39

"""

40

JSON API endpoint for statistics data.

41

42

Args:

43

token: Optional API token for authentication

44

45

Returns:

46

JsonResponse: Queue statistics in JSON format

47

48

URL: /django-rq/stats.json

49

"""

50

```

51

52

### Queue Management Views

53

54

Views for managing individual queues and their jobs.

55

56

```python { .api }

57

def jobs(request, queue_index):

58

"""

59

List queued jobs for a specific queue.

60

61

Args:

62

queue_index: Index of queue in QUEUES_LIST

63

64

Features:

65

- Pagination (100 jobs per page)

66

- Job details and metadata

67

- Bulk actions (delete, requeue)

68

69

URL: /django-rq/queues/{queue_index}/

70

"""

71

72

def finished_jobs(request, queue_index):

73

"""

74

List completed jobs for a specific queue.

75

76

Features:

77

- Sortable by completion time

78

- Job result inspection

79

- Pagination support

80

81

URL: /django-rq/queues/{queue_index}/finished/

82

"""

83

84

def failed_jobs(request, queue_index):

85

"""

86

List failed jobs for a specific queue.

87

88

Features:

89

- Error details and stack traces

90

- Requeue functionality

91

- Bulk operations

92

93

URL: /django-rq/queues/{queue_index}/failed/

94

"""

95

96

def scheduled_jobs(request, queue_index):

97

"""

98

List scheduled jobs for a specific queue.

99

100

Features:

101

- Next execution time

102

- Schedule information

103

- Manual triggering

104

105

URL: /django-rq/queues/{queue_index}/scheduled/

106

"""

107

108

def started_jobs(request, queue_index):

109

"""

110

List currently running jobs for a specific queue.

111

112

Features:

113

- Job progress information

114

- Worker assignment

115

- Stop job functionality

116

117

URL: /django-rq/queues/{queue_index}/started/

118

"""

119

120

def deferred_jobs(request, queue_index):

121

"""

122

List deferred jobs for a specific queue.

123

124

Features:

125

- Dependency information

126

- Manual enqueueing

127

- Dependency resolution

128

129

URL: /django-rq/queues/{queue_index}/deferred/

130

"""

131

```

132

133

### Job Detail Views

134

135

Views for individual job management and inspection.

136

137

```python { .api }

138

def job_detail(request, queue_index, job_id):

139

"""

140

Detailed view of a specific job.

141

142

Args:

143

queue_index: Index of queue

144

job_id: Unique job identifier

145

146

Features:

147

- Job metadata and arguments

148

- Execution results

149

- Error information

150

- Dependency graph

151

152

URL: /django-rq/queues/{queue_index}/{job_id}/

153

"""

154

155

def delete_job(request, queue_index, job_id):

156

"""

157

Delete a specific job.

158

159

Features:

160

- Confirmation dialog

161

- Remove from queue and registries

162

- Cascade delete for dependent jobs

163

164

URL: /django-rq/queues/{queue_index}/{job_id}/delete/

165

"""

166

167

def requeue_job_view(request, queue_index, job_id):

168

"""

169

Requeue a failed or finished job.

170

171

Features:

172

- Preserve original arguments

173

- Reset job status

174

- Update metadata

175

176

URL: /django-rq/queues/{queue_index}/{job_id}/requeue/

177

"""

178

179

def stop_job(request, queue_index, job_id):

180

"""

181

Stop a currently running job.

182

183

Features:

184

- Send stop signal to worker

185

- Update job status

186

- Handle graceful shutdown

187

188

URL: /django-rq/queues/{queue_index}/{job_id}/stop/

189

"""

190

```

191

192

### Worker Management Views

193

194

Views for monitoring and managing workers.

195

196

```python { .api }

197

def workers(request, queue_index):

198

"""

199

List workers for a specific queue.

200

201

Features:

202

- Worker status and statistics

203

- Current job information

204

- Performance metrics

205

206

URL: /django-rq/workers/{queue_index}/

207

"""

208

209

def worker_details(request, queue_index, key):

210

"""

211

Detailed view of a specific worker.

212

213

Args:

214

queue_index: Index of queue

215

key: Worker key identifier

216

217

Features:

218

- Worker statistics

219

- Job history

220

- Performance metrics

221

- Current job details

222

223

URL: /django-rq/workers/{queue_index}/{key}/

224

"""

225

```

226

227

### Bulk Operations

228

229

Views for performing bulk operations on jobs.

230

231

```python { .api }

232

def clear_queue(request, queue_index):

233

"""

234

Clear all jobs from a queue.

235

236

Features:

237

- Confirmation dialog

238

- Bulk job deletion

239

- Queue statistics update

240

241

URL: /django-rq/queues/{queue_index}/empty/

242

"""

243

244

def requeue_all(request, queue_index):

245

"""

246

Requeue all failed jobs in a queue.

247

248

Features:

249

- Batch requeue operation

250

- Progress tracking

251

- Error handling

252

253

URL: /django-rq/queues/{queue_index}/requeue-all/

254

"""

255

256

def delete_failed_jobs(request, queue_index):

257

"""

258

Delete all failed jobs from a queue.

259

260

Features:

261

- Bulk deletion

262

- Confirmation dialog

263

- Statistics update

264

265

URL: /django-rq/queues/{queue_index}/failed/clear/

266

"""

267

268

def actions(request, queue_index):

269

"""

270

Process bulk actions on selected jobs.

271

272

Supported actions:

273

- Delete multiple jobs

274

- Requeue multiple jobs

275

- Stop multiple running jobs

276

277

URL: /django-rq/queues/actions/{queue_index}/

278

"""

279

```

280

281

## Django Admin Integration

282

283

### Admin Configuration

284

285

Enable Django admin integration for RQ management.

286

287

```python { .api }

288

# settings.py

289

RQ_SHOW_ADMIN_LINK = True # Show RQ link in Django admin

290

291

# Admin class for queue management

292

class QueueAdmin:

293

"""

294

Django admin integration for RQ queue management.

295

296

Features:

297

- Read-only queue listing

298

- Direct link to RQ dashboard

299

- Permission-based access control

300

"""

301

302

def has_add_permission(self, request):

303

return False # Prevent creating queues via admin

304

305

def changelist_view(self, request, extra_context=None):

306

# Proxy to RQ stats view

307

return stats_views.stats(request)

308

```

309

310

### Permission System

311

312

Control access to RQ dashboard through Django's permission system.

313

314

```python

315

# Required permissions

316

- django_rq.view_queue: Access to RQ dashboard

317

- is_staff: Required for all RQ views

318

- API token: Alternative authentication for API endpoints

319

```

320

321

## API Endpoints

322

323

### Statistics API

324

325

JSON endpoints for programmatic access to queue statistics.

326

327

```python { .api }

328

def stats_json(request, token=None):

329

"""

330

Get queue statistics in JSON format.

331

332

Authentication:

333

- Django staff user session

334

- Bearer token in Authorization header

335

- URL token parameter (deprecated)

336

337

Response format:

338

{

339

"queues": [

340

{

341

"name": "default",

342

"jobs": 0,

343

"workers": 1,

344

"finished_jobs": 10,

345

"failed_jobs": 2,

346

"started_jobs": 0,

347

"deferred_jobs": 0,

348

"scheduled_jobs": 5

349

}

350

]

351

}

352

"""

353

```

354

355

### Authentication

356

357

API endpoints support multiple authentication methods:

358

359

```python

360

# Bearer token authentication

361

headers = {

362

'Authorization': f'Bearer {api_token}'

363

}

364

365

# Session authentication (for logged-in users)

366

# Automatic when accessing via browser

367

368

# URL token (deprecated)

369

# /django-rq/stats.json/your-token-here/

370

```

371

372

## Dashboard Features

373

374

### Real-time Updates

375

376

The dashboard provides real-time monitoring capabilities:

377

378

- Auto-refreshing statistics

379

- Live job status updates

380

- Worker health monitoring

381

- Queue depth tracking

382

383

### Search and Filtering

384

385

Advanced search and filtering options:

386

387

- Filter jobs by status

388

- Search by job function name

389

- Filter by date ranges

390

- Sort by various criteria

391

392

### Responsive Design

393

394

Mobile-friendly interface with:

395

396

- Responsive layouts

397

- Touch-friendly controls

398

- Optimized for various screen sizes

399

- Progressive enhancement

400

401

## Configuration Options

402

403

### Dashboard Settings

404

405

Configure dashboard behavior through Django settings:

406

407

```python

408

# settings.py

409

RQ_SHOW_ADMIN_LINK = True # Show admin link

410

RQ_API_TOKEN = 'your-secret-token' # API access token

411

412

# Custom templates

413

TEMPLATES = [

414

{

415

'DIRS': ['templates/'], # Override RQ templates

416

# ... other template settings

417

}

418

]

419

```

420

421

### Template Customization

422

423

Override default templates for custom styling:

424

425

```

426

templates/

427

└── django_rq/

428

├── base.html # Base template

429

├── stats.html # Main dashboard

430

├── jobs.html # Job listings

431

├── job_detail.html # Job details

432

└── workers.html # Worker listings

433

```

434

435

### URL Customization

436

437

Customize URL patterns for the dashboard:

438

439

```python

440

# Custom URL configuration

441

from django_rq import views, stats_views

442

443

custom_patterns = [

444

path('rq/', stats_views.stats, name='rq_home'),

445

path('rq/api/', stats_views.stats_json, name='rq_api'),

446

# ... other custom patterns

447

]

448

```

449

450

## Security Considerations

451

452

- All views require staff permissions

453

- CSRF protection enabled for form submissions

454

- API token authentication for automated access

455

- Rate limiting recommended for production use

456

- Secure Redis connections in production environments