Event

pydantic model controller.models.domain.lab.Event

One lab operation event for a user.

This model is not directly returned by any handler. Instead, it is converted to a server-sent event via its to_sse method.

Parameters:

data (Any)

Show JSON schema
{
   "title": "Event",
   "description": "One lab operation event for a user.\n\nThis model is not directly returned by any handler. Instead, it is\nconverted to a server-sent event via its ``to_sse`` method.",
   "type": "object",
   "properties": {
      "type": {
         "allOf": [
            {
               "$ref": "#/$defs/EventType"
            }
         ],
         "description": "Type of the event",
         "title": "Type"
      },
      "message": {
         "description": "User-visible message for this event",
         "title": "Message",
         "type": "string"
      },
      "progress": {
         "anyOf": [
            {
               "exclusiveMinimum": 0,
               "maximum": 100,
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Estimated competion percentage of operation. For spawn events after the Kubernetes objects have been created, this is a mostly meaningless number to make the progress bar move, since we have no way to know how many events in total there will be.",
         "title": "Percentage"
      }
   },
   "$defs": {
      "EventType": {
         "description": "Type of message.",
         "enum": [
            "complete",
            "error",
            "failed",
            "info"
         ],
         "title": "EventType",
         "type": "string"
      }
   },
   "required": [
      "type",
      "message"
   ]
}

Fields:
field message: str [Required]

User-visible message for this event

field progress: int | None = None

Estimated competion percentage of operation. For spawn events after the Kubernetes objects have been created, this is a mostly meaningless number to make the progress bar move, since we have no way to know how many events in total there will be.

Constraints:
  • gt = 0

  • le = 100

field type: EventType [Required]

Type of the event

to_sse()

Convert to event suitable for sending to the client.

Returns:

Converted form of the event.

Return type:

sse_starlette.ServerSentEvent

property done: bool

Whether this event indicates the event stream should stop.