DARPA-ASKEM / sciml-service

Simulation Service provides an interface and job runner for ASKEM models.
MIT License
3 stars 1 forks source link

AMR Observables should be optional #169

Closed mwdchang closed 2 months ago

mwdchang commented 2 months ago

I suspect the AMR parsing logic expects "observable" fields to be present, but it isn't a necessary part of the AMR. The petrinet part was done in https://github.com/DARPA-ASKEM/sciml-service/pull/145, but it seems for regnet/stockflow the same optional logic need to be applied.

[ Info: 2024-04-09T19:33:16+0000 - 10.244.19.1:45354 - "GET /health HTTP/1.1" 200
┌ Error: ERROR:
│   exception =
│    KeyError: key :observables not found
│    Stacktrace:
│      [1] getindex
│        @ ./dict.jl:498 [inlined]
│      [2] get(obj::JSON3.Object{Vector{UInt8}, SubArray{UInt64, 1, Vector{UInt64}, Tuple{UnitRange{Int64}}, true}}, key::Symbol)
│        @ JSON3 ~/.julia/packages/JSON3/jSAdy/src/JSON3.jl:87
│      [3] getindex(obj::JSON3.Object{Vector{UInt8}, SubArray{UInt64, 1, Vector{UInt64}, Tuple{UnitRange{Int64}}, true}}, key::Symbol)
│        @ JSON3 ~/.julia/packages/JSON3/jSAdy/src/JSON3.jl:128
│      [4] parse_askem_model(input::JSON3.Object{Vector{UInt8}, Vector{UInt64}}, ::Type{SimulationService.ASKEMStockFlowType{Symbol, Number, Symbol, Number, Union{Nothing, Distributions.Distribution}, Number}})
│        @ SimulationService /sciml-service/src/model_parsers/StockFlow.jl:110
│      [5] amr_get_stockflow(amr::JSON3.Object{Vector{UInt8}, Vector{UInt64}})
│        @ SimulationService /sciml-service/src/operations.jl:21
│      [6] amr_get(amr::JSON3.Object{Vector{UInt8}, Vector{UInt64}}, ::Type{ModelingToolkit.ODESystem})
│        @ SimulationService /sciml-service/src/operations.jl:14
│      [7] modelEquation(::HTTP.Messages.Request, id::String)
│        @ SimulationService /sciml-service/src/SimulationService.jl:227
│      [8] (::Oxygen.Core.var"#44#49"{typeof(SimulationService.modelEquation), Dict{String, DataType}, Vector{String}})(req::HTTP.Messages.Request)
│        @ Oxygen.Core ~/.julia/packages/Oxygen/nCv1h/src/core.jl:510
│      [9] (::HTTP.Handlers.Router{typeof(HTTP.Handlers.default404), typeof(HTTP.Handlers.default405), Nothing})(req::HTTP.Messages.Request)
│        @ HTTP.Handlers ~/.julia/packages/HTTP/1EWL3/src/Handlers.jl:439
│     [10] (::Oxygen.Core.var"#28#31"{HTTP.Messages.Request, HTTP.Handlers.Router{typeof(HTTP.Handlers.default404), typeof(HTTP.Handlers.default405), Nothing}})()
jClugstor commented 2 months ago

https://github.com/DARPA-ASKEM/sciml-service/pull/170