Skip to content

Commit

Permalink
fix(exit): Using send_any if you send Any type
Browse files Browse the repository at this point in the history
  • Loading branch information
christianint committed Dec 17, 2024
1 parent 6bdcdb7 commit 0a6e685
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .kai/local/kai-project-template.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: v0.1.3
version: v0.1.4
description: kai-project-template
config: {}
workflows:
Expand Down Expand Up @@ -31,7 +31,7 @@ workflows:
limit: 800M
- name: training
type: task
image: registry.kai.local/kai-project-template_training:v0.0.3
image: registry.kai.local/kai-project-template_training:v0.0.4
replicas: 1
gpu: false
objectStore: null
Expand Down
2 changes: 1 addition & 1 deletion src/demo-workflow/tasks/training/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# This variable have the environment to use, by default is local, but you can change when you run the make command
ENV ?= local
PROCESS_VERSION ?= v0.0.3
PROCESS_VERSION ?= v0.0.4

# Read the PRODUCT_NAME variable based on the file inside the corresponding directory
PRODUCT_NAME := $(shell basename $(wildcard ./../../../../.kai/$(ENV)/*.yaml) .yaml)
Expand Down
8 changes: 7 additions & 1 deletion src/demo-workflow/tasks/training/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from sdk.kai_sdk import KaiSDK
from runner.runner import Runner
from google.protobuf.any_pb2 import Any
from google.protobuf.struct_pb2 import Value


async def initializer(sdk: KaiSDK):
Expand All @@ -10,7 +11,12 @@ async def initializer(sdk: KaiSDK):

async def handler(sdk: KaiSDK, message: Any):
sdk.logger.info(f"Received message in training: {message}")
await sdk.messaging.send_any(response=message)
response = Value()
response.struct_value.fields["status_code"].string_value = "200"
response.struct_value.fields[
"message"
].string_value = "Training completed successfully"
await sdk.messaging.send_output(response=response)


async def finalizer(sdk: KaiSDK):
Expand Down

0 comments on commit 0a6e685

Please sign in to comment.