Skip to content

Commit ed935f1

Browse files
committed
Used kubernetes-typed module for correct typing in build_yaml
1 parent 42a4530 commit ed935f1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

batchtools/build_yaml.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# pyright: reportExplicitAny=false
2-
from typing import Any
1+
# pyright: reportUnusedParameter=false
2+
from kubernetes_typed.client import V1JobDict, V1ResourceRequirementsDict
33

44
rsync_script = """
55
set -e
@@ -41,10 +41,12 @@ def build_job_body(
4141
context_dir: str,
4242
jobs_dir: str,
4343
getlist_path: str,
44-
) -> dict[str, Any]:
44+
) -> V1JobDict:
4545
"""
4646
Build a batch/v1 Job as a dict to pass to oc.create()
4747
"""
48+
49+
resources: V1ResourceRequirementsDict
4850
if gpu == "none":
4951
resources = {
5052
"requests": {"cpu": "1", "memory": "1Gi"},
@@ -67,7 +69,7 @@ def build_job_body(
6769
else:
6870
command = ["/bin/bash", "-c", cmdline]
6971

70-
body = {
72+
body: V1JobDict = {
7173
"apiVersion": "batch/v1",
7274
"kind": "Job",
7375
"metadata": {

0 commit comments

Comments
 (0)