Skip to content

Conversation

@weshinsley
Copy link
Contributor

No description provided.

@weshinsley weshinsley requested a review from richfitz January 30, 2023 17:42
@weshinsley
Copy link
Contributor Author

weshinsley commented Jan 30, 2023

So, the setwd method is not ideal...

What's happening is that in orderly_version.R, around lines 599-605, within the run_execute function:-

 withr::with_envvar(private$envvar, {
        withr::with_dir(private$workdir, {
          source(private$recipe$script, local = private$envir, # nolint
                 echo = echo, max.deparse.length = Inf)
        })
      })

If the source call encounters a stop/crash, then control passes straight to the withCallingHandlers block in the calling function, around line 541-555, without resetting the working directory to what it was before the with_dir ->

  currentwd <- getwd()
      withCallingHandlers({
        ## Refetch the preflight info here: we want to keep git but
        ## replace everything else I think.  We might save the random
        ## seed but that is not actually supposed to work across R
        ## versions.
        private$preflight()
        private$preflight_info["git"] <- info$preflight_info["git"]

        self$run_execute(echo)   # <--------- here's the call within which we crash
        self$run_cleanup()       # <----- so after a crash, skip this line, go straight to the error clause
      }, error = function(e) {
        setwd(currentwd)
        self$run_failed_cleanup(e)
      })

@codecov
Copy link

codecov bot commented Jan 31, 2023

Codecov Report

Merging #325 (569f1d3) into master (d02fc85) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 569f1d3 differs from pull request most recent head 8ee1da0. Consider uploading reports for the commit 8ee1da0 to get more accurate results

@@           Coverage Diff           @@
##           master     #325   +/-   ##
=======================================
  Coverage   99.95%   99.95%           
=======================================
  Files          41       41           
  Lines        4535     4543    +8     
=======================================
+ Hits         4533     4541    +8     
  Misses          2        2           
Impacted Files Coverage Δ
R/orderly_version.R 100.00% <100.00%> (ø)
R/query_search.R 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@weshinsley weshinsley requested a review from r-ash June 20, 2023 19:32
Copy link
Contributor

@r-ash r-ash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one

@weshinsley
Copy link
Contributor Author

Thanks Rob - let's merge this and hopefully we can then get more info on Paddy's cluster issue. @richfitz - this ends up being a one-line fix which you did in the end, plus some tests - tagging you here as we mentioned it last week, re whether this is relevant for orderly3, or whether that migt be different enough anyway,.

@weshinsley weshinsley merged commit 788ce5c into master Jun 21, 2023
@richfitz
Copy link
Member

thanks guys

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

Successfully merging this pull request may close these issues.

4 participants