lindeloev/job

Job output not exported: 'file' must be non-empty string

rrydbirk opened this issue · 7 comments

Thank you for an amazing tool that really speeds up everyday work!

Unfortunately, lately I've been experiencing issues where I get this error message:

Error in save(list = ls(envir = sourceEnv, all.names = TRUE), file = exportRdata,  : 
  'file' must be non-empty string
Calls: sourceWithProgress -> save
Execution halted

Honestly, I don't really understand the error message so it's hard for me to debug. I run the jobs using the addin for RStudio choosing Run selection as job. I've gotten this error both for updating R6 envs (which I thought was just a limitation) but also for creating novel objects that doesn't already exist in global env. Last time I got this I was running fit.obj <- tradeSeq::fitGAM(...) but I've also received it from various other function calls. Our sys adms just up'ed our partition on /tmp/ to 100 GB, and /tmp/ is currently empty so I don't think that's the problem. Also, now I've run this particular job in a separate R session and

> object.size(fit.obj)/1024/1024/1024 # GB
1.2 bytes

Could you help me understand what is going on/what I'm doing wrong? The jobs finish W/O problems otherwise. Thanks!

> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux 8.5 (Ootpa)

Matrix products: default
BLAS/LAPACK: /usr/lib64/libopenblas-r0.3.12.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] BiocParallel_1.28.3         tradeSeq_1.8.0              readr_2.1.2                 slingshot_2.5.1            
 [5] TrajectoryUtils_1.2.0       SingleCellExperiment_1.16.0 SummarizedExperiment_1.24.0 GenomicRanges_1.46.1       
 [9] GenomeInfoDb_1.30.1         IRanges_2.28.0              S4Vectors_0.32.4            princurve_2.1.6            
[13] conos_1.4.6                 pagoda2_1.0.10              Matrix_1.3-4                CRMetrics_0.1              
[17] tidyr_1.2.0                 devtools_2.4.3              usethis_2.1.5               sparseMatrixStats_1.6.0    
[21] MatrixGenerics_1.6.0        matrixStats_0.62.0          magrittr_2.0.3              CellChat_1.5.0             
[25] igraph_1.3.2                dplyr_1.0.9                 qs_0.25.4                   ggplot2_3.3.6              
[29] roxygen2_7.2.1              Biobase_2.54.0              BiocGenerics_0.40.0        

loaded via a namespace (and not attached):
  [1] rappdirs_0.3.3         SparseM_1.81           dendsort_0.3.4         scattermore_0.8        R.methodsS3_1.8.1     
  [6] coda_0.19-4            SeuratObject_4.1.0     pkgmaker_0.32.2        ggpmisc_0.4.7          knitr_1.39            
 [11] irlba_2.3.5            DelayedArray_0.20.0    R.utils_2.11.0         rpart_4.1-15           Rook_1.1-1            
 [16] data.table_1.14.2      RCurl_1.98-1.7         doParallel_1.0.17      generics_0.1.2         callr_3.7.0           
 [21] cowplot_1.1.1          RANN_2.6.1             RApiSerialize_0.1.2    future_1.26.1          tzdb_0.3.0            
 [26] base64url_1.4          spatstat.data_2.2-0    httpuv_1.6.5           xml2_1.3.3             ggpp_0.4.4            
 [31] assertthat_0.2.1       batchtools_0.9.15      viridis_0.6.2          xfun_0.31              RMTstat_0.3.1         
 [36] hms_1.1.1              promises_1.2.0.1       evaluate_0.15          fansi_1.0.3            progress_1.2.2        
 [41] DBI_1.1.3              htmlwidgets_1.5.4      spatstat.geom_2.4-0    purrr_0.3.4            ellipsis_0.3.2        
 [46] RSpectra_0.16-1        ggpubr_0.4.0           backports_1.4.1        gridBase_0.4-7         deldir_1.0-6          
 [51] RcppParallel_5.1.5     vctrs_0.4.1            ggalluvial_0.12.3      ROCR_1.0-11            remotes_2.4.2         
 [56] quantreg_5.93          abind_1.4-5            cachem_1.0.6           withr_2.5.0            grr_0.9.5             
 [61] triebeard_0.3.0        progressr_0.10.0       checkmate_2.1.0        sctransform_0.3.3      sna_2.7               
 [66] prettyunits_1.1.1      goftest_1.2-3          svglite_2.1.0          cluster_2.1.2          lazyeval_0.2.2        
 [71] crayon_1.5.1           edgeR_3.36.0           pkgconfig_2.0.3        nlme_3.1-153           vipor_0.4.5           
 [76] pkgload_1.2.4          drat_0.2.3             rlang_1.0.2            globals_0.15.0         miniUI_0.1.1.1        
 [81] lifecycle_1.0.1        MatrixModels_0.5-0     registry_0.5-1         polyclip_1.10-0        rprojroot_2.0.3       
 [86] lmtest_0.9-40          rngtools_1.5.2         urltools_1.7.3         carData_3.0-5          zoo_1.8-10            
 [91] Rhdf5lib_1.16.0        Matrix.utils_0.9.8     beeswarm_0.4.0         ggridges_0.5.3         GlobalOptions_0.1.2   
 [96] processx_3.6.1         png_0.1-7              viridisLite_0.4.0      rjson_0.2.21           stringfish_0.15.7     
[101] bitops_1.0-7           R.oo_1.24.0            KernSmooth_2.23-20     rhdf5filters_1.6.0     shape_1.4.6           
[106] stringr_1.4.0          spatstat.random_2.2-0  brew_1.0-7             parallelly_1.32.0      rstatix_0.7.0         
[111] ggsignif_0.6.3         sccore_1.0.1           scales_1.2.0           ica_1.0-2              memoise_2.0.1         
[116] plyr_1.8.7             zlibbioc_1.40.0        compiler_4.1.2         RColorBrewer_1.1-3     clue_0.3-60           
[121] fitdistrplus_1.1-8     cli_3.3.0              XVector_0.34.0         listenv_0.8.0          patchwork_1.1.1       
[126] pbapply_1.5-0          ps_1.7.0               MASS_7.3-54            mgcv_1.8-38            tidyselect_1.1.2      
[131] stringi_1.7.6          yaml_2.3.5             locfit_1.5-9.5         ggrepel_0.9.1          grid_4.1.2            
[136] tools_4.1.2            future.apply_1.9.0     circlize_0.4.14        foreach_1.5.2          gridExtra_2.3         
[141] Rtsne_0.16             digest_0.6.29          rgeos_0.5-9            shiny_1.7.1            FNN_1.1.3.1           
[146] Rcpp_1.0.8.3           car_3.0-13             broom_0.8.0            later_1.3.0            RcppAnnoy_0.0.19      
[151] httr_1.4.3             ComplexHeatmap_2.10.0  SoupX_1.6.1            N2R_1.0.1              colorspace_2.0-3      
[156] tensor_1.5             job_0.3.0              brio_1.1.3             fs_1.5.2               reticulate_1.25       
[161] splines_4.1.2          uwot_0.1.11            spatstat.utils_2.3-0   sp_1.5-0               plotly_4.10.0         
[166] sessioninfo_1.2.2      systemfonts_1.0.4      xtable_1.8-4           jsonlite_1.8.0         leidenAlg_1.0.3       
[171] testthat_3.1.4         R6_2.5.1               mime_0.12              pillar_1.7.0           htmltools_0.5.2       
[176] NMF_0.24.0             glue_1.6.2             fastmap_1.1.0          codetools_0.2-18       pkgbuild_1.3.1        
[181] utf8_1.2.2             spatstat.sparse_2.1-1  lattice_0.20-45        tibble_3.1.7           network_1.17.2        
[186] ggbeeswarm_0.6.0       leiden_0.3.10          survival_3.2-13        limma_3.50.3           rmarkdown_2.14        
[191] statnet.common_4.6.0   desc_1.4.1             munsell_0.5.0          GetoptLong_1.0.5       rhdf5_2.38.1          
[196] GenomeInfoDbData_1.2.7 iterators_1.0.14       reshape2_1.4.4         gtable_0.3.0           spatstat.core_2.4-2   
[201] Seurat_4.1.1 

Thanks for reporting! At first sight, this does indeed look like something system-specific caused by rstudiapi. But let's hope it's not so we can fix it faster!

It would be helpful if you could post a minimal reproducible example? If not, can you say a bit about when it works (if ever) and when it doesn't? Is R6 classes a necessary condition? Does lm(mpg~cyl, mtcars) work?

To see whether it's job or rstudioapi, could I ask you to try:

  1. Save your "selection" to a self-contained script, i.e., which creates/loads all the objects you need to run the code.
  2. Then run rstudioapi::jobRunScript(path_to_script)

If this works, it's job-specific. If it doesn't, then it's probably rstudioapi and we can work to file a bug there.

Indeed, it looks like it's job-specific. Running lm(mpg~cyl, mtcars) as a job fails with the same error message, while rstudioapi::jobRunScript(path_to_script) succeeds. FYI, I just created a script with

data(mtcars)
lm(mpg~cyl, mtcars) 

Ah, good. It may be a week or two before I can return to this.

Hello,
Just out of curiosity, have you found the cause of this problem? I'm getting the same error message at the end of one of my jobs.
Everything inside the job runs fine, it seems to happen during the export. We are a team using the same tool and only some of us are getting the error.

job::job({
  options(warn = 1)
  source(here::here("....R"), local = TRUE)
  cat('\n============ \nSUCCESS \nYou can now launch the second job. \n============')
  job::export('none')
},
import = c(input_folder, user_input_file, path_user_input))

Thanks!

============ 
SUCCESS 
You can now launch the second job. 
============

==============
2023-09-06 12:20:42: Done.
Error in save(list = ls(envir = sourceEnv, all.names = TRUE), file = exportRdata,  : 
  'file' must be non-empty string
Calls: sourceWithProgress -> save
Execution halted

@bspoorenberg no, I didn't look much more into it. But it's quite a unique opportunity that you experience both behaviors in your team!

Could you try replacing the last line with one of these (or both) and report what happens?

export(NULL)
rm(list = ls())

Sorry I've just checked with the person who had this error, and she doesn't get it anymore. I will let you know in case we are able to check.