psrenergy/PSRClassesInterface.jl

Error when closing incomplete file

Closed this issue · 1 comments

When attempting to close an incomplete file (not all stages have been writen), PSRI throws the following (non-fatal) error:

Error: Exception while generating log record in module PSRClassesInterface.OpenBinary at C:\Users\gvidigal.julia\packages\PSRClassesInterface\zr0OF\src\OpenBinary\writer.jl:427
│ exception =
│ MethodError: no method matching div(::typeof(last), ::Int64, ::RoundingMode{:ToZero})

│ Closest candidates are:
│ div(::P, ::Real, ::RoundingMode) where P<:Dates.Period
│ @ Dates C:\Users\gvidigal.julia\juliaup\julia-1.9.1+0.x64.w64.mingw32\share\julia\stdlib\v1.9\Dates\src\periods.jl:81
│ div(::Rational, ::Integer, ::RoundingMode)
│ @ Base rational.jl:445
│ div(::Missing, ::Number, ::RoundingMode)
│ @ Base missing.jl:129
│ ...

│ Stacktrace:
│ [1] div(a::Function, b::Int64)
│ @ Base .\div.jl:47
│ [2] macro expansion
│ @ .\logging.jl:360 [inlined]
│ [3] close(io::PSRClassesInterface.OpenBinary.Writer)
│ @ PSRClassesInterface.OpenBinary C:\Users\gvidigal.julia\packages\PSRClassesInterface\zr0OF\src\OpenBinary\writer.jl:427
│ [4] load_balance!(output_files::BidBasedSimulator.OutputFiles, #unused#::Type{BidBasedSimulator.SubproblemCloseFileWrite})
│ @ BidBasedSimulator D:\Repositorios\BidBasedSimulator.jl\src\model_constraints\load_balance.jl:117

load_balance.jl:117 is the call to PSRI.close()

@guilhermebodin should we throw a warning and finish the PSRI.close() method in this case?