geocompx / geocompr

Geocomputation with R: an open source book
https://r.geocompx.org/
Other
1.59k stars 585 forks source link

Do not evaluate failing mlr3::lrn chunk (#1111 hotfix) #1117

Closed Robinlovelace closed 2 months ago

Robinlovelace commented 2 months ago

eco chapter failed with

58/70 [15-eco-26]        
Error in `.__Learner__encapsulate()`:
! unused argument (rhs = rhs)
Backtrace:
  1. base::eval(...)
 19. mlr3 (local) `<fn>`()
Warning messages:
1: In warn_deprecated("Task$data_formats") :
  Task$data_formats is deprecated and will be removed in the future.
2: In warn_deprecated("DataBackend$data_formats") :
  DataBackend$data_formats is deprecated and will be removed in the future.
3: In warn_deprecated("Learner$data_formats") :
  Learner$data_formats is deprecated and will be removed in the future.

Quitting from lines 519-520 [15-eco-26] (15-eco.Rmd)
Execution halted
Error in Rscript_render(f, render_args, render_meta, add1, add2) : 
  Failed to compile 15-eco.Rmd
Calls: <Anonymous> -> render_new_session -> Rscript_render
Execution halted

So I've tried evaluating the train stage. Whack-a-mole!

https://github.com/geocompx/geocompr/actions/runs/11009162777/job/30568217959#step:4:1992

Robinlovelace commented 2 months ago

Latest error after commit above FYI @jannes-m:

! The backend of Task 'mongon' has been removed. Set `store_backends` to `TRUE` during model fitting to conserve it.
Backtrace:
  1. base::eval(...)
 27. mlr3 (local) `<fn>`()
 28. mlr3:::.__Task__groups(...)
 29. mlr3:::assert_has_backend(self)
 30. mlr3misc::stopf(...)
Warning messages:
1: In warn_deprecated("Task$data_formats") :
  Task$data_formats is deprecated and will be removed in the future.
2: In warn_deprecated("DataBackend$data_formats") :
  DataBackend$data_formats is deprecated and will be removed in the future.
3: In warn_deprecated("Learner$data_formats") :
  Learner$data_formats is deprecated and will be removed in the future.
Quitting from lines 519-520 [15-eco-26] (15-eco.Rmd)
Execution halted
Error in Rscript_render(f, render_args, render_meta, add1, add2) : 
  Failed to compile 15-eco.Rmd
Calls: <Anonymous> -> render_new_session -> Rscript_render
Execution halted

Please prioritise this over proof-reading.

Robinlovelace commented 2 months ago

Latest error arises here I think:

`r if (knitr:::is_html_output()) '
# References {-}
'`

Message:

Error in eval(quote({ : 
  The number of arguments passed to Rscript should be 3.
Calls: local -> eval.parent -> eval -> eval -> eval -> eval

Source: https://github.com/geocompx/geocompr/actions/runs/11011451046/job/30575558670?pr=1117#step:4:2041

Any ideas @Nowosad?

Seems like a new one.

Nowosad commented 2 months ago

@Robinlovelace my guess would be that the error is related to some code change before...

Robinlovelace commented 2 months ago

@Nowosad there are no changes that could explain this, right? https://github.com/geocompx/geocompr/pull/1117/files

Nowosad commented 2 months ago

@Robinlovelace you may also try to render a single chapter to isolate the source of the issue

Robinlovelace commented 2 months ago

@Robinlovelace you may also try to render a single chapter to isolate the source of the issue

Good idea. Additional commits to this branch welcome.

Robinlovelace commented 2 months ago

Suggestion: let's merge this to check the same behaviour happens on deployment workflow. Plan to do so this evening.

Robinlovelace commented 2 months ago

Latest hypothesis: xfun-related https://github.com/yihui/xfun/commit/7dabf85fd61339b392fba0eee562f4c301fac681

jannes-m commented 2 months ago

Again, I cannot reproduce the error in our container, ok, I should be more specific, I am using ghcr.io/geocompx/docker:qgis. Mmh, this is not the container gha is using which is geocompr/geocompr:suggests. Ok, I'll try this one as well.

Robinlovelace commented 2 months ago

Going to merge this, it's a mixxed bag but overall positive. We can re-evaluate the chunks later is my thinking @jannes-m, sorry for the hassle.