Record the created artifacts
Original text from #66 (closed):
It seems likely that we will want to be able to (programmatically) figure out what artifacts have been created by a given work request. So we should also modify the API used to report a work request as completed so that we can indicate the list of artifacts that have been created. Or maybe that should be recorded as a side-effect of the artifact creation? I'm not sure.
Plan:
- Create a new model: WorkRequestArtifactRelation (only with "work_request" and "artifact". I guess that no "type" of relation on this one)
- Create new API endpoints to create WorkRequestArtifactRelation for a WorkRequest - Artifact
- Extend debusine client to use the new endpoint for creating WorkRequestArtifactRelation
- In Worker._execute_work_request_and_submit_result: pass "work_request.id" to the constructor (unless we prefer to set like what we did with
configure_server_access()
. Something likeself._task_running = Task.class_from_name(work_request.task_name)(work_request.id)
(could be an optional parameter anyway). - In Worker, when it's already creating relations between the Artifacts: also create the WorkRequestArtifactRelations as needed
- Make the WorkRequestArtifactRelation available (via new API endpoint or enriching the existing work-request status endpoint)
The original text from #66 (closed) says:
So we should also modify the API used to report a work request as completed so that we can indicate the list of artifacts that have been created.
My first thought was to create a new endpoint to list the artifacts for a work request (since we are creating plumbing commands) and a new CLI to list the artifacts for a work request.