Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

I am attempting to execute the tutorial notebook found at: MLRun Model Monitoring and Drift Detection.

However, while running this line - project.deploy_function(serving_fn) I encounter the following error:

[error] error submitting build task: 400 Client Error: Bad Request for url: http://localhost:8080/api/v1/build/function: details: {'reason': "Runtime error: 'K8sHelper' object has no attribute 'v1api'"}, caused by: 400 Client Error: Bad Request for url: http://localhost:8080/api/v1/build/function

I did some testing and figured out that this issue specifically arises when I use the following line of code:

serving_fn.set_tracking() #for enabling model monitoring

If I comment out this line, the deployment proceeds without issues using project.deploy_function(serving_fn)

However, if I execute serving_fn.set_tracking(), I receive the previously mentioned error. The error message suggests that the deployment is looking for a Kubernetes cluster, but I have not configured one and am using Docker instead.

Could there be a parameter that can be set to direct the deployment to a local (Docker) environment? I tried setting local = True here:

serving_fn.add_model( "cancer-classifier", model_path=trainer_run.outputs["model"], class_name="mlrun.frameworks.sklearn.SklearnModelServer", local =True)

but it didn't solve the issue.

MLRun is installed on Docker. I can access the following components:
MLRun UI (in http://localhost:8060/)
Nuclio Dashboard/controller (in http://localhost:8070/)
MLRun API (in http://localhost:8080/) --> returns {"detail":"Not Found"}

I run the tutorial code in my IDE and I can see the project in the MLRun UI. Everything seems to work fine but when it comes to serving a function using the deploy_function it fails with the above error. It would be very nice if someone could tell me what's wrong with the configuration or what is supposed to be the API call that would work.

You must be logged in to vote

Replies: 1 comment

Comment options

Problem Overview

You're encountering an error with serving_fn.set_tracking() in MLRun, which is related to model monitoring. The error happens because MLRun expects a Kubernetes environment, but you're using Docker.

Solution Steps

1. Use the local runtime

Tell MLRun to deploy locally instead of trying to use Kubernetes:

serving_fn.spec.default_class = "mlrun.frameworks.sklearn.SklearnModelServer"

serving_fn.add_model(
    "cancer-classifier",
    model_path=trainer_run.outputs["model"],
    class_name="mlrun.frameworks.sklearn.SklearnModelServer"
)

serving_fn.set_tracking()  # Enable tracking
project.deploy_function(serving_fn, local=True)  # Deploy locally

2. Skip set_tracking()

If you don't need monitoring, simply avoid calling set_tracking(). The function should deploy without errors:

serving_fn.add_model(
    "cancer-classifier",
    model_path=trainer_run.outputs["model"],
    class_name="mlrun.frameworks.sklearn.SklearnModelServer"
)
project.deploy_function(serving_fn)

3. Use a lightweight Kubernetes setup

If monitoring is essential, you’ll need Kubernetes. Tools like Minikube or k3d can run Kubernetes on your local machine.

Common Troubleshooting

  1. Verify MLRun and Nuclio Versions: Ensure they are compatible (MLRun Compatibility Matrix).
  2. Check MLRun API: Make sure the API at http://localhost:8080 is running correctly:
docker logs <mlrun-container-id>
  1. Configure Monitoring Storage: Use a local logs path for tracking:
serving_fn.set_tracking(logs_path="/path/to/logs")

I hope your problem will be solved !!!
TheSilentHack

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.