【问题标题】:Machine Learning DAG of dockerized algorithm, Luigi / Airflow / Celerydockerized 算法的机器学习 DAG,Luigi / Airflow / Celery
【发布时间】:2018-04-05 18:48:55
【问题描述】:

我正在构建一个可以表示为有向无环图的深度学习管道。我创建了图形的简化表示 -> Algorithm DAG。每个节点都是一个 docker 容器,运行不同的 ML/DL 算法。我让每个节点自己工作,但现在我正试图让所有东西一起运行。到目前为止,我的方法一直是使用 Rabbit MQ 在不同的容器之间进行通信。如果我一个接一个地发送图像并等待输出,它会起作用,但是从长远来看,第一个节点将接收到连续的图像流。

我一直在研究各种库和框架,例如 Luigi、Celery 和 Airflow,但我仍然犹豫哪一个最适合我的问题。算法可能会发生变化,我想要一个动态分配资源(包括 GPU)的系统。例如,也许我的管道的 v1 将以相同的速度运行 A-C 和 B,但 v2 的 B 运行速度会快两倍,在这种情况下,我的系统会自动调整以适应变化。

我已经阅读了一些关于该主题的内容: https://groups.google.com/forum/#!topic/airbnb_airflow/lzAqI1D9wsg 只要我的每个节点都有单独的环境,我就可以使用除 docker 之外的其他东西。

【问题讨论】:

    标签: docker celery airflow directed-acyclic-graphs luigi


    【解决方案1】:

    要从 Airflow 运行 Docker 容器,请使用 KubernetesPodOperator 或 DockerOperator。

    使用 KubernetesPodOperator(来自Cloud Composer documentation):

    # Only name, namespace, image, and task_id are required to create a
    # KubernetesPodOperator. In Cloud Composer, currently the operator defaults
    # to using the config file found at `/home/airflow/composer_kube_config if
    # no `config_file` parameter is specified. By default it will contain the
    # credentials for Cloud Composer's Google Kubernetes Engine cluster that is
    # created upon environment creation.
    kubernetes_min_pod = kubernetes_pod_operator.KubernetesPodOperator(
        # The ID specified for the task.
        task_id='pod-ex-minimum',
        # Name of task you want to run, used to generate Pod ID.
        name='pod-ex-minimum',
        # Entrypoint of the container, if not specified the Docker container's
        # entrypoint is used. The cmds parameter is templated.
        cmds=['echo'],
        # The namespace to run within Kubernetes, default namespace is
        # `default`. There is the potential for the resource starvation of
        # Airflow workers and scheduler within the Cloud Composer environment,
        # the recommended solution is to increase the amount of nodes in order
        # to satisfy the computing requirements. Alternatively, launching pods
        # into a custom namespace will stop fighting over resources.
        namespace='default',
        # Docker image specified. Defaults to hub.docker.com, but any fully
        # qualified URLs will point to a custom repository. Supports private
        # gcr.io images if the Composer Environment is under the same
        # project-id as the gcr.io images.
        image='gcr.io/gcp-runtimes/ubuntu_16_0_4')
    

    也就是说,如果您没有绑定到 Airflow 并且每个节点都是一个 Docker 容器,您可能希望使用云原生工作流运行器,例如 Argo

    【讨论】:

      猜你喜欢
      • 2011-08-01
      • 1970-01-01
      • 2012-03-14
      • 2015-10-06
      • 2014-06-23
      • 2017-08-21
      • 1970-01-01
      • 2011-12-21
      • 2018-09-05
      相关资源
      最近更新 更多