Skip to content

Commit

Permalink
Fix: Set version endpoint created and updated time on initialization (#…
Browse files Browse the repository at this point in the history
…480)

<!--  Thanks for sending a pull request!  Here are some tips for you:

1. Run unit tests and ensure that they are passing
2. If your change introduces any API changes, make sure to update the
e2e tests
3. Make sure documentation is updated for your PR!

-->

**What this PR does / why we need it**:
<!-- Explain here the context and why you're making the change. What is
the problem you're trying to solve. --->

After using jobArgs.Endpoint data as the [reference
value](https://github.com/caraml-dev/merlin/blob/v0.34.0/api/queue/work/model_service_deployment.go#L61)
for the deployment, the CreatedUpdated value is set to the time default
value (`0001-01-01 00:00:00 +0000 UTC`) which could lead to DB update to
use this value. This PR fixes it by getting the created_at and
updated_at from version_endpoints DB so that it can be updated
correctly.

**Which issue(s) this PR fixes**:
<!--
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->

Fixes wrong created_at value on version_endpoints

**Does this PR introduce a user-facing change?**:
<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required. Enter your extended release note in
the block below.
If the PR requires additional action from users switching to the new
release, include the string "action required".

For more information about release notes, see kubernetes' guide here:
http://git.k8s.io/community/contributors/guide/release-notes.md
-->

```release-note

```

**Checklist**

- [ ] Added unit test, integration, and/or e2e tests
- [x] Tested locally
- [ ] Updated documentation
- [ ] Update Swagger spec if the PR introduce API changes
- [ ] Regenerated Golang and Python client if the PR introduce API
changes
  • Loading branch information
ariefrahmansyah authored Oct 31, 2023
1 parent 8f5c73b commit 36993fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions api/models/version_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package models

import (
"net/url"
"time"

"github.com/caraml-dev/merlin/pkg/autoscaling"
"github.com/caraml-dev/merlin/pkg/deployment"
Expand Down Expand Up @@ -102,6 +103,10 @@ func NewVersionEndpoint(env *Environment, project mlp.Project, model *Model, ver
AutoscalingPolicy: autoscalingPolicy,
EnvVars: envVars,
Protocol: protocol.HttpJson,
CreatedUpdated: CreatedUpdated{
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
}

if monitoringConfig.MonitoringEnabled {
Expand Down
2 changes: 1 addition & 1 deletion python/sdk/test/pyfunc/env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dependencies:
- python=3.10.*
- pip:
- joblib>=0.13.0,<1.2.0 # >=1.2.0 upon upgrade of kserve's version
- numpy
- numpy<=1.23.5 # Temporary pin numpy due to https://numpy.org/doc/stable/release/1.20.0-notes.html#numpy-1-20-0-release-notes
- scikit-learn==1.0.2 #TODO: >=1.1.2 upon python 3.7 deprecation
- xgboost==1.6.2
- pytest
Expand Down

0 comments on commit 36993fc

Please sign in to comment.