roboto.domain.platform_events.events#
Module Contents#
- roboto.domain.platform_events.events.CLOUDEVENTS_SPECVERSION = '1.0'#
The CloudEvents spec version
PlatformEvent.to_cloudevent()produces.
- roboto.domain.platform_events.events.CLOUDEVENTS_TYPE_PREFIX = 'ai.roboto.'#
Reverse-DNS prefix CloudEvents recommends on
type. It appears only in whatPlatformEvent.to_cloudevent()returns; subscriptions, conditions, and templates name an event by its barePlatformEventTypevalue (file.uploaded).
- class roboto.domain.platform_events.events.DatasetCreatedPayload(/, **data)#
Bases:
pydantic.BaseModelPayload for
PlatformEventType.DatasetCreated.- Parameters:
data (Any)
- dataset_id: str#
The created dataset.
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class roboto.domain.platform_events.events.DatasetMetadataUpdatedPayload(/, **data)#
Bases:
pydantic.BaseModelPayload for
PlatformEventType.DatasetMetadataUpdated.- Parameters:
data (Any)
- changeset: roboto.updates.MetadataChangeset#
The applied metadata/tag delta, served to conditions as the
changedandtagroots.
- dataset_id: str#
The dataset whose metadata changed.
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class roboto.domain.platform_events.events.DatasetTagAddedPayload(/, **data)#
Bases:
pydantic.BaseModelPayload for
PlatformEventType.DatasetTagAdded.- Parameters:
data (Any)
- dataset_id: str#
The tagged dataset.
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- tags_added: list[str]#
Tags added by the mutation, served to conditions as the
tagroot.
- class roboto.domain.platform_events.events.FileIngestedPayload(/, **data)#
Bases:
pydantic.BaseModelPayload for
PlatformEventType.FileIngested.- Parameters:
data (Any)
- dataset_id: str#
Dataset containing the ingested file.
- file_id: str#
The ingested file.
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- transaction_id: str | None = None#
Upload transaction the file arrived in, when known.
- class roboto.domain.platform_events.events.FileMetadataUpdatedPayload(/, **data)#
Bases:
pydantic.BaseModelPayload for
PlatformEventType.FileMetadataUpdated.- Parameters:
data (Any)
- changeset: roboto.updates.MetadataChangeset#
The applied metadata/tag delta, served to conditions as the
changedandtagroots.
- dataset_id: str#
Dataset containing the updated file.
- file_id: str#
The file whose metadata changed.
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class roboto.domain.platform_events.events.FileUploadedPayload(/, **data)#
Bases:
pydantic.BaseModelPayload for
PlatformEventType.FileUploaded.- Parameters:
data (Any)
- dataset_id: str#
Dataset the file was uploaded to.
- file_id: str#
The uploaded file.
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- transaction_id: str | None = None#
Upload transaction the file arrived in, when the upload used one.
- class roboto.domain.platform_events.events.InvocationCompletedPayload(/, **data)#
Bases:
pydantic.BaseModelPayload for
PlatformEventType.InvocationCompleted.- Parameters:
data (Any)
- action_name: str#
Name of the invoked action. Unique within
action_owner_id’s org.
- action_owner_id: str#
Org that owns the invoked action.
- invocation_id: str#
The completed invocation.
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- status: roboto.domain.actions.invocation_record.InvocationStatus#
Terminal status the invocation reached.
- class roboto.domain.platform_events.events.InvocationFailedPayload(/, **data)#
Bases:
pydantic.BaseModelPayload for
PlatformEventType.InvocationFailed.- Parameters:
data (Any)
- action_name: str#
Name of the invoked action. Unique within
action_owner_id’s org.
- action_owner_id: str#
Org that owns the invoked action.
- invocation_id: str#
The failed invocation.
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- status: roboto.domain.actions.invocation_record.InvocationStatus#
Terminal status the invocation reached (
FailedorDeadly).
- class roboto.domain.platform_events.events.PlatformEvent(/, **data)#
Bases:
pydantic.BaseModelOne occurrence of something that happened on the platform, as a trigger receives it.
id,source,type,timeandsubjectare the CloudEvents 1.0 context attributes;to_cloudevent()renders the occurrence in that spec’s structured-JSON form. The envelope stays thin:datacarries entity ids and facts fixed attime, such as a metadata delta or a terminal status, and never mutable entity state — conditions and target templates read an entity’s current state at evaluation time through anEventNamespace.- Parameters:
data (Any)
- data: PlatformEventPayload#
The per-type payload. Its model must be the one registered for
typein the default catalog; a mismatch is rejected at validation time.
- id: str#
Producer-vended event id, unique within
source; deterministic where possible (e.g.evt:{invocation_id}:completed).
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- org_id: str#
Organization in which the event occurred and whose triggers see it.
- schema_version: int = 1#
Version of the envelope + payload schema. Bumped only for breaking changes.
- source: str#
The org and the deployment the event happened in, as built by
platform_event_source().
- property subject: str#
The entity the event is about, as a
roboto://URI (roboto://file/fl_1a2b).Computed from
databy the event type’s catalog descriptor rather than stored, so it cannot disagree with the payload, and serialized like a declared field.- Return type:
str
- property subject_uri: roboto.uri.RobotoUri#
subjectas a parsedRobotoUri.- Return type:
- time: datetime.datetime#
When the event occurred.
- to_cloudevent()#
Return this event as CloudEvents 1.0 structured JSON (
application/cloudevents+json).Nothing serializes it yet: the command bus carries the model itself. It exists so an outbound webhook body needs no redesign.
Context attributes sit at the top level under their spec names, with
typecarryingCLOUDEVENTS_TYPE_PREFIXanddatacontenttypefixed atapplication/json.org_idandschema_versionarrive as the extension attributesorgidandschemaversion, because extension names must be lowercase alphanumerics. The returned dict is JSON-serializable as-is.- Return type:
dict[str, Any]
- type: PlatformEventType#
Which kind of event this is. Dictates the concrete model of
data.
- roboto.domain.platform_events.events.PlatformEventPayload#
Union of every per-type payload model. Which member is legal for a given
PlatformEventis dictated by itstype.
- class roboto.domain.platform_events.events.PlatformEventType#
Bases:
roboto.compat.StrEnumA thing that happens on the platform that triggers can subscribe to.
Every member has a
PlatformEventDescriptorin the defaultPlatformEventCatalogdescribing its payload model, the namespace roots it exposes to conditions and templates, and theOncePervalues it supports.- DatasetCreated = 'dataset.created'#
A dataset was created.
- DatasetMetadataUpdated = 'dataset.metadata_updated'#
A dataset’s metadata or tags changed.
- DatasetTagAdded = 'dataset.tag_added'#
One or more tags were added to a dataset.
- EventCreated = 'event.created'#
An event, the annotation marking a span of time on your data, was created.
- FileIngested = 'file.ingested'#
A file finished ingestion (post-processing) and its topics are available.
- FileMetadataUpdated = 'file.metadata_updated'#
A file’s metadata or tags changed.
- FileUploaded = 'file.uploaded'#
A file finished uploading to a dataset.
- InvocationCompleted = 'invocation.completed'#
An action invocation reached a successful terminal status.
- InvocationFailed = 'invocation.failed'#
An action invocation reached a failed terminal status (
FailedorDeadly).
- ScheduleFired = 'schedule.fired'#
a trigger fires on a schedule by declaring a
Schedulesource, and the scheduler delivers this occurrence to that trigger alone.- Type:
A trigger’s own schedule reached one of its minutes. Not subscribable
- SessionCreated = 'session.created'#
A session was created.
- SessionFilesAdded = 'session.files_added'#
Files were added to a session.
- SessionUpdated = 'session.updated'#
A session’s metadata or tags changed.
- UploadCompleted = 'dataset.upload_completed'#
An upload transaction to a dataset completed (all of its files uploaded).
- property cloudevents_type: str#
ai.roboto.file.uploaded.- Type:
This type as a CloudEvents
typeattribute- Return type:
str
- classmethod from_cloudevents_type(value)#
Return the event type a CloudEvents
typeattribute names; the inverse ofcloudevents_type.- Parameters:
value (str) – A prefixed type, such as
ai.roboto.file.uploaded.- Raises:
ValueError –
valuelacks the prefix or names no platform event type.- Return type:
- class roboto.domain.platform_events.events.ScheduleFiredPayload(/, **data)#
Bases:
pydantic.BaseModelPayload for
PlatformEventType.ScheduleFired.- Parameters:
data (Any)
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- scheduled_for: datetime.datetime#
The scheduled minute (UTC) this occurrence stands for.
- trigger_id: str#
The trigger whose schedule fired.
- class roboto.domain.platform_events.events.SessionCreatedPayload(/, **data)#
Bases:
pydantic.BaseModelPayload for
PlatformEventType.SessionCreated.- Parameters:
data (Any)
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- session_id: str#
The created session.
- class roboto.domain.platform_events.events.SessionFilesAddedPayload(/, **data)#
Bases:
pydantic.BaseModelPayload for
PlatformEventType.SessionFilesAdded.- Parameters:
data (Any)
- file_ids: list[str]#
The added files.
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- session_id: str#
The session files were added to.
- class roboto.domain.platform_events.events.SessionUpdatedPayload(/, **data)#
Bases:
pydantic.BaseModelPayload for
PlatformEventType.SessionUpdated.- Parameters:
data (Any)
- changeset: roboto.updates.MetadataChangeset#
The applied metadata/tag delta, served to conditions as the
changedandtagroots.
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- session_id: str#
The session whose metadata changed.
- class roboto.domain.platform_events.events.UploadCompletedPayload(/, **data)#
Bases:
pydantic.BaseModelPayload for
PlatformEventType.UploadCompleted.- Parameters:
data (Any)
- dataset_id: str#
Dataset the upload targeted.
- model_config#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- transaction_id: str#
The completed upload transaction.
- roboto.domain.platform_events.events.platform_event_source(api_domain, org_id)#
Return the CloudEvents
sourcefor one org’s events on one deployment.The value is the org’s own API resource,
https://{api_domain}/v1/orgs/{org_id}. No two deployments produce the samesource, so it pairs withPlatformEvent.idto identify a single occurrence.- Parameters:
api_domain (Optional[str]) – Public API host of the emitting deployment, such as
api.roboto.ai. Without one, the result is the relative reference/v1/orgs/{org_id}.org_id (str) – Organization whose events carry this source.
- Return type:
str