Skip to content

Populate the operation results correctly

Rohit Kothur requested to merge rkothur/valid-operations into master

Description

According to the operations API, the operation result can take one of two forms, response or error. response should only be populated when the operation was successful, and error otherwise. Currently, however, BuildGrid always populates response, and only populates error in very narrow cases (e.g. cancelled operations have error populated in ListOperations). This change seeks to make BuildGrid compliant with the API.

Note that, per the status field in the Lease, this is only relevant for errors concerning the bot's ability to perform the lease's work. Things like missing input files, failed authentication, etc. The actual result of the build is immaterial, and build failures are still "operation successes" and should still populate the response.

Changes proposed in this merge request:

  • Add a status code field to the database
  • Populate the operation result as an error when the bot fails to handle the lease
  • Clarify how to update the database schema in the docs

Validation

The easiest way to see this is to stand up a local buildgrid instance with default.conf, running bgd bot host-tools, then running a sleep like mkdir -p workdir && bgd execute command workdir sleep 10 and canceling it with bgd operation cancel <operation_name>. This process is made easier with the changes in !419 (merged), since you'll just have to hit Ctrl-C in your bgd execute terminal to cancel the operation.

Issues addressed

Closes #258 (closed)

Edited by Rohit Kothur

Merge request reports