Skip to content

Commit

Permalink
fix(docs): update init examples (#43)
Browse files Browse the repository at this point in the history
<!--- Provide a general summary of your changes in the Title above -->

## Description
<!--- Describe your changes in detail -->
Update init examples with usage of the configuration utility.

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
The init examples were outdated

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Other changes (ci configuration, documentation or any other kind of changes)

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [ ] I have created tests for my code changes, and the tests are passing.
- [ ] I have executed the pre-commit hooks locally.
- [ ] My change requires a change to the documentation (create a new issue if the documentation has not been updated).
- [ ] I have updated the documentation accordingly.
  • Loading branch information
alexrodfe committed Apr 13, 2023
1 parent a7a7f99 commit 6d9cb29
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions content/v2/docs/60_kais_runner_sdk/10_sdk/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import joblib

async def init(ctx):
ctx.logger.info("[worker init]")
ctx.set('model', joblib.load(ctx.path('models/model.joblib')))

ctx.configuration.set('model', joblib.load(ctx.path('models/model.joblib')))
```

### Golang init example
Expand All @@ -33,10 +34,10 @@ import (
)

func handlerInit(ctx *kre.HandlerContext) {
ctx.Logger.Info("init handler")
// Saves a value in the context internal registry
ctx.Set("greeting", "Hello")
ctx.Logger.Info("worker init")

address := fakeModelLoader(ctx.Path("models/model.joblib"))
ctx.Configuration.Set("model", address)
}
```

Expand Down

0 comments on commit 6d9cb29

Please sign in to comment.