我已经把一个完美的工作map
变成了一个pmap
squashed_groups = pmap(group ->
reduce(squash,
DataFrame(eltypes(o), names(o), 0),
eachrow(group)
),
groups)
除了它似乎没有参与任何并行性这一事实 - 但我承认这些组大多很小 - 我收到以下错误
ERROR: LoadError: type DataFrame has no field x
Stacktrace:
[1] copy!(::Array{DataFrames.AbstractDataFrame,1}, ::Base.Generator{Array{DataFrames.AbstractDataFrame,1},DataFrames.##34#35{Base.##569#571}}) at ./abstractarray.jl:572
[2] _collect(::Type{DataFrames.AbstractDataFrame}, ::Base.Generator{Array{DataFrames.AbstractDataFrame,1},DataFrames.##34#35{Base.##569#571}}, ::Base.HasShape) at ./array.jl:363
[3] map(::Base.##569#571, ::DataFrames.GroupApplied) at /Users/morpheu5/.julia/v0.6/DataFrames/src/groupeddataframe/grouping.jl:184
[4] maptwice(::Function, ::Channel{Any}, ::Array{Any,1}, ::DataFrames.GroupedDataFrame, ::Vararg{DataFrames.GroupedDataFrame,N} where N) at ./asyncmap.jl:188
[5] wrap_n_exec_twice(::Channel{Any}, ::Array{Any,1}, ::Base.Distributed.##204#207{WorkerPool}, ::Function, ::DataFrames.GroupedDataFrame, ::Vararg{DataFrames.GroupedDataFrame,N} where N) at ./asyncmap.jl:154
[6] #async_usemap#553(::Function, ::Void, ::Function, ::##9#10, ::DataFrames.GroupedDataFrame, ::Vararg{DataFrames.GroupedDataFrame,N} where N) at ./asyncmap.jl:103
[7] (::Base.#kw##async_usemap)(::Array{Any,1}, ::Base.#async_usemap, ::Function, ::DataFrames.GroupedDataFrame, ::Vararg{DataFrames.GroupedDataFrame,N} where N) at ./<missing>:0
[8] (::Base.#kw##asyncmap)(::Array{Any,1}, ::Base.#asyncmap, ::Function, ::DataFrames.GroupedDataFrame) at ./<missing>:0
[9] #pmap#203(::Bool, ::Int64, ::Void, ::Array{Any,1}, ::Void, ::Function, ::WorkerPool, ::Function, ::DataFrames.GroupedDataFrame) at ./distributed/pmap.jl:126
[10] pmap(::WorkerPool, ::Function, ::DataFrames.GroupedDataFrame) at ./distributed/pmap.jl:101
[11] #pmap#213(::Array{Any,1}, ::Function, ::Function, ::DataFrames.GroupedDataFrame) at ./distributed/pmap.jl:156
[12] pmap(::Function, ::DataFrames.GroupedDataFrame) at ./distributed/pmap.jl:156
[13] include_from_node1(::String) at ./loading.jl:569
[14] include(::String) at ./sysimg.jl:14
[15] process_options(::Base.JLOptions) at ./client.jl:305
[16] _start() at ./client.jl:371
我想不通那是什么意思。我什至检查了我可以在某个地方使用的任何x
地方并更改了这些地方,但错误消息没有改变。内部 reduce 有点复杂,但可以使用非并行来工作map
——例如,它会产生预期的结果。
这是我阅读了所有文档但没有理解它们的情况,还是这是 Julia 中的某个错误?我在 x86_64-apple-darwin13.4.0 上运行 0.6.0。