Skip to content

Commit

Permalink
Fix kubeflow#3906 - check that ops to be transformed is a containerOp
Browse files Browse the repository at this point in the history
  • Loading branch information
eterna2 committed Jun 4, 2020
1 parent 1403b9b commit 5e3a191
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sdk/python/kfp/onprem.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@

def mount_pvc(pvc_name='pipeline-claim', volume_name='pipeline', volume_mount_path='/mnt/pipeline'):
"""
Modifier function to apply to a Container Op to simplify volume, volume mount addition and
Modifier function to apply to a Container Op to simplify volume, volume mount addition and
enable better reuse of volumes, volume claims across container ops.
Usage:
train = train_op(...)
train.apply(mount_pvc('claim-name', 'pipeline', '/mnt/pipeline'))
"""
def _mount_pvc(task):
from kubernetes import client as k8s_client
# there can be other ops in a pipeline (e.g. ResourceOp, VolumeOp)
# refer to #3906
if not hasattr(task, "add_volume") or not hasattr(task, "add_volume_mount"):
return task
local_pvc = k8s_client.V1PersistentVolumeClaimVolumeSource(claim_name=pvc_name)
return (
task
Expand Down

0 comments on commit 5e3a191

Please sign in to comment.