-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No error or warning when trying to overwrite run when .wait = FALSE
#691
Comments
I think it's expected in the sense that when The main options I can think of:
My initial preference would be the second option. Thoughts? |
That makes sense why it's happening. In my case, I'm running simulations with |
I'll loop back to this later, but on first look, I think this is the preferable user behavior:
I'm not seeing an obvious reason we couldn't implement that, and it certainly makes sense (from a user perspective) to check the |
I'll also add that this doesn't seem like a bad idea either
even unrelated to this specific issue. |
If we go that way, I don't see much reason in practice to go through the complication of repeating bbi's logic for the check in bbr. That gets you the error in most cases (including sge execution because bbi does the existence check upfront), with a small risk of missing it in cases where the bbi failure takes longer than the chosen time interval. |
Ah, that's interesting.
this ^ was the point I was missing there. This might be the right move, although I worry a little about race conditions. |
Right, there certainly is a race condition, and my "in practice" is doing a lot of heavy lifting. When I said "small risk of missing it", I might be guessing wrong about 1) the likelihood of bbi not failing within the chosen window and 2) the potential fallout from not signaling an error (e.g., some future script that expects and handles the error). Anyway, at this point, I don't have a strong objection to the explicit check on bbr's end (option 3), and I'm not really convinced that the small wait is a good idea (option 4) (though my guess is that in practice it would be good enough and it has the advantage of not needing logic on bbr's side and catching any other early errors too). For option 3, I don't like the idea of repeating bbi logic, but I understand the desire to get this error in all cases. It's a change in behavior that I imagine could break some existing scripts (e.g., something that expects the actual One last comment: bbi's "output exists?" check is more complicated than just "does the directory exist?". I do not think we should try to repeat any of that on bbr's end and should just stick to "error if output directory exists and overwrite wouldn't be in effect". |
That all makes sense. One somewhat simple option could be to do a "lightweight" version of your option 3 where we check for the output directory, but only compare it an
I think the only case this misses is when the user has changed the default in the model directory's Any thoughts on that? |
I think you're probably right that users set
... I think they'd find it worse. They were setting This guard would probably be added somewhere in Lines 118 to 142 in 88deecd
We already have the diff --git a/R/submit-model.R b/R/submit-model.R
index a9c04256..ae855311 100644
--- a/R/submit-model.R
+++ b/R/submit-model.R
@@ -127,13 +127,19 @@ submit_nonmem_model <- function(.mod,
# define working directory
model_dir <- get_model_working_directory(.mod)
-
- .path_exists <- file_exists(.config_path %||% file.path(model_dir, "bbi.yaml"))
- if(!.path_exists){
+ cpath <- .config_path %||% file.path(model_dir, "bbi.yaml")
+ if(!file_exists(cpath)){
stop(paste("No bbi configuration was found in the execution directory.",
"Please run `bbi_init()` with the appropriate directory to continue."))
}
+ # TODO: Explain cases where there can be a mismatch.
+ bbi_will_overwrite <- isTRUE(.bbi_args[["overwrite"]]) ||
+ isTRUE(yaml::read_yaml(cpath)[["overwrite"]])
+ if (!bbi_will_overwrite && file_exists(get_output_dir(.mod, .check_exists = FALSE))) {
+ stop("boo")
+ }
+
if (!is.null(.config_path)) {
cmd_args <- c(
cmd_args, I think that does an okay job of matching whether bbi considers overwrite to be in effect. There are some cases it wouldn't match for due to some differences in yaml parsing (e.g., I think any non-zero integer in bbi.yaml would be treated as Also, as I was playing around with that, I was a bit surprised that we can't override an |
…rite _before_ passing the submission off to bbi. * This attempts to address the issue raised in #691, where a user who passed .wait = FALSE would not get back the error from bbi. * This also attempts to improve the user experience by reconciling various methods for controlling the overwrite behavior and checking all of them up front, instead of waiting for bbi to check some of them later.
This is still a work-in-progress, but my first shot at implementing this is in 742e75f Incidentally, I think it also addresses this point from @kyleam :
Because we check the args first and then would error in the case where they are explicitly |
Yeah, it looks like your PR takes any non-NULL .bbi_args overwrite value precedence (versus just given TRUE precedence) so it does stop in that case. That may be the way to go, though I'm not sure since it now makes the handling inconsistent with all other logical values in |
I guess I don't have a strong opinion on this. Per your original point, I think most users would find it "surprising" that "there is no way to distinguish between unspecified and That said, if you think about this and feel strongly that we should keep it consistent with other |
Yeah.
I'd say go with your change. The inconsistency in handling compared to other bbi flags is making me pause (as well as the desire to make the minimal number of behavioral changes), but I bet the change leads to less confusion than more overall. |
…rite _before_ passing the submission off to bbi. * This attempts to address the issue raised in #691, where a user who passed .wait = FALSE would not get back the error from bbi. * This also attempts to improve the user experience by reconciling various methods for controlling the overwrite behavior and checking all of them up front, instead of waiting for bbi to check some of them later.
This was addressed for the I suggest we keep similar handling, and perhaps check that the line |
Thanks for posting that detail @barrettk . Looking at it quickly, the main issue that complicates things is that Without giving it much more thought, I'm not sure how we want to handle that. I think ideally we would decide on this and implement before the next release (which will have the #692 changes in it). That said, if remains as is for now, I'm still fine releasing those #692 changes, unless someone else objects. |
Is this expected / documented? The simulation run was already executed. When I try to resubmit with
.wait = FALSE
, I don't get a warning or error back. If I set.wait = TRUE
, then I get the error.The text was updated successfully, but these errors were encountered: