mirror of
https://github.com/blw1138/Zordon.git
synced 2026-06-09 13:39:24 -05:00
Remove unnecessary full_status and snapshot API endpoints
This commit is contained in:
-27
@@ -281,29 +281,6 @@ Known callers:
|
|||||||
|
|
||||||
- `RenderServerProxy.get_status()`
|
- `RenderServerProxy.get_status()`
|
||||||
|
|
||||||
### `GET /api/snapshot`
|
|
||||||
|
|
||||||
Returns local status, all jobs, and a timestamp.
|
|
||||||
|
|
||||||
Known callers:
|
|
||||||
|
|
||||||
- `full_status()` internally.
|
|
||||||
|
|
||||||
Review note: no direct in-repo HTTP callers were found. It overlaps with
|
|
||||||
`/api/status` plus `/api/jobs`.
|
|
||||||
|
|
||||||
### `GET /api/full_status`
|
|
||||||
|
|
||||||
Returns a multi-server shaped status payload with the local server populated.
|
|
||||||
|
|
||||||
Known callers:
|
|
||||||
|
|
||||||
- `RenderServerProxy.get_full_status()`
|
|
||||||
- `dashboard.py`
|
|
||||||
|
|
||||||
Review note: this currently reports only the local server. The response shape
|
|
||||||
suggests an intended future aggregation point.
|
|
||||||
|
|
||||||
### `GET /api/presets`
|
### `GET /api/presets`
|
||||||
|
|
||||||
Returns `config/presets.yaml`.
|
Returns `config/presets.yaml`.
|
||||||
@@ -492,10 +469,6 @@ Review note: development/debug only.
|
|||||||
|
|
||||||
## Redundancy and Cleanup Review
|
## Redundancy and Cleanup Review
|
||||||
|
|
||||||
Likely redundant or overlapping routes:
|
|
||||||
|
|
||||||
- `/api/snapshot` overlaps with `/api/status` and `/api/jobs`. It is currently
|
|
||||||
used internally by `/api/full_status`.
|
|
||||||
Routes with no in-repo callers found:
|
Routes with no in-repo callers found:
|
||||||
|
|
||||||
- `GET /api/jobs/status/<status_val>`
|
- `GET /api/jobs/status/<status_val>`
|
||||||
|
|||||||
@@ -406,18 +406,6 @@
|
|||||||
<p>Returns local system and queue status, including operating system, CPU, memory, job counts, hostname, port, app version, and API version.</p>
|
<p>Returns local system and queue status, including operating system, CPU, memory, job counts, hostname, port, app version, and API version.</p>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<article class="endpoint">
|
|
||||||
<div class="endpoint-header"><span class="method get">GET</span><span class="path">/api/snapshot</span></div>
|
|
||||||
<p>Returns local status, all jobs, and a timestamp.</p>
|
|
||||||
<div class="note">No direct in-repo HTTP callers were found. It overlaps with <code>/api/status</code> plus <code>/api/jobs</code> and is used internally by <code>/api/full_status</code>.</div>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<article class="endpoint">
|
|
||||||
<div class="endpoint-header"><span class="method get">GET</span><span class="path">/api/full_status</span></div>
|
|
||||||
<p>Returns a multi-server shaped status payload with the local server populated. Used by <code>RenderServerProxy.get_full_status()</code> and <code>dashboard.py</code>.</p>
|
|
||||||
<div class="note">The response shape suggests an intended future aggregation point, but it currently reports only the local server.</div>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<article class="endpoint">
|
<article class="endpoint">
|
||||||
<div class="endpoint-header"><span class="method get">GET</span><span class="path">/api/presets</span></div>
|
<div class="endpoint-header"><span class="method get">GET</span><span class="path">/api/presets</span></div>
|
||||||
<p>Returns <code>config/presets.yaml</code>.</p>
|
<p>Returns <code>config/presets.yaml</code>.</p>
|
||||||
@@ -562,13 +550,6 @@
|
|||||||
<section id="cleanup">
|
<section id="cleanup">
|
||||||
<h2>Cleanup Review</h2>
|
<h2>Cleanup Review</h2>
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<h3>Likely Redundant Or Overlapping Routes</h3>
|
|
||||||
<ul>
|
|
||||||
<li><code>/api/snapshot</code> overlaps with <code>/api/status</code> and <code>/api/jobs</code>. It is currently used internally by <code>/api/full_status</code>.</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="panel" style="margin-top: 14px;">
|
|
||||||
<h3>Routes With No In-Repo Callers Found</h3>
|
<h3>Routes With No In-Repo Callers Found</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><code>GET /api/jobs/status/<status_val></code></li>
|
<li><code>GET /api/jobs/status/<status_val></code></li>
|
||||||
|
|||||||
@@ -206,29 +206,6 @@ def presets() -> Dict[str, Any]:
|
|||||||
return loaded_presets
|
return loaded_presets
|
||||||
|
|
||||||
|
|
||||||
@server.get('/api/full_status')
|
|
||||||
def full_status():
|
|
||||||
full_results = {'timestamp': datetime.now().isoformat(), 'servers': {}}
|
|
||||||
|
|
||||||
try:
|
|
||||||
snapshot_results = snapshot()
|
|
||||||
server_data = {'status': snapshot_results.get('status', {}), 'jobs': snapshot_results.get('jobs', {}),
|
|
||||||
'is_online': True}
|
|
||||||
full_results['servers'][server.config['HOSTNAME']] = server_data
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"Exception fetching full status: {e}")
|
|
||||||
|
|
||||||
return full_results
|
|
||||||
|
|
||||||
|
|
||||||
@server.get('/api/snapshot')
|
|
||||||
def snapshot():
|
|
||||||
server_status = status()
|
|
||||||
server_jobs = [x.json() for x in RenderQueue.all_jobs()]
|
|
||||||
server_data = {'status': server_status, 'jobs': server_jobs, 'timestamp': datetime.now().isoformat()}
|
|
||||||
return server_data
|
|
||||||
|
|
||||||
|
|
||||||
@server.route('/api/status')
|
@server.route('/api/status')
|
||||||
def status():
|
def status():
|
||||||
return {"timestamp": datetime.now().isoformat(),
|
return {"timestamp": datetime.now().isoformat(),
|
||||||
|
|||||||
@@ -163,9 +163,6 @@ class RenderServerProxy:
|
|||||||
self.__update_job_cache(timeout, ignore_token)
|
self.__update_job_cache(timeout, ignore_token)
|
||||||
return self.__jobs_cache.copy() if self.__jobs_cache else None
|
return self.__jobs_cache.copy() if self.__jobs_cache else None
|
||||||
|
|
||||||
def get_full_status(self, timeout=5):
|
|
||||||
return self.request_data('full_status', timeout=timeout)
|
|
||||||
|
|
||||||
def get_status(self):
|
def get_status(self):
|
||||||
status = self.request_data('status')
|
status = self.request_data('status')
|
||||||
if status and not self.system_cpu:
|
if status and not self.system_cpu:
|
||||||
|
|||||||
Reference in New Issue
Block a user