[英]What is the correct way for share dataframes between components?
I am working with a legacy project of Kubeflow, the pipelines have a few components in order to apply some kind of filters to data frame.我正在使用 Kubeflow 的遗留项目,管道有一些组件,以便将某种过滤器应用于数据框。
In order to do this, each component downloads the data frame from S3 applies the filter and uploads it into S3 again.为了做到这一点,每个组件从 S3 下载数据帧应用过滤器并再次将其上传到 S3。
In the components where the data frame is used for training or validating the models, download from S3 the data frame.在数据框用于训练或验证模型的组件中,从 S3 下载数据框。
The question is about if this is a best practice, or is better to share the data frame directly between components, because the upload to the S3 can fail, and then fail the pipeline.问题是这是否是最佳实践,或者直接在组件之间共享数据帧更好,因为上传到 S3 可能会失败,然后管道失败。
Thanks谢谢
As always with questions asking for "best" or "recommended" method, the primary answer is: "it depends".与询问“最佳”或“推荐”方法的问题一样,主要答案是:“视情况而定”。
However, there are certain considerations worth spelling out in your case.但是,在您的情况下,有一些值得说明的注意事项。
Saving to S3 in between pipeline steps.在管道步骤之间保存到 S3。 This stores intermediate result of the pipeline and as long as the steps take long time and are restartable it may be worth doing that.
这存储了管道的中间结果,只要这些步骤需要很长时间并且可以重新启动,就值得这样做。 What "long time" means is dependent on your use case though.
不过,“长时间”的含义取决于您的用例。
Passing the data directly from component to component.将数据直接从组件传递到组件。 This saves you storage throughput and very likely the not insignificant time to store and retrieve the data to / from S3.
这为您节省了存储吞吐量,并且很可能节省了在 S3 中存储和检索数据的时间。 The downside being: if you fail mid-way in the pipeline, you have to start from scratch.
缺点是:如果你在管道中途失败,你必须从头开始。
So the questions are:所以问题是:
The question is about if this is a best practice
问题是这是否是最佳实践
The best practice is to use the file-based I/O and built-in data-passing features.最佳实践是使用基于文件的 I/O 和内置的数据传递功能。 The current implementation uploads the output data to storage in upstream components and downloads the data in downstream components.
当前实现将 output 数据上传到上游组件中的存储,并下载下游组件中的数据。 This is the safest and most portable option and should be used until you see that it no longer works for you (100GB datasets will probably not work reliably).
这是最安全、最便携的选项,应该一直使用,直到您发现它不再适合您(100GB 数据集可能无法可靠地工作)。
or is better to share the data frame directly between components
或者直接在组件之间共享数据框更好
How can you "directly share" in-memory python object between different python programs running in containers on different machines?如何在不同机器上的容器中运行的不同 python 程序之间“直接共享”内存中 python object 程序?
because the upload to the S3 can fail, and then fail the pipeline.
因为上传到 S3 可能会失败,然后管道失败。
The failed pipeline can just be restarted.失败的管道可以重新启动。 The caching feature will make sure that already finished tasks won't be re-executed.
缓存功能将确保已经完成的任务不会被重新执行。
Anyways, what is the alternative?无论如何,有什么替代方案? How can you send the data between distributed containerized programs without sending it over the network?
如何在分布式容器化程序之间发送数据而不通过网络发送?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.