From 133bb73626dd79a96bb3e74281120c730c24a5c2 Mon Sep 17 00:00:00 2001 From: marekliszka Date: Fri, 13 Oct 2023 08:33:24 +0200 Subject: [PATCH] active deadline seconds --- kubeluigi/__init__.py | 5 +++++ kubeluigi/k8s.py | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/kubeluigi/__init__.py b/kubeluigi/__init__.py index 389814a..2736c99 100644 --- a/kubeluigi/__init__.py +++ b/kubeluigi/__init__.py @@ -39,6 +39,10 @@ def _init_kubernetes(self): def restart_policy(self): return "Never" + @property + def active_deadline_seconds(self): + return None + @property def backoff_limit(self): """ @@ -92,6 +96,7 @@ def build_job_definition(self) -> V1Job: pod_template_spec=pod_template_spec, labels=self.labels, namespace=self.namespace, + active_deadline_seconds=self.active_deadline_seconds ) return job diff --git a/kubeluigi/k8s.py b/kubeluigi/k8s.py index 62406aa..11191b6 100644 --- a/kubeluigi/k8s.py +++ b/kubeluigi/k8s.py @@ -105,6 +105,7 @@ def job_definition( pod_template_spec: V1PodTemplateSpec, labels: Dict[str, str], namespace: str, + active_deadline_seconds=None ) -> V1Job: """ returns a job object describing a k8s job. @@ -115,7 +116,7 @@ def job_definition( api_version="batch/v1", kind="Job", metadata=V1ObjectMeta(name=job_name, labels=labels, namespace=namespace), - spec=V1JobSpec(template=pod_template_spec, backoff_limit=backoff_limit), + spec=V1JobSpec(template=pod_template_spec, backoff_limit=backoff_limit, active_deadline_seconds=active_deadline_seconds), ) return job