我正在尝试使用PyCall导入使用Python库NetworkX和Matplotlib的我的一个程序,它返回一个我无法理解的奇怪错误。
该计划是:
@everywhere function runTestGrid(;lenghtGrid=6,heightGrid=6,redundancyRange=0.1:0.1:0.1,failsRange=1:1:1,repetitionNumber=1,failType=1)
d1 = length(redundancyRange)
d2 = length(failsRange)
d3 = repetitionNumber
grid_data = SharedArray{Float64,3}((d1,d2,d3),init=0)
nNodes = lenghtGrid*heightGrid - 1
@sync @parallel for redundancyIndex in 1:1:d1
redundancyValue = redundancyRange[redundancyIndex]
gGrid = nx.grid_2d_graph(lenghtGrid,heightGrid,periodic=true)
tGrid = nx.minimum_spanning_tree(gGrid)
sGrid = System(gGrid,tGrid,redundancyValue)
for repetitionIndex in 1:1:d3
notServed = failureRecoveryRun(copySystem(sGrid),failsRange=failsRange,failType=failType,reconnectionMethod="single_route")
for nFailsIndex in 1:1:d2
grid_data[redundancyIndex,nFailsIndex,repetitionIndex] = (nNodes - notServed[nFailsIndex])/nNodes
end
end
end
writeDataFile("grid_data.txt",grid_data)
end
我收到错误消息:
ERROR: LoadError: On worker 2:
UndefVarError: __anon__ not defined
deserialize_module at ./serialize.jl:754
handle_deserialize at ./serialize.jl:695
deserialize at ./serialize.jl:634
handle_deserialize at ./serialize.jl:703
deserialize at ./serialize.jl:634
deserialize_expr at ./serialize.jl:882
handle_deserialize at ./serialize.jl:693
deserialize at ./serialize.jl:634
deserialize_expr at ./serialize.jl:882
handle_deserialize at ./serialize.jl:693
deserialize at ./serialize.jl:634
deserialize_expr at ./serialize.jl:882
handle_deserialize at ./serialize.jl:693
deserialize_array at ./serialize.jl:871
handle_deserialize at ./serialize.jl:672
deserialize at ./serialize.jl:1075
handle_deserialize at ./serialize.jl:723
deserialize at ./serialize.jl:782
handle_deserialize at ./serialize.jl:723
deserialize_array at ./serialize.jl:871
handle_deserialize at ./serialize.jl:672
deserialize_typename at ./serialize.jl:938
deserialize at ./distributed/clusterserialize.jl:52
handle_deserialize at ./serialize.jl:723
deserialize at ./serialize.jl:634
deserialize_datatype at ./serialize.jl:967
handle_deserialize at ./serialize.jl:676
deserialize at ./serialize.jl:634
deserialize_datatype at ./serialize.jl:993
handle_deserialize at ./serialize.jl:674
deserialize at ./serialize.jl:634
handle_deserialize at ./serialize.jl:681
deserialize_msg at ./distributed/messages.jl:98
#99 at ./event.jl:73
Stacktrace:
[1] #remotecall_fetch#141(::Array{Any,1}, ::Function, ::Function, ::Base.Distributed.Worker, ::Base.Distributed.RRID, ::Vararg{Any,N} where N) at ./distributed/remotecall.jl:354
[2] remotecall_fetch(::Function, ::Base.Distributed.Worker, ::Base.Distributed.RRID, ::Vararg{Any,N} where N) at ./distributed/remotecall.jl:346
[3] #remotecall_fetch#144(::Array{Any,1}, ::Function, ::Function, ::Int64, ::Base.Distributed.RRID, ::Vararg{Any,N} where N) at ./distributed/remotecall.jl:367
[4] remotecall_fetch(::Function, ::Int64, ::Base.Distributed.RRID, ::Vararg{Any,N} where N) at ./distributed/remotecall.jl:367
[5] call_on_owner(::Function, ::Future, ::Int64, ::Vararg{Int64,N} where N) at ./distributed/remotecall.jl:440
[6] wait(::Future) at ./distributed/remotecall.jl:455
[7] sync_end() at ./task.jl:274
[8] macro expansion at ./task.jl:303 [inlined]
[9] #runTestGrid#55(::Int64, ::Int64, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::StepRange{Int64,Int64}, ::Int64, ::Int64, ::Function) at projeto.jl:24
[10] (::#kw##runTestGrid)(::Array{Any,1}, ::#runTestGrid) at ./<missing>:0
while loading projeto.jl, in expression starting on line 257
因为第257行的代码只是对函数的调用,而我在程序中没有定义任何__anon__
变量。