PredictiveEcology / SpaDES.core

Core functionality for Spatial Discrete Event Simulation (SpaDES)
https://spades-core.predictiveecology.org/
GNU General Public License v3.0
9 stars 15 forks source link

`completed<-` errors due to new columns in event queue data.table #272

Closed achubaty closed 5 months ago

achubaty commented 7 months ago
--- re-building ‘iii-cache.Rmd’ using rmarkdown
Quitting from lines  at lines 90-95 [spades-cached] (iii-cache.Rmd)
Error: Error: processing vignette 'iii-cache.Rmd' failed with diagnostics:
Event queue must be a data.table with columns, eventTime, moduleName, eventType, eventPriority.
achubaty commented 6 months ago

the failure is caused by the addition of columns ._prevEventTimeFinish and clockTime to the event queue, without the corresponding changes in all.equal.simList and/or the default definitions for .emptyEventListDT, .singleEventListDT, and .emptyEventList():

d> all.equal(outSim, outSimCached) 
Error in `completed<-`(`*tmp*`, value = list(eventTime = c(0, 0, 0, 0,  : 
  Event queue must be a data.table with columns, eventTime, moduleName, eventType, eventPriority.
d> completed(outSim)
    eventTime       moduleName eventType eventPriority ._prevEventTimeFinish
        <num>           <char>    <char>         <num>                <POSc>
 1:         0       checkpoint      init             0   2024-04-29 20:21:51
 2:         0             save      init             0   2024-04-29 20:21:51
 3:         0         progress      init             0   2024-04-29 20:21:51
 4:         0             load      init             0   2024-04-29 20:21:51
 5:         0 randomLandscapes      init             1   2024-04-29 20:21:51
 6:         0       fireSpread      init             1   2024-04-29 20:21:52
 7:         1       fireSpread      burn             5   2024-04-29 20:21:52
 8:         1       fireSpread     stats             5   2024-04-29 20:21:52
 9:         2       fireSpread      burn             5   2024-04-29 20:21:52
10:         2       fireSpread     stats             5   2024-04-29 20:21:52
11:         3       fireSpread      burn             5   2024-04-29 20:21:52
12:         3       fireSpread     stats             5   2024-04-29 20:21:52
              clockTime
                 <POSc>
 1: 2024-04-29 20:21:51
 2: 2024-04-29 20:21:51
 3: 2024-04-29 20:21:51
 4: 2024-04-29 20:21:51
 5: 2024-04-29 20:21:52
 6: 2024-04-29 20:21:52
 7: 2024-04-29 20:21:52
 8: 2024-04-29 20:21:52
 9: 2024-04-29 20:21:52
10: 2024-04-29 20:21:52
11: 2024-04-29 20:21:52
12: 2024-04-29 20:21:52
d> completed(outSimCached)
    eventTime       moduleName eventType eventPriority ._prevEventTimeFinish
        <num>           <char>    <char>         <num>                <POSc>
 1:         0       checkpoint      init             0   2024-04-29 20:21:51
 2:         0             save      init             0   2024-04-29 20:21:51
 3:         0         progress      init             0   2024-04-29 20:21:51
 4:         0             load      init             0   2024-04-29 20:21:51
 5:         0 randomLandscapes      init             1   2024-04-29 20:21:51
 6:         0       fireSpread      init             1   2024-04-29 20:21:52
 7:         1       fireSpread      burn             5   2024-04-29 20:21:52
 8:         1       fireSpread     stats             5   2024-04-29 20:21:52
 9:         2       fireSpread      burn             5   2024-04-29 20:21:52
10:         2       fireSpread     stats             5   2024-04-29 20:21:52
11:         3       fireSpread      burn             5   2024-04-29 20:21:52
12:         3       fireSpread     stats             5   2024-04-29 20:21:52
              clockTime
                 <POSc>
 1: 2024-04-29 20:21:51
 2: 2024-04-29 20:21:51
 3: 2024-04-29 20:21:51
 4: 2024-04-29 20:21:51
 5: 2024-04-29 20:21:52
 6: 2024-04-29 20:21:52
 7: 2024-04-29 20:21:52
 8: 2024-04-29 20:21:52
 9: 2024-04-29 20:21:52
10: 2024-04-29 20:21:52
11: 2024-04-29 20:21:52
12: 2024-04-29 20:21:52

at the very least, clockTime should be included as a default column.

it looks like columns prefixed with ._ are supposed to be removed/ignored in all.equal.simList but this is not happening for completed<-.

achubaty commented 6 months ago

now seeing these failures in examples / tests on sequentialCaching branch. see https://github.com/PredictiveEcology/SpaDES.core/actions/runs/8888930040

achubaty commented 6 months ago

completed(..., times = FALSE) now drop all columns with ._ prefix, which should solve the issue.

achubaty commented 6 months ago

While the immediate issue is resolved, and all.equal now works, R CMD check hangs indefinitely running tests with suggested packages. (No-suggests tests fail for other reasons)