小编Kev*_*sen的帖子

How to run tensorflow with gpu support in docker-compose?

I want to create some neural network in tensorflow 2.x that trains on a GPU and I want to set up all the necessary infrastructure inside a docker-compose network (assuming that this is actually possible for now). As far as I know, in order to train a tensorflow model on a GPU, I need the CUDA toolkit and the NVIDIA driver. To install these dependencies natively on my computer (OS: Ubuntu 18.04) is always quite a pain, as there are …

gpu nvidia docker docker-compose tensorflow

21
推荐指数
3
解决办法
1万
查看次数

如何从 Apache Airflow 使用 DockerOperator

这个问题与理解有关 DockerOperator 和 Apache Airflow 的概念有关,所以我不确定这个站点是否正确。如果没有,请告诉我可以在哪里发布。

情况如下:我正在使用 Windows 笔记本电脑,我开发了一个非常基本的 ETL 管道,它从某个服务器中提取数据,并使用 Apache-Airflow 按计划将未处理的数据写入 MongoDB。我有一个docker-compose.yml包含三个服务的文件:MongoDB 的 mongo 服务、作为 MongoDB 管理工具的 mongo-express 服务、Apache-Airflow 的网络服务器服务和作为 Apache-Airflow 数据库后端的 postgres 服务。

到目前为止,我已经在函数中开发了一些 Python 代码,这些函数正在被 Airflow 实例使用 PythonOperator 调用。由于使用 PythonOperator 进行调试非常困难,因此我现在想尝试使用 DockerOperator。我一直在关注本教程,该教程声称使用 DockerOperator,您可以独立于操作系统开发源代码,由于 Docker 的概念“一次构建,随处运行”,代码稍后将在其上执行。

我的问题是我没有完全理解使用 DockerOperator 运行代码所需的所有必要步骤。在教程中,我有以下关于任务开发和部署的问题:

  1. 将工件与所有依赖项一起打包到 Docker 映像中。==> 这是否意味着我必须为每个任务创建一个 Dockerfile,然后使用这个 Dockerfile 构建一个图像?
  2. 公开容器中的入口点以使用 DockerOperator 调用和参数化任务。==> 你是怎么做到的?

感谢您的时间,我非常感谢!

python docker airflow

8
推荐指数
1
解决办法
4918
查看次数

循环将数据追加到数据帧-函数仅返回数据帧的最后一行

我想创建一个循环访问大量文件的函数,计算每个文件的完整案例数,然后将新行附加到具有文件“ ID”编号及其对应完整数量的现有数据帧中案件。

在下面,我创建了一个仅返回数据帧最后一行的代码。我相信我的函数只会返回最后一行,因为R在每个循环中都会覆盖我的数据帧,但是我不确定。我在网上做了很多研究如何解决这个问题,但是我找不到一个简单的解决方案(我对R非常陌生)。

在下面,您可以看到我的代码和得到的输出:

complete <- function(directory = "specdata", id = 1:332) {
  files_list <- list.files("specdata", full.names = T) # creates a list of files

  dat <- data.frame() # creates an emmpty data frame

    for (i in id) {

    data <- read.csv(files_list[i]) # reads the file "i" in the id vector 

    nobs <- sum(complete.cases(data)) # counts the number of complete cases in that file  

    data_frame <- data.frame("ID" = i, nobs) # here I want to store the number of complete …
Run Code Online (Sandbox Code Playgroud)

r

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

docker ×2

airflow ×1

docker-compose ×1

gpu ×1

nvidia ×1

python ×1

r ×1

tensorflow ×1