提问者:小点点

使用kfp. dls.容器Op()在Kubeflow管道上运行多个脚本


我一直在使用Kubeflow dsl容器op命令在我的Kubeflow管道的自定义上运行python脚本。我的配置如下所示:

def test_container_op():
    input_path = '/home/jovyan/'
    return dsl.ContainerOp(
        name='test container',
        image="<image name>",
        command=[
             'python', '/home/jovyan/test.py'
        ],
        file_outputs={
            'modeule-logs' : input_path + 'output.log' 
        }
    )

现在,我还想在同一个容器中运行一个名为deploy.sh的bash脚本。我还没有看到这样的例子。有没有类似的东西

command = [
'/bin/bash', '/home/jovyan/deploy.sh',
'python', '/home/jovyan/test.py'
]

不确定是否可能。会很感激你的帮助。


共1个答案

匿名用户

Kubeflow作业只是一个库伯内特斯作业,因此您受到库伯内特斯作业入口点是单个命令的限制。但是,您仍然可以将多个命令链接到单个sh命令中:

sh -c "echo 'my first job' && echo 'my second job'"

这样你的kubeflow命令就可以:

command = [
'/bin/sh', '-c', '/home/jovyan/deploy.sh && python /home/jovyan/test.py'
]