aboutsummaryrefslogtreecommitdiffstats
path: root/arthur/apis/kubernetes/jobs.py
diff options
context:
space:
mode:
Diffstat (limited to 'arthur/apis/kubernetes/jobs.py')
-rw-r--r--arthur/apis/kubernetes/jobs.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/arthur/apis/kubernetes/jobs.py b/arthur/apis/kubernetes/jobs.py
index 2813122..0269561 100644
--- a/arthur/apis/kubernetes/jobs.py
+++ b/arthur/apis/kubernetes/jobs.py
@@ -9,8 +9,8 @@ from kubernetes_asyncio.client.models import V1CronJob, V1CronJobList, V1Job
async def list_cronjobs(namespace: str | None = None) -> V1CronJobList:
"""Query the Kubernetes API for a list of cronjobss in the provided namespace."""
- async with ApiClient() as api:
- api = client.BatchV1Api(api)
+ async with ApiClient() as api_client:
+ api = client.BatchV1Api(api_client)
if namespace:
return await api.list_namespaced_cron_job(namespace)
return await api.list_cron_job_for_all_namespaces()
@@ -18,15 +18,15 @@ async def list_cronjobs(namespace: str | None = None) -> V1CronJobList:
async def get_cronjob(namespace: str, cronjob_name: str) -> V1CronJob:
"""Fetch a cronjob given the name and namespace."""
- async with ApiClient() as api:
- api = client.BatchV1Api(api)
+ async with ApiClient() as api_client:
+ api = client.BatchV1Api(api_client)
return await api.read_namespaced_cron_job(cronjob_name, namespace)
async def create_job(namespace: str, job_name: str, cron_spec: dict[str, Any]) -> V1Job:
"""Create a job in the specified namespace with the given specification and name."""
- async with ApiClient() as api:
- api = client.BatchV1Api(api)
+ async with ApiClient() as api_client:
+ api = client.BatchV1Api(api_client)
return await api.create_namespaced_job(
namespace, V1Job(metadata={"name": job_name}, spec=cron_spec)
)