【问题标题】:Using kfp.dls.containerOp() to run multiple scripts on Kubeflow Pipelines使用 kfp.dls.containerOp() 在 Kubeflow Pipelines 上运行多个脚本
【发布时间】:2021-11-28 01:16:19
【问题描述】:

我一直在使用 Kubeflow dsl container 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'
]

不确定是否可行。非常感谢您的帮助。

【问题讨论】:

    标签: kubernetes kubeflow kubeflow-pipelines


    【解决方案1】:

    Kubeflow 作业只是一个 Kubernetes 作业,因此您受限于 Kubernetes 作业入口点是单个命令。 但是,您仍然可以将多个命令链接到一个 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'
    ]
    

    【讨论】:

      猜你喜欢
      • 2021-09-21
      • 2021-07-08
      • 2021-11-11
      • 2020-08-10
      • 1970-01-01
      • 2022-10-06
      • 2020-07-29
      • 2020-07-01
      • 2021-12-02
      相关资源
      最近更新 更多