Skip to content

Commit

Permalink
remove duplicate volumes (#558)
Browse files Browse the repository at this point in the history
* remove duplicate volumes

* add a todo
  • Loading branch information
gaoning777 authored and k8s-ci-robot committed Dec 18, 2018
1 parent a23abf8 commit b313e40
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sdk/python/kfp/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,15 @@ def _create_templates(self, pipeline):
def _create_volumes(self, pipeline):
"""Create volumes required for the templates"""
volumes = []
volume_name_set = set()
for op in pipeline.ops.values():
if op.volumes:
for v in op.volumes:
volumes.append(self._convert_k8s_obj_to_dic(v))
# Remove volume duplicates which have the same name
#TODO: check for duplicity based on the serialized volumes instead of just name.
if v.name not in volume_name_set:
volume_name_set.add(v.name)
volumes.append(self._convert_k8s_obj_to_dic(v))
volumes.sort(key=lambda x: x['name'])
return volumes

Expand Down

0 comments on commit b313e40

Please sign in to comment.