pythonmlrunnuclio

MLRun, Issue with memory request setup (1B) for nuclio function


I have issue with memory request setup for nuclio function, current memory request has value 1B, see info in Grafana:

enter image description here

I used this code:

fn.add_model("prt-model", class_name="ClassifierPRT", model_path="tst")
fn.apply(mlrun.mount_v3io())

# Set resources
fn.with_http(2)
fn.with_requests(mem="500m", cpu=0.5)
fn.with_limits(mem="1G", cpu=1)

fn.spec.replicas = 2
fn.spec.min_replicas = 2
fn.spec.max_replicas = 2

project.save()

Did you have similar issue?


Solution

  • I solved the same problem, the issue is, that you use a invalid unit "500m", you have to use these quantity suffixes 'E, P, T, G, M, k' or you can also use the power-of-two equivalents 'Ei, Pi, Ti, Gi, Mi, Ki'. See official documentation k8s meaning-of-memory.

    Relevant value is "500M" (x1.000 K) or "500Mi" (x 1.024 Ki), updated code, see:

    ...
    fn.with_requests(mem="500Mi", cpu=0.5)
    fn.with_limits(mem="3G", cpu=2)
    ...