* remove container ops * clean up * update with default size
This commit is contained in:
parent
cc85ca55c6
commit
b3c2351a02
|
|
@ -14,27 +14,28 @@
|
|||
|
||||
import kfp
|
||||
import kfp.dsl as dsl
|
||||
from kfp import components
|
||||
|
||||
@components.create_component_from_func
|
||||
def write_to_volume():
|
||||
with open("/mnt/file.txt", "w") as file:
|
||||
file.write("Hello world")
|
||||
|
||||
|
||||
@dsl.pipeline(
|
||||
name="volumeop-basic",
|
||||
description="A Basic Example on VolumeOp Usage."
|
||||
)
|
||||
def volumeop_basic(size):
|
||||
def volumeop_basic(size: str="1Gi"):
|
||||
vop = dsl.VolumeOp(
|
||||
name="create-pvc",
|
||||
resource_name="my-pvc",
|
||||
modes=dsl.VOLUME_MODE_RWO,
|
||||
size=size
|
||||
)
|
||||
|
||||
write_to_volume().add_pvolumes({"/mnt'": vop.volume})
|
||||
|
||||
cop = dsl.ContainerOp(
|
||||
name="cop",
|
||||
image="library/bash:4.4.23",
|
||||
command=["sh", "-c"],
|
||||
arguments=["echo foo > /mnt/file1"],
|
||||
pvolumes={"/mnt": vop.volume}
|
||||
)
|
||||
|
||||
if __name__ == '__main__':
|
||||
kfp.compiler.Compiler().compile(volumeop_basic, __file__ + '.yaml')
|
||||
|
|
|
|||
Loading…
Reference in New Issue