gpt4 book ai didi

asynchronous - Task.async_stream药剂返回奇怪的输出

转载 作者:行者123 更新时间:2023-12-02 09:51:20 24 4
gpt4 key购买 nike

使用Task.async_stream可以将许多文件上传到S3。

尝试在具有URL和ID关键字列表的download_many函数中使用它。当我在iex会话中运行download_many函数时,它将返回以下输出:

iex(1)> Karma.S3.download_many(1)
#Function<1.112846234/2 in Task.build_stream/3>
#Function<1.112846234/2 in Task.build_stream/3>


这是函数:

def download_many(_urls) do
urls = [
“5”: “https://engine-image-uploads.s3.amazonaws.com/engine-image-uploads/d4a9f8adb58b4e0b83c47e8f3b21d421-fillable.pdf“,
“3”: “https://engine-image-uploads.s3.amazonaws.com/engine-image-uploads/ccd6d66cb4304b369a025efe3b26e68b-fillable.pdf”
]

ops = [max_concurrency: System.schedulers_online() * 3, timeout: 20000]

tasks = Task.async_stream(urls, &download_with_id/1, ops)
|> Enum.to_list()
IO.inspect tasks
end

def download_with_id({id, url}) do
file_destination = System.cwd() <> “/tmp/altered_document_” <> Atom.to_string(id) <> “.pdf”
download(url, file_destination)
|> Tuple.insert_at(2, id)
end


以及该文件的链接: https://github.com/karmaradio/karma/blob/async-download_many/lib/S3.ex#L58

我不明白输出内容: #Function<1.112846234/2 in Task.build_stream/3>

有没有人经历过类似的事情?

提前致谢!

最佳答案

this comment中由dogbert回答

关于asynchronous - Task.async_stream药剂返回奇怪的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44828367/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com