insightsengineering / teal

Exploratory Web Apps for Analyzing Clinical Trial Data
https://insightsengineering.github.io/teal/
Other
176 stars 35 forks source link

substitute `future::promises` lockfile creation with `callr::r_bg` #1255

Closed m7pr closed 2 months ago

m7pr commented 3 months ago

An alternative for https://github.com/insightsengineering/teal/pull/1232 that does not require future nor promises, hence does not require handling of the parallel computations plan.

github-actions[bot] commented 3 months ago

badge

Code Coverage Summary

Filename                          Stmts    Miss  Cover    Missing
------------------------------  -------  ------  -------  --------------------------------------------------------------------------------------------------------------------------------------------------
R/dummy_functions.R                  36      25  30.56%   21-37, 40-47
R/get_rcode_utils.R                  31       1  96.77%   50
R/include_css_js.R                   22      17  22.73%   12-38, 76-82
R/init.R                             88      32  63.64%   108-115, 164-165, 167, 179-200, 231-232, 234-235
R/landing_popup_module.R             25      25  0.00%    61-87
R/module_bookmark_manager.R         158     125  20.89%   42-43, 57-59, 70-83, 93-143, 148-149, 189, 224-301
R/module_filter_manager.R            84      19  77.38%   38-42, 157, 162-175
R/module_nested_tabs.R              168      67  60.12%   40-122, 138, 190, 212, 234, 242, 246
R/module_snapshot_manager.R         241     178  26.14%   95-107, 136-139, 143-144, 159-169, 173-188, 190-198, 205-220, 224-228, 230-236, 239-252, 255-273, 282-298, 313-336, 339-350, 353-359, 373, 394-418
R/module_tabs_with_filters.R         79      36  54.43%   34-74, 106, 122
R/module_teal_with_splash.R         114      34  70.18%   66-101, 116, 137, 203-204
R/module_teal.R                     123      86  30.08%   50-119, 152-153, 159-162, 175, 189-227
R/module_wunder_bar.R                60      39  35.00%   23-41, 55-64, 68-77
R/modules.R                         159      23  85.53%   127-130, 147-151, 206-209, 291-292, 344, 356-364
R/reporter_previewer_module.R        19       2  89.47%   30, 34
R/show_rcode_modal.R                 24      24  0.00%    17-42
R/tdata.R                            53       1  98.11%   154
R/teal_data_module-eval_code.R       27       0  100.00%
R/teal_data_module-within.R           7       0  100.00%
R/teal_data_module.R                  6       0  100.00%
R/teal_lockfile.R                    61      27  55.74%   37-41, 89, 92-94, 103-129
R/teal_reporter.R                    68       6  91.18%   69, 77, 125-126, 129, 146
R/teal_slices-store.R                29       0  100.00%
R/teal_slices.R                      59      12  79.66%   137-150
R/TealAppDriver.R                   324     324  0.00%    43-671
R/utils.R                           185       1  99.46%   278
R/validate_inputs.R                  32       0  100.00%
R/validations.R                      58      37  36.21%   110-377
R/zzz.R                              12       8  33.33%   3-15
TOTAL                              2352    1149  51.15%

Diff against main

Filename             Stmts    Miss  Cover
-----------------  -------  ------  -------
R/init.R                +1      +1  -0.73%
R/teal_lockfile.R       +5      +5  -4.98%
TOTAL                   +6      +6  -0.13%

Results for commit: 8249610d4fce47a0c350521032f6d1cffc54c18c

Minimum allowed coverage is 80%

:recycle: This comment has been updated with latest results

github-actions[bot] commented 3 months ago

Unit Tests Summary

  1 files   30 suites   1m 0s :stopwatch: 241 tests 209 :white_check_mark: 32 :zzz: 0 :x: 452 runs  420 :white_check_mark: 32 :zzz: 0 :x:

Results for commit 8249610d.

:recycle: This comment has been updated with latest results.

github-actions[bot] commented 3 months ago

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
init 💔 $0.34$ $+18.18$ $+1$ $0$ $0$ $0$
module_nested_tabs 💔 $1.07$ $+4.84$ $0$ $0$ $0$ $0$
module_tabs_with_filters 💔 $0.99$ $+4.87$ $0$ $0$ $0$ $0$
module_teal_with_splash 💔 $0.53$ $+1.57$ $0$ $0$ $0$ $0$
modules 💔 $0.41$ $+1.30$ $0$ $0$ $0$ $0$
shinytest2-filter_panel 💔 $25.87$ $+83.23$ $0$ $0$ $0$ $0$
shinytest2-init 💔 $12.55$ $+31.67$ $0$ $0$ $0$ $0$
shinytest2-landing_popup 💔 $20.71$ $+61.28$ $0$ $0$ $0$ $0$
shinytest2-module_bookmark_manager 💔 $27.34$ $+72.62$ $0$ $0$ $0$ $0$
shinytest2-modules 💔 $21.80$ $+82.42$ $0$ $0$ $0$ $0$
shinytest2-reporter 💔 $40.25$ $+56.45$ $0$ $0$ $0$ $0$
shinytest2-show-rcode 💔 $5.69$ $+19.14$ $0$ $0$ $0$ $0$
shinytest2-teal_data_module 💔 $25.46$ $+65.28$ $0$ $0$ $0$ $0$
shinytest2-teal_slices 💔 $52.95$ $+44.34$ $0$ $0$ $0$ $0$
shinytest2-utils 💔 $5.51$ $+23.45$ $0$ $0$ $0$ $0$
shinytest2-wunder_bar 💔 $12.30$ $+47.58$ $0$ $0$ $0$ $0$
utils 💚 $63.83$ $-63.46$ $-2$ $0$ $0$ $0$
Additional test case details | Test Suite | $Status$ | Time on `main` | $±Time$ | Test Case | |:-----|:----:|:----:|:----:|:-----| | init | 👶 | | $+8.83$ | init_creates_a_lockfile_during_the_execution | | init | 💔 | $0.05$ | $+1.08$ | init_data_accepts_teal_data_object | | init | 💔 | $0.05$ | $+1.22$ | init_filter_accepts_teal_slices_ | | init | 💔 | $0.03$ | $+1.07$ | init_modules_accepts_a_teal_module_object | | init | 💔 | $0.04$ | $+1.07$ | init_throws_when_an_empty_data_is_used | | init | 💔 | $0.03$ | $+1.53$ | init_throws_when_dataname_in_filter_incompatible_w_datanames_in_data | | init | 💔 | $0.03$ | $+1.55$ | init_throws_when_datanames_in_modules_incompatible_w_datanames_in_data | | module_nested_tabs | 💔 | $0.29$ | $+1.51$ | .datasets_to_data_returns_data_which_is_filtered | | module_tabs_with_filters | 💔 | $0.31$ | $+1.16$ | active_datanames_returns_dataname_from_active_tab_after_change | | module_tabs_with_filters | 💔 | $0.41$ | $+2.59$ | active_module_returns_module_specs_from_active_tab_when_filter.module_specific_FALSE | | shinytest2-filter_panel | 💔 | $10.19$ | $+15.12$ | e2e_filtering_a_module_specific_filter_is_not_refected_in_other_unshared_modules | | shinytest2-filter_panel | 💔 | $10.30$ | $+26.55$ | e2e_filtering_a_module_specific_filter_is_refected_in_other_shared_module | | shinytest2-filter_panel | 💔 | $5.39$ | $+41.57$ | e2e_module_content_is_updated_when_a_data_is_filtered_in_filter_panel | | shinytest2-init | 💔 | $3.51$ | $+10.69$ | e2e_init_creates_UI_containing_specified_title_favicon_header_and_footer | | shinytest2-init | 💔 | $3.36$ | $+10.04$ | e2e_teal_app_initializes_with_no_errors | | shinytest2-init | 💔 | $5.68$ | $+10.94$ | e2e_teal_app_initializes_with_sessionInfo_modal | | shinytest2-landing_popup | 💔 | $3.60$ | $+12.48$ | e2e_app_with_customized_landing_popup_module_creates_modal_containing_specified_title_content_and_buttons | | shinytest2-landing_popup | 💔 | $3.59$ | $+11.75$ | e2e_app_with_default_landing_popup_module_creates_modal_containing_a_button | | shinytest2-landing_popup | 💔 | $3.67$ | $+11.37$ | e2e_teal_app_with_landing_popup_module_initializes_with_no_errors | | shinytest2-landing_popup | 💔 | $3.77$ | $+13.08$ | e2e_when_customized_button_in_landing_popup_module_is_clicked_it_redirects_to_a_certain_page | | shinytest2-landing_popup | 💔 | $6.08$ | $+12.60$ | e2e_when_default_landing_popup_module_is_closed_it_shows_the_underlying_teal_app | | shinytest2-module_bookmark_manager | 💔 | $6.24$ | $+17.14$ | bookmark_manager_button_is_not_rendered_by_default | | shinytest2-module_bookmark_manager | 💔 | $6.26$ | $+17.80$ | bookmark_manager_button_is_not_rendered_when_enableBookmarking_url_ | | shinytest2-module_bookmark_manager | 💔 | $6.20$ | $+18.72$ | bookmark_manager_button_is_rendered_when_enableBookmarking_server_ | | shinytest2-module_bookmark_manager | 💔 | $8.63$ | $+18.97$ | bookmark_manager_button_shows_modal_with_url_containing_state_id_when_clicked | | shinytest2-modules | 💔 | $3.51$ | $+17.69$ | e2e_all_the_nested_teal_modules_are_initiated_as_expected | | shinytest2-modules | 💔 | $3.27$ | $+16.82$ | e2e_filter_panel_is_not_displayed_when_datanames_is_NULL | | shinytest2-modules | 💔 | $5.44$ | $+15.93$ | e2e_filter_panel_only_shows_the_data_supplied_using_datanames | | shinytest2-modules | 💔 | $5.51$ | $+16.22$ | e2e_filter_panel_shows_all_the_datasets_when_datanames_is_all | | shinytest2-modules | 💔 | $4.07$ | $+15.77$ | e2e_the_module_server_logic_is_only_triggered_when_the_teal_module_becomes_active | | shinytest2-reporter | 💔 | $33.42$ | $+20.09$ | e2e_adding_a_report_card_in_a_module_adds_it_in_the_report_previewer_tab | | shinytest2-reporter | 💔 | $3.44$ | $+18.17$ | e2e_reporter_tab_is_created_when_a_module_has_reporter | | shinytest2-reporter | 💔 | $3.39$ | $+18.19$ | e2e_reporter_tab_is_not_created_when_a_module_has_no_reporter | | shinytest2-show-rcode | 💔 | $5.69$ | $+19.14$ | e2e_teal_app_initializes_with_Show_R_Code_modal | | shinytest2-teal_data_module | 💔 | $10.38$ | $+22.24$ | e2e_teal_data_module_inputs_change_teal_data_object_that_is_passed_to_teal_main_UI | | shinytest2-teal_data_module | 💔 | $4.66$ | $+21.45$ | e2e_teal_data_module_shows_validation_errors | | shinytest2-teal_data_module | 💔 | $10.42$ | $+21.58$ | e2e_teal_data_module_will_have_a_delayed_load_of_datasets | | shinytest2-teal_slices | 💔 | $19.35$ | $+21.75$ | e2e_teal_slices_filters_are_initialized_when_global_filters_are_created | | shinytest2-teal_slices | 💔 | $33.60$ | $+22.59$ | e2e_teal_slices_filters_are_initialized_when_module_specific_filters_are_created | | shinytest2-utils | 💔 | $5.51$ | $+23.45$ | e2e_show_hide_hamburger_works_as_expected | | shinytest2-wunder_bar | 💔 | $6.20$ | $+23.49$ | wunder_bar_srv_clicking_filter_icon_opens_filter_manager_modal | | shinytest2-wunder_bar | 💔 | $6.10$ | $+24.09$ | wunder_bar_srv_clicking_snapshot_icon_opens_snapshot_manager_modal | | utils | 💀 | $63.45$ | $-63.45$ | create_renv_lockfile_creates_a_lock_file_during_the_execution |

Results for commit ea0b08d8279120a5d4a168214051cec52083ad97

♻️ This comment has been updated with latest results.

m7pr commented 2 months ago

Hey @gogonzo this is what I get for the simple app you asked for to test with

options(teal.log_level = "TRACE")

library(shiny)
pkgload::load_all(".")

fun <- function() {
  process <- teal_lockfile()

  app <- shinyApp(
    ui = fluidPage(),
    server = function(input, output, session) {
      lockfile_status_tracker(process)
    }
  )
}

app <- fun()

runApp(app)
image
m7pr commented 2 months ago

In the end callr was lost on macOS when we started shiny app. Closing this PR in favour of mirai approach https://github.com/insightsengineering/teal/pull/1263