AntreasAntoniou/kubejobs

`gpu_limit` used as it is never `None`

Closed this issue · 0 comments

from kubejobs.jobs import KubernetesJob

# Create a Kubernetes Job with a name, container image, and command
job = KubernetesJob(
    name="my-job",
    image="ubuntu:20.04",
    command=["/bin/bash", "-c", "echo 'Hello, World!'"],
)

# Generate the YAML configuration for the Job
print(job.generate_yaml())

# Run the Job on the Kubernetes cluster
job.run()

yields this:

Traceback (most recent call last):
  File "XXX/pminervini/hello.py", line 4, in <module>
    job = KubernetesJob(
          ^^^^^^^^^^^^^^
  File "XXX/pminervini/miniconda3/lib/python3.11/site-packages/kubejobs/jobs.py", line 129, in __init__
    else MAX_CPU // (MAX_GPU - gpu_limit + 1)
                     ~~~~~~~~^~~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'int' and 'NoneType'