wlandau / crew

A distributed worker launcher
https://wlandau.github.io/crew/
Other
129 stars 4 forks source link

crew_clean() errors with default settings on Windows? #135

Closed luwidmer closed 1 year ago

luwidmer commented 1 year ago

Prework

Description

crew_clean() errors with default settings on Windows?

Reproducible example

library(crew)

controller <- crew_controller_local(
  name = "example",
  workers = 2,
  seconds_idle = 10
)

controller$start()
controller$push(name = "get pid", command = ps::ps_pid())

controller$wait(mode = "all")

task <- controller$pop() # Worker started, task complete.

controller$client$summary()
#> # A tibble: 2 × 6
#>   worker online instances assigned complete socket                              
#>    <int> <lgl>      <int>    <int>    <int> <chr>                               
#> 1      1 TRUE           1        1        1 ws://127.0.0.1:63702/1/a796a35f29e1…
#> 2      2 FALSE          0        0        0 ws://127.0.0.1:63702/2/1ee184122aaa…
controller$terminate()
crew_clean()
#> Error:
#> ! all(is.character(.)) && all(length(.) == 1L) && all(nzchar(.)) && all(!anyNA(.)) is not true on . = user
#> Backtrace:
#>     ▆
#>  1. └─crew::crew_clean()
#>  2.   └─crew::crew_assert(...)
#>  3.     └─crew:::crew_error(message %|||% out)
#>  4.       └─crew:::crew_stop(message = message, class = c("crew_error", "crew"))
#>  5.         └─rlang::abort(message = message, class = class, call = emptyenv())

Created on 2023-10-17 with reprex v2.0.2

Session info ``` r sessionInfo() #> R version 4.3.1 (2023-06-16 ucrt) #> Platform: x86_64-w64-mingw32/x64 (64-bit) #> Running under: Windows 11 x64 (build 22621) #> #> Matrix products: default #> #> #> locale: #> [1] LC_COLLATE=English_Switzerland.utf8 LC_CTYPE=English_Switzerland.utf8 #> [3] LC_MONETARY=English_Switzerland.utf8 LC_NUMERIC=C #> [5] LC_TIME=English_Switzerland.utf8 #> #> time zone: Europe/Zurich #> tzcode source: internal #> #> attached base packages: #> [1] stats graphics grDevices utils datasets methods base #> #> other attached packages: #> [1] crew_0.6.0 #> #> loaded via a namespace (and not attached): #> [1] vctrs_0.6.4 cli_3.6.1 knitr_1.44 rlang_1.1.1 #> [5] xfun_0.40 processx_3.8.2 purrr_1.0.2 styler_1.10.2 #> [9] data.table_1.14.8 nanonext_0.10.2 glue_1.6.2 mirai_0.11.0 #> [13] htmltools_0.5.6.1 ps_1.7.5 fansi_1.0.5 rmarkdown_2.25 #> [17] R.cache_0.16.0 tibble_3.2.1 evaluate_0.22 fastmap_1.1.1 #> [21] yaml_2.3.7 lifecycle_1.0.3 compiler_4.3.1 fs_1.6.3 #> [25] pkgconfig_2.0.3 rstudioapi_0.15.0 getip_0.1-3 R.oo_1.25.0 #> [29] R.utils_2.12.2 digest_0.6.33 R6_2.5.1 tidyselect_1.2.0 #> [33] utf8_1.2.3 reprex_2.0.2 pillar_1.9.0 parallel_4.3.1 #> [37] magrittr_2.0.3 R.methodsS3_1.8.2 tools_4.3.1 withr_2.5.1 ```

Expected result

crew_clean() should not error with default settings on Windows? On Windows, the username is contained in the environment variable USERNAME - @wlandau a cross-platform solution such as Sys.info()[["user"]] as a default might preferable?

wlandau commented 1 year ago

Thanks, should be fixed as of ac381da6eac1262e51cdc48f6687c311a4b72758.