hugpy-queue 0.1.1.3__tar.gz → 0.1.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of hugpy-queue might be problematic. Click here for more details.

Files changed (27) hide show
  1. hugpy_queue-0.1.1.4/PKG-INFO +155 -0
  2. hugpy_queue-0.1.1.4/README.md +147 -0
  3. {hugpy_queue-0.1.1.3 → hugpy_queue-0.1.1.4}/pyproject.toml +4 -4
  4. hugpy_queue-0.1.1.4/src/hugpy_queue/__init__.py +1 -0
  5. hugpy_queue-0.1.1.4/src/hugpy_queue.egg-info/PKG-INFO +155 -0
  6. hugpy_queue-0.1.1.4/src/hugpy_queue.egg-info/requires.txt +1 -0
  7. hugpy_queue-0.1.1.3/PKG-INFO +0 -34
  8. hugpy_queue-0.1.1.3/README.md +0 -26
  9. hugpy_queue-0.1.1.3/src/hugpy_queue/__init__.py +0 -1
  10. hugpy_queue-0.1.1.3/src/hugpy_queue.egg-info/PKG-INFO +0 -34
  11. hugpy_queue-0.1.1.3/src/hugpy_queue.egg-info/requires.txt +0 -1
  12. {hugpy_queue-0.1.1.3 → hugpy_queue-0.1.1.4}/setup.cfg +0 -0
  13. {hugpy_queue-0.1.1.3 → hugpy_queue-0.1.1.4}/src/hugpy_queue/__main__.py +0 -0
  14. {hugpy_queue-0.1.1.3 → hugpy_queue-0.1.1.4}/src/hugpy_queue/calls.py +0 -0
  15. {hugpy_queue-0.1.1.3 → hugpy_queue-0.1.1.4}/src/hugpy_queue/cli.py +0 -0
  16. {hugpy_queue-0.1.1.3 → hugpy_queue-0.1.1.4}/src/hugpy_queue/core_sql.py +0 -0
  17. {hugpy_queue-0.1.1.3 → hugpy_queue-0.1.1.4}/src/hugpy_queue/door.py +0 -0
  18. {hugpy_queue-0.1.1.3 → hugpy_queue-0.1.1.4}/src/hugpy_queue/imports/__init__.py +0 -0
  19. {hugpy_queue-0.1.1.3 → hugpy_queue-0.1.1.4}/src/hugpy_queue/imports/constants.py +0 -0
  20. {hugpy_queue-0.1.1.3 → hugpy_queue-0.1.1.4}/src/hugpy_queue/rows.py +0 -0
  21. {hugpy_queue-0.1.1.3 → hugpy_queue-0.1.1.4}/src/hugpy_queue/store.py +0 -0
  22. {hugpy_queue-0.1.1.3 → hugpy_queue-0.1.1.4}/src/hugpy_queue/system/__init__.py +0 -0
  23. {hugpy_queue-0.1.1.3 → hugpy_queue-0.1.1.4}/src/hugpy_queue/system/system.py +0 -0
  24. {hugpy_queue-0.1.1.3 → hugpy_queue-0.1.1.4}/src/hugpy_queue.egg-info/SOURCES.txt +0 -0
  25. {hugpy_queue-0.1.1.3 → hugpy_queue-0.1.1.4}/src/hugpy_queue.egg-info/dependency_links.txt +0 -0
  26. {hugpy_queue-0.1.1.3 → hugpy_queue-0.1.1.4}/src/hugpy_queue.egg-info/entry_points.txt +0 -0
  27. {hugpy_queue-0.1.1.3 → hugpy_queue-0.1.1.4}/src/hugpy_queue.egg-info/top_level.txt +0 -0
@@ -0,0 +1,155 @@
1
+ Metadata-Version: 2.4
2
+ Name: hugpy-queue
3
+ Version: 0.1.1.4
4
+ Summary: The queue of a Hugpy worker: the front door, a record of every call, and the stages each call passes
5
+ Requires-Python: >=3.11
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: hugpy-utilities<0.2,>=0.1.0
8
+
9
+ # hugpy-queue
10
+
11
+ The queue of a Hugpy worker: the front door every request comes in through, a record of every call, and the
12
+ stages each call passes on its way to an answer.
13
+
14
+ A Hugpy worker is made of four parts, each with its own service, account and database:
15
+
16
+ | Part | Package | What it answers |
17
+ |---|---|---|
18
+ | Discovery | `hugpy-discovery` | where a model is stored |
19
+ | Resources | `hugpy-resources` | where a model is loaded |
20
+ | Engines | `hugpy-engine` | what a model is doing and what it needs |
21
+ | Queue | `hugpy-queue` | what a call is and what it has |
22
+
23
+ `hugpy-wrapper` is the bundle that installs all four and connects their databases.
24
+
25
+ ## What it does
26
+
27
+ - **Front door.** It listens on one address and takes every request for the worker. Each request is put on record
28
+ with its method, route, status, time and size.
29
+ - **Calls.** Every `POST` is a call. It gets a row saying what it is and what it has, and one row for each stage
30
+ it passes.
31
+ - **Hand-off.** The call is passed on to `hugpy-resources`, and the reply is passed back to the caller as it
32
+ comes, so a streamed reply still arrives piece by piece.
33
+ - **Health.** `GET /health` answers for the whole worker: the queue under its own name, and the health of the part
34
+ behind it as that part gave it.
35
+
36
+ Who may call is decided by `hugpy-resources`. The queue passes every header on unchanged, and names a caller from
37
+ another machine in `X-Forwarded-For`, so the caller is asked for its key exactly as it would be at that door.
38
+
39
+ ## Install
40
+
41
+ ```sh
42
+ pip install hugpy-queue
43
+ ```
44
+
45
+ Python 3.11 or later. The only dependency is `hugpy-utilities`.
46
+
47
+ To run it as a service of the host (Linux with systemd, as root):
48
+
49
+ ```sh
50
+ sudo hugpy-queue system install
51
+ ```
52
+
53
+ This makes the account `hugpy-queue`, the folder `/var/lib/hugpy/queue`, the database `queue.sqlite3` and the unit
54
+ `hugpy-queue.service`, then starts it. `sudo hugpy-queue system status` shows its state, and
55
+ `sudo hugpy-queue system uninstall` stops and removes the unit; the record and the settings are kept.
56
+
57
+ ## Use
58
+
59
+ Send a call to the door the same way it would be sent to the worker:
60
+
61
+ ```sh
62
+ curl http://127.0.0.1:15203/v1/chat/completions \
63
+ -H 'content-type: application/json' \
64
+ -d '{"model": "MODEL", "messages": [{"role": "user", "content": "hello"}]}'
65
+ ```
66
+
67
+ The reply carries a `queue_id`: the number of the call's row.
68
+
69
+ ### Commands
70
+
71
+ | Command | What it does |
72
+ |---|---|
73
+ | `hugpy-queue serve` | run the front door in the foreground (the service runs this) |
74
+ | `hugpy-queue calls` | the latest calls and the stages each passed |
75
+ | `hugpy-queue door` | what has been asked of the door, by route and status |
76
+ | `hugpy-queue settings` | every setting, its value, and where the database is |
77
+ | `hugpy-queue set NAME VALUE` | save one setting |
78
+ | `sudo hugpy-queue system install \| status \| uninstall` | the service of the host |
79
+ | `sudo hugpy-queue system set NAME VALUE` | save one setting and restart the service on it |
80
+
81
+ ### The queue's own reads
82
+
83
+ These are answered by the queue itself and are not passed on:
84
+
85
+ | Route | What it returns |
86
+ |---|---|
87
+ | `GET /health` | the worker's health: the queue, and the part behind it |
88
+ | `GET /_queue/health` | the queue alone: its version, where it hands calls, how many are in flight |
89
+ | `GET /_queue/calls?limit=N` | the latest calls with their stages (20 by default, 500 at most) |
90
+ | `GET /_queue/door` | requests by method, route and status, with counts and times |
91
+ | `GET /_queue/stages` | the order of stages |
92
+
93
+ Every other request is passed on to `hugpy-resources`.
94
+
95
+ ## Settings
96
+
97
+ | Setting | Default | What it is |
98
+ |---|---|---|
99
+ | `host` | `127.0.0.1` | the address the door listens on |
100
+ | `port` | `15203` | the port the door listens on |
101
+ | `wrapper_url` | `http://127.0.0.1:15202` | where a call is handed: the address of `hugpy-resources` |
102
+
103
+ A saved setting is a row of the `settings` table of the queue's database.
104
+
105
+ Two environment variables say where its data is kept:
106
+
107
+ | Variable | What it sets |
108
+ |---|---|
109
+ | `HUGPY_DATA_DIR` | the data directory shared by the Hugpy tools of a host (the service uses `/var/lib/hugpy`; a person's own default is `~/.local/share/hugpy`) |
110
+ | `HUGPY_QUEUE_STATE` | the queue's own folder (default: `queue` under the data directory) |
111
+
112
+ ## The order of stages
113
+
114
+ A call passes these stages in order. Sorting only predicts; running acts.
115
+
116
+ | No. | Stage | Owner | Phase | What it is |
117
+ |---|---|---|---|---|
118
+ | 10 | `received` | queue | sort | recorded: what it is |
119
+ | 20 | `engine_range` | engine | sort | time-to-processed range from tokens in and out; impossible placements out |
120
+ | 30 | `reap_prediction` | discovery | sort | seconds to place the model on a worker drive |
121
+ | 40 | `evict_prediction` | resources | sort | seconds to make room in memory; finishes the sort |
122
+ | 50 | `turn` | queue | run | this row is next |
123
+ | 60 | `accommodate` | discovery | run | the model placed on a worker drive |
124
+ | 70 | `evict` | resources | run | room made |
125
+ | 80 | `load` | resources | run | the engine loads |
126
+ | 90 | `intake` | engine | run | the engine takes the call |
127
+ | 100 | `done` | queue | run | answered |
128
+ | 110 | `responded` | queue | run | the reply written to the caller |
129
+
130
+ The order is data: it is the `stage_order` table, and `GET /_queue/stages` returns it.
131
+
132
+ ## What is recorded
133
+
134
+ The database is `queue.sqlite3` in the queue's folder. One thread of the queue's own process writes it; nothing else
135
+ does.
136
+
137
+ | Table or view | What it holds |
138
+ |---|---|
139
+ | `calls` | every call: what it is and what it has |
140
+ | `call_stages` | a row for each stage a call passed, with when it started and finished |
141
+ | `call_times` | view: each call with its times |
142
+ | `front_door` | every request at the door |
143
+ | `front_door_hours` | answered reads, counted by hour |
144
+ | `front_door_routes` | view: requests by method, route and status |
145
+ | `stage_order` | the order of stages |
146
+ | `settings` | the saved settings |
147
+
148
+ An answered read keeps its own `front_door` row for two minutes. It is then counted into its hour in
149
+ `front_door_hours` and the row is removed.
150
+
151
+ ## Limits of this release
152
+
153
+ The queue does not sort calls or decide whose turn it is yet. A call is handed to `hugpy-resources` whole, and
154
+ `hugpy-resources` still does stages 20 to 90 itself. That hand-off is on record as one stage row, `handed`, from the
155
+ moment the call is sent until the answer begins. Each stage moves to its owner's door as that door is made.
@@ -0,0 +1,147 @@
1
+ # hugpy-queue
2
+
3
+ The queue of a Hugpy worker: the front door every request comes in through, a record of every call, and the
4
+ stages each call passes on its way to an answer.
5
+
6
+ A Hugpy worker is made of four parts, each with its own service, account and database:
7
+
8
+ | Part | Package | What it answers |
9
+ |---|---|---|
10
+ | Discovery | `hugpy-discovery` | where a model is stored |
11
+ | Resources | `hugpy-resources` | where a model is loaded |
12
+ | Engines | `hugpy-engine` | what a model is doing and what it needs |
13
+ | Queue | `hugpy-queue` | what a call is and what it has |
14
+
15
+ `hugpy-wrapper` is the bundle that installs all four and connects their databases.
16
+
17
+ ## What it does
18
+
19
+ - **Front door.** It listens on one address and takes every request for the worker. Each request is put on record
20
+ with its method, route, status, time and size.
21
+ - **Calls.** Every `POST` is a call. It gets a row saying what it is and what it has, and one row for each stage
22
+ it passes.
23
+ - **Hand-off.** The call is passed on to `hugpy-resources`, and the reply is passed back to the caller as it
24
+ comes, so a streamed reply still arrives piece by piece.
25
+ - **Health.** `GET /health` answers for the whole worker: the queue under its own name, and the health of the part
26
+ behind it as that part gave it.
27
+
28
+ Who may call is decided by `hugpy-resources`. The queue passes every header on unchanged, and names a caller from
29
+ another machine in `X-Forwarded-For`, so the caller is asked for its key exactly as it would be at that door.
30
+
31
+ ## Install
32
+
33
+ ```sh
34
+ pip install hugpy-queue
35
+ ```
36
+
37
+ Python 3.11 or later. The only dependency is `hugpy-utilities`.
38
+
39
+ To run it as a service of the host (Linux with systemd, as root):
40
+
41
+ ```sh
42
+ sudo hugpy-queue system install
43
+ ```
44
+
45
+ This makes the account `hugpy-queue`, the folder `/var/lib/hugpy/queue`, the database `queue.sqlite3` and the unit
46
+ `hugpy-queue.service`, then starts it. `sudo hugpy-queue system status` shows its state, and
47
+ `sudo hugpy-queue system uninstall` stops and removes the unit; the record and the settings are kept.
48
+
49
+ ## Use
50
+
51
+ Send a call to the door the same way it would be sent to the worker:
52
+
53
+ ```sh
54
+ curl http://127.0.0.1:15203/v1/chat/completions \
55
+ -H 'content-type: application/json' \
56
+ -d '{"model": "MODEL", "messages": [{"role": "user", "content": "hello"}]}'
57
+ ```
58
+
59
+ The reply carries a `queue_id`: the number of the call's row.
60
+
61
+ ### Commands
62
+
63
+ | Command | What it does |
64
+ |---|---|
65
+ | `hugpy-queue serve` | run the front door in the foreground (the service runs this) |
66
+ | `hugpy-queue calls` | the latest calls and the stages each passed |
67
+ | `hugpy-queue door` | what has been asked of the door, by route and status |
68
+ | `hugpy-queue settings` | every setting, its value, and where the database is |
69
+ | `hugpy-queue set NAME VALUE` | save one setting |
70
+ | `sudo hugpy-queue system install \| status \| uninstall` | the service of the host |
71
+ | `sudo hugpy-queue system set NAME VALUE` | save one setting and restart the service on it |
72
+
73
+ ### The queue's own reads
74
+
75
+ These are answered by the queue itself and are not passed on:
76
+
77
+ | Route | What it returns |
78
+ |---|---|
79
+ | `GET /health` | the worker's health: the queue, and the part behind it |
80
+ | `GET /_queue/health` | the queue alone: its version, where it hands calls, how many are in flight |
81
+ | `GET /_queue/calls?limit=N` | the latest calls with their stages (20 by default, 500 at most) |
82
+ | `GET /_queue/door` | requests by method, route and status, with counts and times |
83
+ | `GET /_queue/stages` | the order of stages |
84
+
85
+ Every other request is passed on to `hugpy-resources`.
86
+
87
+ ## Settings
88
+
89
+ | Setting | Default | What it is |
90
+ |---|---|---|
91
+ | `host` | `127.0.0.1` | the address the door listens on |
92
+ | `port` | `15203` | the port the door listens on |
93
+ | `wrapper_url` | `http://127.0.0.1:15202` | where a call is handed: the address of `hugpy-resources` |
94
+
95
+ A saved setting is a row of the `settings` table of the queue's database.
96
+
97
+ Two environment variables say where its data is kept:
98
+
99
+ | Variable | What it sets |
100
+ |---|---|
101
+ | `HUGPY_DATA_DIR` | the data directory shared by the Hugpy tools of a host (the service uses `/var/lib/hugpy`; a person's own default is `~/.local/share/hugpy`) |
102
+ | `HUGPY_QUEUE_STATE` | the queue's own folder (default: `queue` under the data directory) |
103
+
104
+ ## The order of stages
105
+
106
+ A call passes these stages in order. Sorting only predicts; running acts.
107
+
108
+ | No. | Stage | Owner | Phase | What it is |
109
+ |---|---|---|---|---|
110
+ | 10 | `received` | queue | sort | recorded: what it is |
111
+ | 20 | `engine_range` | engine | sort | time-to-processed range from tokens in and out; impossible placements out |
112
+ | 30 | `reap_prediction` | discovery | sort | seconds to place the model on a worker drive |
113
+ | 40 | `evict_prediction` | resources | sort | seconds to make room in memory; finishes the sort |
114
+ | 50 | `turn` | queue | run | this row is next |
115
+ | 60 | `accommodate` | discovery | run | the model placed on a worker drive |
116
+ | 70 | `evict` | resources | run | room made |
117
+ | 80 | `load` | resources | run | the engine loads |
118
+ | 90 | `intake` | engine | run | the engine takes the call |
119
+ | 100 | `done` | queue | run | answered |
120
+ | 110 | `responded` | queue | run | the reply written to the caller |
121
+
122
+ The order is data: it is the `stage_order` table, and `GET /_queue/stages` returns it.
123
+
124
+ ## What is recorded
125
+
126
+ The database is `queue.sqlite3` in the queue's folder. One thread of the queue's own process writes it; nothing else
127
+ does.
128
+
129
+ | Table or view | What it holds |
130
+ |---|---|
131
+ | `calls` | every call: what it is and what it has |
132
+ | `call_stages` | a row for each stage a call passed, with when it started and finished |
133
+ | `call_times` | view: each call with its times |
134
+ | `front_door` | every request at the door |
135
+ | `front_door_hours` | answered reads, counted by hour |
136
+ | `front_door_routes` | view: requests by method, route and status |
137
+ | `stage_order` | the order of stages |
138
+ | `settings` | the saved settings |
139
+
140
+ An answered read keeps its own `front_door` row for two minutes. It is then counted into its hour in
141
+ `front_door_hours` and the row is removed.
142
+
143
+ ## Limits of this release
144
+
145
+ The queue does not sort calls or decide whose turn it is yet. A call is handed to `hugpy-resources` whole, and
146
+ `hugpy-resources` still does stages 20 to 90 itself. That hand-off is on record as one stage row, `handed`, from the
147
+ moment the call is sent until the answer begins. Each stage moves to its owner's door as that door is made.
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hugpy-queue"
7
- version = "0.1.1.3"
8
- description = "The queue: the front door, every call as it is and what it has, and who each of its stages is handed to"
7
+ version = "0.1.1.4"
8
+ description = "The queue of a Hugpy worker: the front door, a record of every call, and the stages each call passes"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
11
11
  # hugpy_utilities is the one function library (the service helpers and the SQLite connection come from it).
12
- # The wrapper, hugpy-engine and hugpy-discovery are not dependencies: each is a part of its own, asked over its door.
13
- dependencies = ["hugpy-utilities"]
12
+ # hugpy-resources, hugpy-engine and hugpy-discovery are not dependencies: each is a part of its own, asked over its door.
13
+ dependencies = ["hugpy-utilities>=0.1.0,<0.2"]
14
14
 
15
15
  [project.scripts]
16
16
  hugpy-queue = "hugpy_queue.cli:main"
@@ -0,0 +1 @@
1
+ """hugpy-queue: the queue of a Hugpy worker: the front door, a record of every call, and its stages (README.md)."""
@@ -0,0 +1,155 @@
1
+ Metadata-Version: 2.4
2
+ Name: hugpy-queue
3
+ Version: 0.1.1.4
4
+ Summary: The queue of a Hugpy worker: the front door, a record of every call, and the stages each call passes
5
+ Requires-Python: >=3.11
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: hugpy-utilities<0.2,>=0.1.0
8
+
9
+ # hugpy-queue
10
+
11
+ The queue of a Hugpy worker: the front door every request comes in through, a record of every call, and the
12
+ stages each call passes on its way to an answer.
13
+
14
+ A Hugpy worker is made of four parts, each with its own service, account and database:
15
+
16
+ | Part | Package | What it answers |
17
+ |---|---|---|
18
+ | Discovery | `hugpy-discovery` | where a model is stored |
19
+ | Resources | `hugpy-resources` | where a model is loaded |
20
+ | Engines | `hugpy-engine` | what a model is doing and what it needs |
21
+ | Queue | `hugpy-queue` | what a call is and what it has |
22
+
23
+ `hugpy-wrapper` is the bundle that installs all four and connects their databases.
24
+
25
+ ## What it does
26
+
27
+ - **Front door.** It listens on one address and takes every request for the worker. Each request is put on record
28
+ with its method, route, status, time and size.
29
+ - **Calls.** Every `POST` is a call. It gets a row saying what it is and what it has, and one row for each stage
30
+ it passes.
31
+ - **Hand-off.** The call is passed on to `hugpy-resources`, and the reply is passed back to the caller as it
32
+ comes, so a streamed reply still arrives piece by piece.
33
+ - **Health.** `GET /health` answers for the whole worker: the queue under its own name, and the health of the part
34
+ behind it as that part gave it.
35
+
36
+ Who may call is decided by `hugpy-resources`. The queue passes every header on unchanged, and names a caller from
37
+ another machine in `X-Forwarded-For`, so the caller is asked for its key exactly as it would be at that door.
38
+
39
+ ## Install
40
+
41
+ ```sh
42
+ pip install hugpy-queue
43
+ ```
44
+
45
+ Python 3.11 or later. The only dependency is `hugpy-utilities`.
46
+
47
+ To run it as a service of the host (Linux with systemd, as root):
48
+
49
+ ```sh
50
+ sudo hugpy-queue system install
51
+ ```
52
+
53
+ This makes the account `hugpy-queue`, the folder `/var/lib/hugpy/queue`, the database `queue.sqlite3` and the unit
54
+ `hugpy-queue.service`, then starts it. `sudo hugpy-queue system status` shows its state, and
55
+ `sudo hugpy-queue system uninstall` stops and removes the unit; the record and the settings are kept.
56
+
57
+ ## Use
58
+
59
+ Send a call to the door the same way it would be sent to the worker:
60
+
61
+ ```sh
62
+ curl http://127.0.0.1:15203/v1/chat/completions \
63
+ -H 'content-type: application/json' \
64
+ -d '{"model": "MODEL", "messages": [{"role": "user", "content": "hello"}]}'
65
+ ```
66
+
67
+ The reply carries a `queue_id`: the number of the call's row.
68
+
69
+ ### Commands
70
+
71
+ | Command | What it does |
72
+ |---|---|
73
+ | `hugpy-queue serve` | run the front door in the foreground (the service runs this) |
74
+ | `hugpy-queue calls` | the latest calls and the stages each passed |
75
+ | `hugpy-queue door` | what has been asked of the door, by route and status |
76
+ | `hugpy-queue settings` | every setting, its value, and where the database is |
77
+ | `hugpy-queue set NAME VALUE` | save one setting |
78
+ | `sudo hugpy-queue system install \| status \| uninstall` | the service of the host |
79
+ | `sudo hugpy-queue system set NAME VALUE` | save one setting and restart the service on it |
80
+
81
+ ### The queue's own reads
82
+
83
+ These are answered by the queue itself and are not passed on:
84
+
85
+ | Route | What it returns |
86
+ |---|---|
87
+ | `GET /health` | the worker's health: the queue, and the part behind it |
88
+ | `GET /_queue/health` | the queue alone: its version, where it hands calls, how many are in flight |
89
+ | `GET /_queue/calls?limit=N` | the latest calls with their stages (20 by default, 500 at most) |
90
+ | `GET /_queue/door` | requests by method, route and status, with counts and times |
91
+ | `GET /_queue/stages` | the order of stages |
92
+
93
+ Every other request is passed on to `hugpy-resources`.
94
+
95
+ ## Settings
96
+
97
+ | Setting | Default | What it is |
98
+ |---|---|---|
99
+ | `host` | `127.0.0.1` | the address the door listens on |
100
+ | `port` | `15203` | the port the door listens on |
101
+ | `wrapper_url` | `http://127.0.0.1:15202` | where a call is handed: the address of `hugpy-resources` |
102
+
103
+ A saved setting is a row of the `settings` table of the queue's database.
104
+
105
+ Two environment variables say where its data is kept:
106
+
107
+ | Variable | What it sets |
108
+ |---|---|
109
+ | `HUGPY_DATA_DIR` | the data directory shared by the Hugpy tools of a host (the service uses `/var/lib/hugpy`; a person's own default is `~/.local/share/hugpy`) |
110
+ | `HUGPY_QUEUE_STATE` | the queue's own folder (default: `queue` under the data directory) |
111
+
112
+ ## The order of stages
113
+
114
+ A call passes these stages in order. Sorting only predicts; running acts.
115
+
116
+ | No. | Stage | Owner | Phase | What it is |
117
+ |---|---|---|---|---|
118
+ | 10 | `received` | queue | sort | recorded: what it is |
119
+ | 20 | `engine_range` | engine | sort | time-to-processed range from tokens in and out; impossible placements out |
120
+ | 30 | `reap_prediction` | discovery | sort | seconds to place the model on a worker drive |
121
+ | 40 | `evict_prediction` | resources | sort | seconds to make room in memory; finishes the sort |
122
+ | 50 | `turn` | queue | run | this row is next |
123
+ | 60 | `accommodate` | discovery | run | the model placed on a worker drive |
124
+ | 70 | `evict` | resources | run | room made |
125
+ | 80 | `load` | resources | run | the engine loads |
126
+ | 90 | `intake` | engine | run | the engine takes the call |
127
+ | 100 | `done` | queue | run | answered |
128
+ | 110 | `responded` | queue | run | the reply written to the caller |
129
+
130
+ The order is data: it is the `stage_order` table, and `GET /_queue/stages` returns it.
131
+
132
+ ## What is recorded
133
+
134
+ The database is `queue.sqlite3` in the queue's folder. One thread of the queue's own process writes it; nothing else
135
+ does.
136
+
137
+ | Table or view | What it holds |
138
+ |---|---|
139
+ | `calls` | every call: what it is and what it has |
140
+ | `call_stages` | a row for each stage a call passed, with when it started and finished |
141
+ | `call_times` | view: each call with its times |
142
+ | `front_door` | every request at the door |
143
+ | `front_door_hours` | answered reads, counted by hour |
144
+ | `front_door_routes` | view: requests by method, route and status |
145
+ | `stage_order` | the order of stages |
146
+ | `settings` | the saved settings |
147
+
148
+ An answered read keeps its own `front_door` row for two minutes. It is then counted into its hour in
149
+ `front_door_hours` and the row is removed.
150
+
151
+ ## Limits of this release
152
+
153
+ The queue does not sort calls or decide whose turn it is yet. A call is handed to `hugpy-resources` whole, and
154
+ `hugpy-resources` still does stages 20 to 90 itself. That hand-off is on record as one stage row, `handed`, from the
155
+ moment the call is sent until the answer begins. Each stage moves to its owner's door as that door is made.
@@ -0,0 +1 @@
1
+ hugpy-utilities<0.2,>=0.1.0
@@ -1,34 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: hugpy-queue
3
- Version: 0.1.1.3
4
- Summary: The queue: the front door, every call as it is and what it has, and who each of its stages is handed to
5
- Requires-Python: >=3.11
6
- Description-Content-Type: text/markdown
7
- Requires-Dist: hugpy-utilities
8
-
9
- # hugpy-queue
10
-
11
- The queue as a part of its own: the fourth of the operator's four parts (Discovery: where it is stored; Resources:
12
- where it is loaded; Engines: what it is doing and needs; Queue: what it is and has). Until 2026-12-03 its rows lived
13
- inside the wrapper's database and its code inside the wrapper's process.
14
-
15
- What it has now:
16
-
17
- - its own service (`hugpy-queue.service`), account, folder (`/var/lib/hugpy/queue`) and database
18
- (`queue.sqlite3`), written by one thread of its own process and by nothing else;
19
- - the front door: every request of any kind is on record (`front_door`; answered reads are counted into
20
- `front_door_hours` after two minutes and their rows removed);
21
- - every POST as a row (`calls`: what it is and has) with a row for each stage it passes (`call_stages`);
22
- - the operator's order of stages as data (`stage_order`: number, stage, the part that owns it, sort or run).
23
-
24
- What it does not have yet: the sort and the turn. A call is handed to the wrapper whole, and the wrapper still does
25
- stages 20 to 90 itself; that hand-off is on record as one stage row (`handed`, owner `wrapper`). Each stage moves
26
- to its owner's door as that door is made.
27
-
28
- hugpy-queue serve the front door (the service runs this)
29
- hugpy-queue calls the latest calls and their stages
30
- hugpy-queue door what is asked of the door, a route
31
- hugpy-queue settings host, port, the wrapper's address
32
- hugpy-queue set NAME VALUE save one setting
33
- sudo hugpy-queue system install | status | uninstall
34
- sudo hugpy-queue system set NAME VALUE save one setting and restart the service on it
@@ -1,26 +0,0 @@
1
- # hugpy-queue
2
-
3
- The queue as a part of its own: the fourth of the operator's four parts (Discovery: where it is stored; Resources:
4
- where it is loaded; Engines: what it is doing and needs; Queue: what it is and has). Until 2026-12-03 its rows lived
5
- inside the wrapper's database and its code inside the wrapper's process.
6
-
7
- What it has now:
8
-
9
- - its own service (`hugpy-queue.service`), account, folder (`/var/lib/hugpy/queue`) and database
10
- (`queue.sqlite3`), written by one thread of its own process and by nothing else;
11
- - the front door: every request of any kind is on record (`front_door`; answered reads are counted into
12
- `front_door_hours` after two minutes and their rows removed);
13
- - every POST as a row (`calls`: what it is and has) with a row for each stage it passes (`call_stages`);
14
- - the operator's order of stages as data (`stage_order`: number, stage, the part that owns it, sort or run).
15
-
16
- What it does not have yet: the sort and the turn. A call is handed to the wrapper whole, and the wrapper still does
17
- stages 20 to 90 itself; that hand-off is on record as one stage row (`handed`, owner `wrapper`). Each stage moves
18
- to its owner's door as that door is made.
19
-
20
- hugpy-queue serve the front door (the service runs this)
21
- hugpy-queue calls the latest calls and their stages
22
- hugpy-queue door what is asked of the door, a route
23
- hugpy-queue settings host, port, the wrapper's address
24
- hugpy-queue set NAME VALUE save one setting
25
- sudo hugpy-queue system install | status | uninstall
26
- sudo hugpy-queue system set NAME VALUE save one setting and restart the service on it
@@ -1 +0,0 @@
1
- """hugpy-queue: the queue as a part of its own (see README.md)."""
@@ -1,34 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: hugpy-queue
3
- Version: 0.1.1.3
4
- Summary: The queue: the front door, every call as it is and what it has, and who each of its stages is handed to
5
- Requires-Python: >=3.11
6
- Description-Content-Type: text/markdown
7
- Requires-Dist: hugpy-utilities
8
-
9
- # hugpy-queue
10
-
11
- The queue as a part of its own: the fourth of the operator's four parts (Discovery: where it is stored; Resources:
12
- where it is loaded; Engines: what it is doing and needs; Queue: what it is and has). Until 2026-12-03 its rows lived
13
- inside the wrapper's database and its code inside the wrapper's process.
14
-
15
- What it has now:
16
-
17
- - its own service (`hugpy-queue.service`), account, folder (`/var/lib/hugpy/queue`) and database
18
- (`queue.sqlite3`), written by one thread of its own process and by nothing else;
19
- - the front door: every request of any kind is on record (`front_door`; answered reads are counted into
20
- `front_door_hours` after two minutes and their rows removed);
21
- - every POST as a row (`calls`: what it is and has) with a row for each stage it passes (`call_stages`);
22
- - the operator's order of stages as data (`stage_order`: number, stage, the part that owns it, sort or run).
23
-
24
- What it does not have yet: the sort and the turn. A call is handed to the wrapper whole, and the wrapper still does
25
- stages 20 to 90 itself; that hand-off is on record as one stage row (`handed`, owner `wrapper`). Each stage moves
26
- to its owner's door as that door is made.
27
-
28
- hugpy-queue serve the front door (the service runs this)
29
- hugpy-queue calls the latest calls and their stages
30
- hugpy-queue door what is asked of the door, a route
31
- hugpy-queue settings host, port, the wrapper's address
32
- hugpy-queue set NAME VALUE save one setting
33
- sudo hugpy-queue system install | status | uninstall
34
- sudo hugpy-queue system set NAME VALUE save one setting and restart the service on it
@@ -1 +0,0 @@
1
- hugpy-utilities
File without changes