mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #10307 from nuwang/fix_k8s_job_id_clash
[20.01] Ensure that k8s job ids are unique
This commit is contained in:
@@ -226,7 +226,7 @@ class KubernetesJobRunner(AsynchronousJobRunner):
|
||||
(see pod selector) and an appropriate restart policy."""
|
||||
k8s_spec_template = {
|
||||
"metadata": {
|
||||
"labels": {"app": self.__produce_unique_k8s_job_name(ajs.job_wrapper.get_id_tag())}
|
||||
"labels": {"app": self.__produce_unique_k8s_job_name(ajs.job_wrapper.get_id_tag())[:-5]}
|
||||
},
|
||||
"spec": {
|
||||
"volumes": self.runner_params['k8s_mountable_volumes'],
|
||||
@@ -526,7 +526,7 @@ class KubernetesJobRunner(AsynchronousJobRunner):
|
||||
"""Attempts to delete a dispatched job to the k8s cluster"""
|
||||
job = job_wrapper.get_job()
|
||||
try:
|
||||
name = self.__produce_unique_k8s_job_name(job.get_id_tag())
|
||||
name = job.job_runner_external_id
|
||||
namespace = self.runner_params['k8s_namespace']
|
||||
job_to_delete = find_job_object_by_name(self._pykube_api, name, namespace)
|
||||
if job_to_delete:
|
||||
|
||||
@@ -57,7 +57,7 @@ def produce_unique_k8s_job_name(app_prefix=None, instance_id=None, job_id=None):
|
||||
if instance_id and len(instance_id) > 0:
|
||||
job_name += "%s-" % instance_id
|
||||
|
||||
return job_name + job_id
|
||||
return "{}{}-{}".format(job_name, job_id, uuid.uuid4())
|
||||
|
||||
|
||||
def pull_policy(params):
|
||||
|
||||
Reference in New Issue
Block a user