Skip to content

Commit b1d6ede

Browse files
committed
docs
1 parent 6c5fdb3 commit b1d6ede

File tree

6 files changed

+68
-3
lines changed

6 files changed

+68
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ It is similar to [RQ](https://github.com/rq/rq) and heavily inspired by [ARQ](ht
77

88
SAQ optionally comes with a simple UI for monitor workers and jobs.
99

10-
<img src="web.png" alt="SAQ Web UI" style="width:100%;"/>
10+
<img src="docs/web.png" alt="SAQ Web UI" style="width:100%;"/>
1111

1212
## Install
1313
```

docs/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
},
5252
]
5353

54+
myst_enable_extensions = [
55+
"fieldlist"
56+
]
5457

5558
# -- Options for HTML output -------------------------------------------------
5659
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

docs/getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ await queue.enqueue("test", a=1, scheduled=time.time() + 10)
118118
Start the worker
119119

120120
```nasm
121-
python -m saq examples.simple.settings --web
121+
saq examples.simple.settings --web
122122
```
123123

124124
Navigate to the [web ui](http://localhost:8080])

docs/index.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
:hidden:
55
66
getting_started
7+
monitoring
78
comparison
89
benchmarks
910
apidocs/index
@@ -17,7 +18,11 @@ It is similar to [RQ](https://github.com/rq/rq) and heavily inspired by [ARQ](ht
1718

1819
SAQ optionally comes with a simple UI for monitor workers and jobs:
1920

20-
<img src="web.png" alt="SAQ Web UI" style="width:100%;"/>
21+
```{figure-md}
22+
![SAQ Web UI](web.png){width=100%}
23+
24+
SAQ Web UI
25+
```
2126

2227
# Indices and tables
2328

docs/monitoring.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Monitoring
2+
3+
SAQ comes with a simple UI for monitor workers and jobs:
4+
5+
```{figure-md}
6+
![SAQ Web UI](web.png){width=100%}
7+
8+
SAQ Web UI
9+
```
10+
11+
## Part of worker process
12+
13+
You can run it as part of the worker process:
14+
```nasm
15+
saq examples.simple.settings --web
16+
```
17+
which wil serve it on port 8080 by default. You can specify a custom port by adding `--port <portnum>`. e.g.:
18+
```nasm
19+
saq examples.simple.settings --web --port 7000
20+
```
21+
22+
## Mounted in your own web service
23+
You can also mount the Web UI as part of your own web service
24+
25+
### Starlette/FastAPI
26+
Module `saq.web.starlette` contains a starlette instance for use in anything that is derived from Starlette.
27+
28+
**Starlette**
29+
```python
30+
from saq.web.starlette import saq_web
31+
from starlette.routing import Mount
32+
33+
routes = [
34+
...
35+
Mount("/monitor", saq_web("/monitor", queues=all_the_queues_list))
36+
]
37+
```
38+
39+
**FastAPI**
40+
```python
41+
from fastapi import FastAPI
42+
from saq.web.starlette import saq_web
43+
44+
app = FastAPI()
45+
46+
app.mount("/monitor", saq_web("/monitor", queues=all_the_queues_list))
47+
```
48+
49+
50+
```{py:function} saq_web(root_path: str, queues: list[Queue]) -> Starlette:
51+
52+
Create an embeddable monitoring Web UI
53+
54+
:param str root_path: The absolute mount point
55+
:param list[Queue] queue: The list of known queues
56+
:rtype: Starlette
57+
```
File renamed without changes.

0 commit comments

Comments
 (0)