Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArgumentError: Distributed.var doesn't have a defined StructTypes.StructType #190

Open
etjekant opened this issue Feb 20, 2023 · 2 comments

Comments

@etjekant
Copy link

Hey, I am running a function (That returns an interger) using the @sync @distributed macros in Julia. The function runs completely but upon returning I get the following error:

Error: error handling request │ exception = │ ArgumentError: Distributed.var"#165#167"{var"#1344#1348"{Vector{Vector{String}}}, Base.OneTo{Int64}} doesn't have a definedStructTypes.StructType │ Stacktrace: │ [1] write(::StructTypes.NoStructType, buf::Vector{UInt8}, pos::Int64, len::Int64, ::Distributed.var"#165#167"{var"#1344#1348"{Vector{Vector{String}}}, Base.OneTo{Int64}}; kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) │ @ JSON3 ~/.julia/packages/JSON3/CpNms/src/write.jl:92 │ [2] write(::StructTypes.NoStructType, buf::Vector{UInt8}, pos::Int64, len::Int64, ::Distributed.var"#165#167"{var"#1344#1348"{Vector{Vector{String}}}, Base.OneTo{Int64}}) │ @ JSON3 ~/.julia/packages/JSON3/CpNms/src/write.jl:92 │ [3] (::JSON3.WriteClosure{Vector{UInt8}, NamedTuple{(), Tuple{}}})(i::Int64, nm::Symbol, TT::Type, v::Function; kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) │ @ JSON3 ~/.julia/packages/JSON3/CpNms/src/write.jl:122 │ [4] WriteClosure │ @ ~/.julia/packages/JSON3/CpNms/src/write.jl:113 [inlined] │ [5] foreachfield(f::JSON3.WriteClosure{Vector{UInt8}, NamedTuple{(), Tuple{}}}, x::Task) │ @ StructTypes ~/.julia/packages/StructTypes/AK4aM/src/StructTypes.jl:676 │ [6] write(::StructTypes.UnorderedStruct, buf::Vector{UInt8}, pos::Int64, len::Int64, x::Task; kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) │ @ JSON3 ~/.julia/packages/JSON3/CpNms/src/write.jl:133 │ [7] write(::StructTypes.UnorderedStruct, buf::Vector{UInt8}, pos::Int64, len::Int64, x::Task) │ @ JSON3 ~/.julia/packages/JSON3/CpNms/src/write.jl:131 │ [8] write(::StructTypes.DictType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::Dict{Symbol, Any}; kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) │ @ JSON3 ~/.julia/packages/JSON3/CpNms/src/write.jl:156 │ [9] write(::StructTypes.DictType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::Dict{Symbol, Any}) │ @ JSON3 ~/.julia/packages/JSON3/CpNms/src/write.jl:147 │ [10] write(::StructTypes.DictType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::Dict{String, Any}; kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) │ @ JSON3 ~/.julia/packages/JSON3/CpNms/src/write.jl:156 │ [11] write(::StructTypes.DictType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::Dict{String, Any}) │ @ JSON3 ~/.julia/packages/JSON3/CpNms/src/write.jl:147 │ [12] write(::StructTypes.DictType, buf::Vector{UInt8}, pos::Int64, len::Int64, x::Dict{Symbol, Any}; kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) │ @ JSON3 ~/.julia/packages/JSON3/CpNms/src/write.jl:156 │ [13] write │ @ ~/.julia/packages/JSON3/CpNms/src/write.jl:147 [inlined] │ [14] write(obj::Dict{Symbol, Any}; kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) │ @ JSON3 ~/.julia/packages/JSON3/CpNms/src/write.jl:39 │ [15] write(obj::Dict{Symbol, Any}) │ @ JSON3 ~/.julia/packages/JSON3/CpNms/src/write.jl:37 │ [16] process_callback(request::HTTP.Messages.Request, state::Dash.HandlerState) │ @ Dash ~/.julia/packages/Dash/yscRy/src/handler/processors/callback.jl:78 │ [17] try_handle │ @ ~/.julia/packages/Dash/yscRy/src/HttpHelpers/router.jl:51 [inlined] │ [18] try_handle(route::Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_callback)}}, path::SubString{String}, request::HTTP.Messages.Request, args::Dash.HandlerState) │ @ Dash.HttpHelpers ~/.julia/packages/Dash/yscRy/src/HttpHelpers/router.jl:97 │ [19] _handle │ @ ~/.julia/packages/Dash/yscRy/src/HttpHelpers/router.jl:101 [inlined] │ [20] _handle (repeats 6 times) │ @ ~/.julia/packages/Dash/yscRy/src/HttpHelpers/router.jl:102 [inlined] │ [21] handle(route_tuple::Tuple{Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_layout)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_dependencies)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_reload_hash)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_default_favicon)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.DynamicRoute{Tuple{Tuple{Int64, String}}, NamedTuple{(:path, :namespace), Tuple{Int64, Int64}}}, typeof(Dash.process_resource)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.DynamicRoute{Tuple{Tuple{Int64, String}}, NamedTuple{(:file_path,), Tuple{Int64}}}, typeof(Dash.process_assets)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_callback)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.DynamicRoute{Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Dash.process_index)}}, Dash.HttpHelpers.Route{Dash.HttpHelpers.RouteHandler{Dash.HttpHelpers.StaticRoute, typeof(Dash.process_index)}}}, path::SubString{String}, request::HTTP.Messages.Request, args::Dash.HandlerState) │ @ Dash.HttpHelpers ~/.julia/packages/Dash/yscRy/src/HttpHelpers/router.jl:112 │ [22] handle(router::Dash.HttpHelpers.Router, request::HTTP.Messages.Request, args::Dash.HandlerState) │ @ Dash.HttpHelpers ~/.julia/packages/Dash/yscRy/src/HttpHelpers/router.jl:129 │ [23] (::Dash.HttpHelpers.var"#1#2"{Dash.HttpHelpers.Router, Dash.HandlerState})(::HTTP.Messages.Request) │ @ Dash.HttpHelpers ~/.julia/packages/Dash/yscRy/src/HttpHelpers/handlers.jl:4 │ [24] handle │ @ ~/.julia/packages/HTTP/aTjcj/src/Handlers.jl:254 [inlined] │ [25] (::Dash.HttpHelpers.var"#7#8"{Dash.var"#68#70"{Dash.DashApp}, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var"#1#2"{Dash.HttpHelpers.Router, Dash.HandlerState}}})(::HTTP.Messages.Request) │ @ Dash.HttpHelpers ~/.julia/packages/Dash/yscRy/src/HttpHelpers/handlers.jl:48 │ [26] handle │ @ ~/.julia/packages/HTTP/aTjcj/src/Handlers.jl:254 [inlined] │ [27] (::Dash.HttpHelpers.var"#4#5"{Vector{String}, Int64, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var"#7#8"{Dash.var"#68#70"{Dash.DashApp}, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var"#1#2"{Dash.HttpHelpers.Router, Dash.HandlerState}}}}})(::HTTP.Messages.Request) │ @ Dash.HttpHelpers ~/.julia/packages/Dash/yscRy/src/HttpHelpers/handlers.jl:27 │ [28] handle │ @ ~/.julia/packages/HTTP/aTjcj/src/Handlers.jl:254 [inlined] │ [29] handle(::HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var"#4#5"{Vector{String}, Int64, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var"#7#8"{Dash.var"#68#70"{Dash.DashApp}, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var"#1#2"{Dash.HttpHelpers.Router, Dash.HandlerState}}}}}}, ::HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}) │ @ HTTP.Handlers ~/.julia/packages/HTTP/aTjcj/src/Handlers.jl:277 │ [30] #4 │ @ ~/.julia/packages/HTTP/aTjcj/src/Handlers.jl:351 [inlined] │ [31] macro expansion │ @ ~/.julia/packages/HTTP/aTjcj/src/Servers.jl:415 [inlined] │ [32] (::HTTP.Servers.var"#13#14"{HTTP.Handlers.var"#4#5"{HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var"#4#5"{Vector{String}, Int64, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var"#7#8"{Dash.var"#68#70"{Dash.DashApp}, HTTP.Handlers.RequestHandlerFunction{Dash.HttpHelpers.var"#1#2"{Dash.HttpHelpers.Router, Dash.HandlerState}}}}}}}, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}, HTTP.Servers.Server{Nothing, Sockets.TCPServer}, HTTP.Streams.Stream{HTTP.Messages.Request, HTTP.ConnectionPool.Transaction{Sockets.TCPSocket}}})() │ @ HTTP.Servers ./task.jl:417 └ @ Dash ~/.julia/packages/Dash/yscRy/src/handler/make_handler.jl:61

image
image

@etjekant
Copy link
Author

Also in png:
image

@etpinard
Copy link
Collaborator

Thanks for writing in!

In brief, the error stacktrace implies that your callback output value does not have defined method for lowering its content to JSON - the data format that Dash.jl used to return data from the Julia backend to JavaScript frontend.

I'm not familiar with @distributed outputs, but perhaps there's a way to define a custom lower method similar to

image

taken https://quinnj.github.io/JSON3.jl/stable/#Struct-API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants