Skip to content

Commit

Permalink
Support the k8s_job_ttl_secs_after_finished option as in the Galaxy
Browse files Browse the repository at this point in the history
Kubernetes runner
  • Loading branch information
natefoo committed Oct 8, 2021
1 parent 7f21ae2 commit 8432a16
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pulsar/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,7 @@ def launch(
}
}
spec = {"template": template}
if "k8s_walltime_limit" in params:
spec["activeDeadlineSeconds"] = int(params["k8s_walltime_limit"])
spec.update(self._job_spec_params(params))
k8s_job_obj = job_object_dict(params, job_name, spec)
pykube_client = self._pykube_client
job = Job(pykube_client, k8s_job_obj)
Expand Down Expand Up @@ -574,6 +573,14 @@ def _k8s_job_name(self):
job_name = produce_unique_k8s_job_name(app_prefix="pulsar", job_id=job_id, instance_id=self.instance_id)
return job_name

def _job_spec_params(self, params):
spec = {}
if "k8s_walltime_limit" in params:
spec["activeDeadlineSeconds"] = int(params["k8s_walltime_limit"])
if "k8s_job_ttl_secs_after_finished" in params and params.get("k8s_cleanup_job") != "never":
spec["ttlSecondsAfterFinished"] = int(params["k8s_job_ttl_secs_after_finished"])
return spec

def _pulsar_container_resources(self, params):
return self._container_resources(params, container='pulsar')

Expand Down

0 comments on commit 8432a16

Please sign in to comment.