Skip to content

Commit

Permalink
active deadline seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
marekliszka committed Oct 13, 2023
1 parent a767403 commit 133bb73
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions kubeluigi/__init__.py
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion kubeluigi/k8s.py
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 133bb73

Please sign in to comment.