Skip to content

Commit

Permalink
api_command_execute() updated with using 'verbose' parameter (#274 an…
Browse files Browse the repository at this point in the history
…taresRead)

 + newsmd (#197)
  • Loading branch information
berthetclement authored Feb 10, 2025
1 parent fd492fe commit 2e0db10
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
14 changes: 4 additions & 10 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ BUGFIXES :
* `editBindingConstraint()` :
- `operator` parameter set to NULL, by default, no longer causes an error.
- To add values, the `operator` parameter is now required.
- For a study version >= 832, the `filter-year-by-year` and `filter-synthesis` properties are retained in the .ini file if they are not modified.
- For a study version >= 832, the `filter-year-by-year` and `filter-synthesis` properties are retained in the .ini file if they are not modified.
* *[private function]* `api_command_execute()` manage snapshot generation of a variant study with a tempo to wait the end of current task (prevents the order from being ignored).
- You can use global parameter `verbose` to `TRUE` (#274 `antaresRead`) to display diagnostic messages (`getOption("antares")`)
* `updateAdequacySettings()` : in API mode do not send NULL value


GITHUB ACTIONS :
Expand All @@ -21,15 +24,6 @@ GITHUB ACTIONS :
* test-coverage.yaml updated


BUGFIXES :

* *[private function]* `api_command_execute()` manage snapshot generation of a variant study with a tempo to wait the end of current task (prevents the order from being ignored).

BUGFIXES :

* `updateAdequacySettings()` : in API mode do not send NULL value


# antaresEditObject 0.7.1

### Breaking changes :
Expand Down
15 changes: 10 additions & 5 deletions R/API-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ api_command_execute <- function(command, opts, text_alert = "{msg_api}") {
default_endpoint = NULL)

while(is.null(result_task_id$result)) {
message("...Generate Snapshot task in progress...")
if(!is.null(opts$verbose))
if(opts$verbose)
message("...Generate Snapshot task in progress...")
if(is.null(opts$sleep))
Sys.sleep(0.5)
else
Expand All @@ -222,14 +224,17 @@ api_command_execute <- function(command, opts, text_alert = "{msg_api}") {

# test if task is terminated with success
result_task_id_log <- result_task_id$result

status <- isTRUE(result_task_id_log$success)

details_command <- jsonlite::fromJSON(result_task_id_log$return_value,
simplifyVector = FALSE)

if(status)
message(paste0("Snapshot generated for : ", details_command$details[[1]]$name))
if(status){
if(!is.null(opts$verbose))
if(opts$verbose)
message(paste0("Snapshot generated for : ",
details_command$details[[1]]$name))
}

else
stop(paste0("Not success for task : ", details_command$details[[1]]$name))
return(invisible(TRUE))
Expand Down

0 comments on commit 2e0db10

Please sign in to comment.