Skip to main content

TrainingService.CreateTrainingRun

Create a TrainingRun in the workspace from its complete Kubernetes spec. Kubernetes admission validates the spec before the resource is created.

TrainingService · Installed Web API. Use the HTTPS origin of your Prokrust installation and credentials authorized for this operation.

POST /prokrust.api.v1alpha1.TrainingService/CreateTrainingRun

Request headers​

HeaderValue and purpose
AuthorizationUse Bearer $PROKRUST_TOKEN for a Kubernetes caller authorized for this operation. Browser calls use the signed-in session.
Content-Typeapplication/json selects ProtoJSON for this unary request.
Connect-Protocol-Version1 selects version 1 of the Connect protocol.

Request fields​

CreateResourceRequest

JSON fieldTypeMeaning
namespacestringKubernetes workspace namespace for the operation. Use the namespace in which the selected resource lives.
namestringName to give the new Kubernetes object. Workspace setup resources use the fixed name default.
specJSON objectFull CRD spec as a ProtoJSON object. Send the fields under spec in the Kubernetes manifest. Choose field names and allowed values from that kind’s CRD. Spec numbers must fit the exact integer range of a protobuf Struct (±9007199254740991).

Example request​

Set PROKRUST_URL to the installation’s HTTPS origin and PROKRUST_TOKEN to your caller token. Replace the sample values with values from your installation.

curl --fail-with-body --silent --show-error \
-H "Authorization: Bearer $PROKRUST_TOKEN" \
-H 'Content-Type: application/json' \
-H 'Connect-Protocol-Version: 1' \
"$PROKRUST_URL/prokrust.api.v1alpha1.TrainingService/CreateTrainingRun" \
--data-binary @- <<'JSON'
{
"namespace": "analytics",
"name": "train-values",
"spec": {
"queryRef": {
"name": "value-query"
},
"graphSnapshotSource": {
"kind": "SnapshotPreparation",
"name": "prepare-events"
},
"split": {
"type": "HashRatio",
"train": 0.7,
"validation": 0.15,
"test": 0.15
},
"model": {
"family": "HeteroCountTimeV2",
"hiddenDimension": 4,
"layers": 1,
"fanout": [
2
],
"temporalStrategy": "Last",
"validationMetric": "Mae",
"dropout": 0,
"learningRate": 0.01,
"batchSize": 16,
"maxEpochs": 2,
"earlyStoppingPatience": 0
},
"cpuWorkers": 1,
"resources": {
"requests": {
"cpu": "250m",
"memory": "512Mi",
"ephemeral-storage": "512Mi"
},
"limits": {
"cpu": "500m",
"memory": "2Gi",
"ephemeral-storage": "2Gi"
}
},
"seed": "42",
"evaluationMode": "Full"
}
}
JSON

Response fields​

Resource

JSON fieldTypeMeaning
namespacestringKubernetes workspace namespace for the operation. Use the namespace in which the selected resource lives.
namestringKubernetes metadata.name. Combine it with namespace and UID when acting on an existing object.
uidstringKubernetes metadata.uid identifying this particular object. Read it from the resource before targeting an existing instance.
resourceVersionstringOpaque Kubernetes resource version. Copy the value from a current read. Preserve it as a string.
generationint64Kubernetes spec generation. Compare it with status.observedGeneration to check whether the controller processed this spec.
specJSON objectComplete Kubernetes spec object for this resource kind. Use the corresponding CRD field reference.
statusJSON objectController observations from the CRD status, when published. Compare observedGeneration with generation before interpreting conditions.
labelsmap from string to stringKubernetes labels included in the resource projection. Use them to identify release or application ownership.
annotationsmap from string to stringKubernetes annotation values included in the projection. Check the owning tool’s annotations before changing a managed object.
creationTimestampstringKubernetes creation time in RFC 3339 format.
deletionTimestampstringAccepted deletion remains pending until the resource disappears.

Example response​

{
"namespace": "analytics",
"name": "train-values",
"uid": "91c90b29-d618-5dbf-bc4b-391c5aababcd",
"resourceVersion": "42",
"generation": "1",
"creationTimestamp": "2026-05-12T10:00:00Z",
"spec": {
"queryRef": {
"name": "value-query"
},
"graphSnapshotSource": {
"kind": "SnapshotPreparation",
"name": "prepare-events"
},
"split": {
"type": "HashRatio",
"train": 0.7,
"validation": 0.15,
"test": 0.15
},
"model": {
"family": "HeteroCountTimeV2",
"hiddenDimension": 4,
"layers": 1,
"fanout": [
2
],
"temporalStrategy": "Last",
"validationMetric": "Mae",
"dropout": 0,
"learningRate": 0.01,
"batchSize": 16,
"maxEpochs": 2,
"earlyStoppingPatience": 0
},
"cpuWorkers": 1,
"resources": {
"requests": {
"cpu": "250m",
"memory": "512Mi",
"ephemeral-storage": "512Mi"
},
"limits": {
"cpu": "500m",
"memory": "2Gi",
"ephemeral-storage": "2Gi"
}
},
"seed": "42",
"evaluationMode": "Full"
}
}

Kubernetes reference​

See the TrainingRun reference for the resource configuration and controller observations.