You are a software design and engineering expert. The following question comes from a…
- User
You are a software design and engineering expert. The following question comes from a your colleague, a fellow expert seeking your feedback:
Please review this architecture/design document and give your feedback.
ARCHITECTURE
HTTP INTERFACE
STARTING COMPUTATION
- URI:
/Create - HTTP Method:
POST - Request Body: a UUID
- Response codes:
- 200 OK - sent on success
- 405 Method Not Allowed - if HTTP Method is not
POST - 409 Conflict - if UUID has already been used
RUNNING THE COMPUTATION
- URI:
/Run - HTTP Method:
POST - Response codes:
- 200 OK - computation finished or errored (to prevent compute provider from recycling instance after an HTTP error)
- 202 Accepted - computation is still in progress, send another /Run request to continue computation
- Response body: Content of the persistent file describing the computation
KNOWING WHEN THE COMPUTATION IS DONE
The computation is complete when the
/Runendpoint returns 200 OK (see above).COMPUTATION STATE MACHINE
- NONE - initial state, similar to FINISHED
- CREATED - computation ID has been created but
/Runhas never been called yet with this computation. - IN_PROGRESS - computation ID is created, and
/Runhas been called one or more times. - FINISHED - the computation has finished, and a new computation can be created.
- ERROR - the computation experienced an error
STORAGE
METADATA
- A persistent file (needs to be stored externally) is stored based on the computation ID provided in the
/Createendpoint to ensure a computation is not created twice. - The content of this file is a JSON document containing the state of the computation (see COMPUTATION STATE MACHINE above).
- Sample file content:
{ "uuid": "48f8a34a-1e40-4b8a-8f5f-d1d7c3c06a4f", "state": "FINISHED" }- As a safety check, whenever a call to the
/Runendpoint is outstanding, a randomly-named lockfile should be stored to indicate to any other instances of the application that a computation is running and must not be disrupted. When the/Runendpoint is going to return an HTTP response, it should remove this file first. Note that mutliple instances of the application are not supported and this serves only as a best-effort guardrail.
- URI:
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.