Skip to content

Work request (form or API): fail earlier and clearer than at scheduler time or worker

It is possible to create a Work Request with the wrong data, via the web form or via the API. Both return success on the creation.

When the scheduler ties to schedule it, in scheduler_for_worker, the server is executing Task.configure (Task.configure method or its subclass from Sbuild.configure). If it fails the scheduler logs and marks as error:

        task = Task.class_from_name(work_request.task_name)()
        try:
            task.configure(work_request.task_data)
        except TaskConfigError as exc:
            logger.warning(  # noqa: G200
                "WorkRequest %s failed to configure, aborting it. "
                "Task data: %s Error: %s",
                work_request.id,
                work_request.task_data,
                exc,
            )
            work_request.mark_completed(WorkRequest.Results.ERROR)
            continue

There are two things that I think that we could change:

  • could debusine fail earlier? E.g. debusine.client create-work-request sbuild --data data.yaml could reject the creation of it if data.yaml would not be configurable? (client side?) Or, at least, validated on the server side? If debusine do it at scheduling time in the server, I cannot think of any reason why not doing it earlier (validate on reception).
  • when it fails in the scheduler: the only place that the user can see any log with information is in the server logs (the information usually comes from validating the JSON schema and is quite useful). How could debusine make this information available to the user? One idea is that, if it failed earlier, it does not matter (already validated). Or if we need to fail in the server after the creation: should debusine create an artifact of category debusine:work-request-debug-logs with the information?
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information