Code Monkey home page Code Monkey logo

job's People

Contributors

lindeloev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

job's Issues

brms

Hi,

interesting package, sure it will be popular.

One note - since it is of general interest, it might be good to have a general package as an example. Alternatively, it would be worth mentioning
install.packages("brms")
if not already done.

Oh, and on Debian/Ubuntu
sudo apt install libv8-dev

This caught me out as a non-brms user.

thanks

Add result$.stdout

Saving stdout could be useful since the jobs disappear when RStudio is closed. Is it possible to capture output while live-printing to the job too? Wrapping everything in capture.output() returns a list of outputs, but we want the live monitoring too.

CStack error on MacOS

Multiple users report CStack overflow errors on MacOS. Easy-peasy three-step solution:

  • Install MacOS in a VM
  • Install RStudio etc.
  • Fix the error.

Set up automatic testing

The test suite is of little use since it requires RStudio. But checking that the package can be built across platforms is useful!

Set maximum number of concurrent jobs / queue jobs?

Thanks for this excellent package!

It would be great to have an option to queue jobs so that only a reasonable number run concurrently.

The simplest way to allow for that would be to enable users to start a master-job that then controls the other jobs - but while jobs can spawn other jobs with the rstudioapi one cannot use job::job inside job::job (Error: RStudio not running). Could that be changed?

A more complex wrapper that automatically allows one to have a job pending until at most x other jobs are running would be a nice addition, but less important.

# This works - but using job::job instead of the runScript does not
job::job(spawn_test = {
  for (i in 1:5) {
    tempfile <- tempfile(fileext = ".R")
    write_lines("print('Hello')", tempfile)
    rstudioapi::jobRunScript(tempfile)
  }
}, import = NULL)

Reduce peak memory load

It currently makes a copy of the full environment as a list, both main-session side and inside the job, doubling the size. Use load()/save() and compute stuff var-by-var instead of on the full chunk.

Allow unnamed arguments

This should work:

job::job({}, NULL c("rstudiapi"), list(my.opt = 55)

... even though there's an ellipsis as the first argument.

failed to install the package

Whan I try to install the package using ”remotes::install_github("lindeloev/job")“
I got error
Error: Failed to install 'unknown package' from GitHub:
Line starting 'Config/testthat/edit ...' is malformed!

Could you guide me how to solve this and install the package ?

Jingxin

Alternative (streamlined) synthax

Very cool package.

I was wondering to lower the burden of programming do you think these alternatives could be implemented?

Slight improvement in my opinion

results = job({ brm(model2, data) })

This would be game changer. (Would lazy evaluation work here?)

results = data %>% slow_process_1() %>% slow_process_2() %>% job()

Or if there is no operator to delay the evaluation something like this would allow to drop the job() line and execute the commands normally

results = 
 {
   data %>% 
   slow_process_1() %>%
   slow_process_2() 
 } %>%
 job()

RStudio addins

Awesome package!

What are your plans for RStudio addins? Some possibilities that come to mind:

  1. Launch the current script as a job.
  2. Launch highlighted text.
  3. Launch the command at the cursor.

C stack error on MacOS

I'm running some large models and keep getting the error:
"Error: C stack usage 7969264 is too close to the limit", with a suggestion of only passing a smaller part of the environment to the job. However, I cannot find an example of how to do that.
Maybe add a short example to the readme/vignette?

Add job_empty()

Calling job::job({<code>}, import = NULL, packages = NULL, opts = NULL) is too long and very inconvenient. After playing with various options, I think the API that gives the "shortest route" to the most common use cases is:

job::job()  # all imports
job::job_empty()  # no imports

This makes it easy to turn on or off just one feature.

job::job({<code>}, import = NULL)  # no vars
job::job_empty({<code>}, opts = TRUE)  # only options

Return all *changed* objects?

Currently, objects with the same name as import are not returned for speed and memory. This is "surprising" in a confusing way. Maybe job::job() should return all changed objects?

  • Use identical() for standard objects.
  • Can we detect changes in environments (including R6)? Asked question on SO.
  • Should I add digest as a dependency to save memory?

job returns error when using NA_real_

Hi Jonas, thanks for such a great package. I have a strange little issue when I try to use NA_real_ inside dplyr::case_when in job:

library(dplyr)
library(job)
    
(df <- data.frame(cond = c("a","b","c")))

# works outside job    
mutate(df, item = case_when(cond == "a" ~ 1,
                            cond == "b" ~ 2,
                            cond == "c" ~ NA_real_))

# error inside job
job({mutate(df, item = case_when(cond == "a" ~ 1,
                            cond == "b" ~ 2,
                            cond == "c" ~ NA_real_))})

The traceback suggests NA_real_ is still being treated as NA, which case_when doesn't like (it needs all assigned values to be of the same type):

grafik

Kill slow running job?

Thanks for creating this great package and publicizing on social media, which is how I found it! :)

My question: is there a way to kill slow running jobs? I need to launch tasks using the rollama package that typically takes 15s, but if it messes up could take 5 minutes. I'd like to kill a task that runs say longer than 20s. Could jobs do something like this?

play nice with here() package

Very minor issue. I often use the here() package, in particular when setting file= in brms.

This creates issues with job, since job doesn't seem to import the working directory and therefore cannot find the directory in which the model should be saved.

Again, not a huge issue.

Problem with user function that calls a second function

If I make a function (fun1), call that function from another function (fun2), and call fun2 from a job, fun1 can not be found.

make_nums <- function() {
  rnorm(5)
}

sq_nums <- function() {
  make_nums()^2
}

sq_nums()
#> [1] 1.21640284 0.73830850 0.08544378 2.02388512 1.30504181

job::job({
  res <- sq_nums()
})
#> Error in make_nums() : could not find function "make_nums"
#> Calls: sourceWithProgress -> eval -> eval -> sq_nums
#> Execution halted

job::job({
  res <- sq_nums()
}, import = c(sq_nums, make_nums))
#> Error in make_nums() : could not find function "make_nums"
#> Calls: sourceWithProgress -> eval -> eval -> sq_nums
#> Execution halted

job::job({
  res <- make_nums()^2
}) 

res
#> [1] 0.0594687 1.9270315 0.1461293 0.3191069 0.1931480

Session info

─ Session info ─────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.1.0 (2021-05-18)
 os       Pop!_OS 21.10               
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language en_US:en                    
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       Europe/Copenhagen           
 date     2022-02-25                  

─ Packages ─────────────────────────────────────────────────────────────────────────
 package     * version date       lib source        
 cachem        1.0.5   2021-05-15 [1] CRAN (R 4.1.0)
 callr         3.7.0   2021-04-20 [1] CRAN (R 4.1.0)
 cli           3.2.0   2022-02-14 [1] CRAN (R 4.1.0)
 crayon        1.5.0   2022-02-14 [1] CRAN (R 4.1.0)
 desc          1.4.0   2021-09-28 [1] CRAN (R 4.1.0)
 devtools      2.4.2   2021-06-07 [1] CRAN (R 4.1.0)
 ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.1.0)
 fastmap       1.1.0   2021-01-25 [3] CRAN (R 4.1.0)
 fs            1.5.2   2021-12-08 [1] CRAN (R 4.1.0)
 glue          1.6.2   2022-02-24 [1] CRAN (R 4.1.0)
 lifecycle     1.0.1   2021-09-24 [1] CRAN (R 4.1.0)
 magrittr      2.0.2   2022-01-26 [1] CRAN (R 4.1.0)
 memoise       2.0.0   2021-01-26 [1] CRAN (R 4.1.0)
 pkgbuild      1.3.1   2021-12-20 [1] CRAN (R 4.1.0)
 pkgload       1.2.1   2021-04-06 [1] CRAN (R 4.1.0)
 prettyunits   1.1.1   2020-01-24 [3] CRAN (R 4.1.0)
 processx      3.5.2   2021-04-30 [1] CRAN (R 4.1.0)
 ps            1.6.0   2021-02-28 [1] CRAN (R 4.1.0)
 purrr         0.3.4   2020-04-17 [3] CRAN (R 4.1.0)
 R6            2.5.1   2021-08-19 [1] CRAN (R 4.1.0)
 remotes       2.4.0   2021-06-02 [1] CRAN (R 4.1.0)
 rlang         1.0.1   2022-02-03 [1] CRAN (R 4.1.0)
 rprojroot     2.0.2   2020-11-15 [1] CRAN (R 4.1.0)
 sessioninfo   1.1.1   2018-11-05 [3] CRAN (R 4.1.0)
 testthat      3.0.4   2021-07-01 [1] CRAN (R 4.1.0)
 usethis       2.1.3   2021-10-27 [1] CRAN (R 4.1.0)
 withr         2.4.3   2021-11-30 [1] CRAN (R 4.1.0)

[1] /home/johannes/R/x86_64-pc-linux-gnu-library/4.1
[2] /usr/local/lib/R/site-library
[3] /usr/lib/R/site-library
[4] /usr/lib/R/library

rs_recordNotebookError when using inside R notebook

Create an .Rmd with the following content (without the #s) and run the code chunk.

# ```{r}
# job::job({1+1})
# ```

The result is an error

Error in .Call("rs_recordNotebookError", err) : 
  C symbol name "rs_recordNotebookError" not in load table
Calls: sourceWithProgress ... <Anonymous> -> .rs.recordTraceback -> errorReporter -> .Call
Execution halted

I like the interacive way of using R markdown code chunks for data analysis, so it would be good to have job::job() be working there.

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

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 

export completed objects even in case of error

I ran a large job that took several hours to complete. When trying to save the result an error was raised (see #19) and the results were lost.

Would it be possible to catch the error and still export the results?

repex:

job::job({
  
  test <- rnorm(10)
  "B"+1 #will raise an error
  
  
})

the test object is not exported

Add job::export(..., file = "result.RData") argument

A lot of precious processing time is invested in some jobs. It's somewhat error-prone to rely on it being imported to the main session and the user handling it appropriately there. Having a file argument to job::export() would make this convenient.

job::job({
   a = 3
   b = 7
   job::export("changed", file = "my_data.RData")
})

Compared to save.image(), This handles all the stuff about selecting from the user environment (not global), not including emitProgress(), etc. This acts like job::export("none"). The default job::export(file = NULL) exports to the main RStudio session.

Control options

Should default to options = options(). But also support a named vector (overwrite some) or NULL (overwrite none).

Support for Slurm system

Hi,

This is a wonderful tool. I want to know if it support submit job to annother machine or slurm cluster.

Best !

Should the `packages` and `opts` arguments be logical?

Now with job_empty() in the mix, it's probably better to stick to regular R syntax for attaching packages and setting options within the job.

  • Is it better to attach packages inside the code chunk?
job::job({library(dplyr)}, packages = FALSE)
job::job_empty({library(dplyr)})
job::job({}, packages = c("dplyr"))  # Remove this option?
  • Is it better to set options inside the code chunk?
job::job({options(digits = 10)}, opts = FALSE)
job::job_empty({options(digits = 10)})
job::job({}, opts = list(digits = 10))  # Remove this option?

A small mistake when `install`

when I install job by remotes::install_github("lindeloev/job") get an error:

Downloading GitHub repo lindeloev/job@HEADchecking for file 'C:\Users\Jeason\AppData\Local\Temp\Rtmpof9OGC\remotes2cf847866b3\lindeloev-job-2953c66/DESCRIPTION' ...
-  preparing 'job':checking DESCRIPTION meta-information ... 
   Warning in parse(con, encoding = "UTF-8") :
     argument encoding="UTF-8" is ignored in MBCS locales
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
   Omitted 'LazyData' from DESCRIPTION
-  building 'job_0.2.tar.gz'
   
Installing package intoD:/Rpackages’
(aslibis unspecified)
* installing *source* package 'job' ...
** using staged installation
Warning in parse(con, encoding = "UTF-8") :
  argument encoding="UTF-8" is ignored in MBCS locales
** R
Warning in readLines(f, warn = FALSE) :
  invalid input found on input connection 'C:/Users/Jeason/AppData/Local/Temp/RtmpMNYiCk/R.INSTALL4ba0199d1ce0/job/R/job.R'
** inst
** byte-compile and prepare package for lazy loading
** help
Warning in readLines(file, warn = FALSE) :
  invalid input found on input connection 'C:/Users/Jeason/AppData/Local/Temp/RtmpMNYiCk/R.INSTALL4ba0199d1ce0/job/man/job.Rd'
Warning: C:/Users/Jeason/AppData/Local/Temp/RtmpMNYiCk/R.INSTALL4ba0199d1ce0/job/man/job.Rd:118: unexpected END_OF_INPUT 'Jonas Kristoffer Lindel
'
*** installing help indices
  converting help for package 'job'
    finding HTML links ... done
    export                                  html  
    job                                     html  
    print.jobcode                           html  
*** copying figures
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for 'job' in namespaceExport(ns, exports):
 undefined exports: job
Error: loading failed
Execution halted
ERROR: loading failed
* removing 'D:/Rpackages/job'
* restoring previous 'D:/Rpackages/job'

This may be a small mistake when you document the job. Can you check it out? Thanks~

Unnamed chunks should return content to the global environment

I think it would make sense if the following returned a and b to globalenv()? Then do not export .call.

job::job({
  a = 1
  b = 2
})

But how to signal no export? I guess it could be up to the users to ensure that the env is empty, e.g., by running rm(list=ls()) as the last line. Having an export = FALSE argument would complicate the API too much.

pkgdown website

The README is too short a format to show the various arguments in action rather than presenting them abstractly. Create a pkgdown site with worked examples. This issue collects ideas for content:

  • Initiate site using the same template as the mcp package.
  • Avoiding memory max-out via import and other tricks (#27)
  • Use cases for job_empty()
  • Avoiding data loss via try and saving to files.
  • Use case: upgrading packages
  • Set up search
  • Once everything is written; set up a GH-page to the pkgdown branch and publish.

CPP compilation fails inside job::job

I'm seeing an issue similar to #7. The brms demo runs fine within a normal console session, but when I wrap it with job::job, I get:

Compiling Stan program...
> 
> 
Error in .Call("rs_canBuildCpp") : 
  C symbol name "rs_canBuildCpp" not in load table
Calls: sourceWithProgress ... .fun -> cxxfunctionplus -> <Anonymous> -> check -> .Call

If I add opts = NULL or opts = list(buildtools.check = NULL, buildtools.with = NULL) to the jobs::job call, then the job runs.

Some debugging info:

> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] brms_2.15.0 Rcpp_1.0.6 

loaded via a namespace (and not attached):
 [1] nlme_3.1-150         matrixStats_0.57.0   xts_0.12.1           threejs_0.3.3        rstan_2.21.2        
 [6] job_0.1              backports_1.2.1      tools_4.0.3          R6_2.5.0             DT_0.16             
[11] mgcv_1.8-33          projpred_2.0.2       colorspace_2.0-0     withr_2.4.0          tidyselect_1.1.0    
[16] gridExtra_2.3        prettyunits_1.1.1    processx_3.4.5       Brobdingnag_1.2-6    curl_4.3            
[21] compiler_4.0.3       cli_2.4.0            shinyjs_2.0.0        colourpicker_1.1.0   scales_1.1.1        
[26] dygraphs_1.1.1.6     mvtnorm_1.1-1        ggridges_0.5.3       callr_3.5.1          stringr_1.4.0       
[31] digest_0.6.27        StanHeaders_2.21.0-7 minqa_1.2.4          base64enc_0.1-3      pkgconfig_2.0.3     
[36] htmltools_0.5.1.1    lme4_1.1-25          fastmap_1.0.1        htmlwidgets_1.5.2    rlang_0.4.10        
[41] rstudioapi_0.13      shiny_1.6.0          generics_0.1.0       zoo_1.8-8            jsonlite_1.7.2      
[46] crosstalk_1.1.0.1    gtools_3.8.2         dplyr_1.0.2          inline_0.3.17        magrittr_2.0.1      
[51] loo_2.4.1            bayesplot_1.8.0      Matrix_1.2-18        munsell_0.5.0        abind_1.4-5         
[56] lifecycle_0.2.0      stringi_1.5.3        MASS_7.3-53          pkgbuild_1.2.0       plyr_1.8.6          
[61] grid_4.0.3           parallel_4.0.3       promises_1.1.1       crayon_1.3.4         miniUI_0.1.1.1      
[66] lattice_0.20-41      splines_4.0.3        ps_1.5.0             pillar_1.4.7         igraph_1.2.6        
[71] boot_1.3-25          markdown_1.1         shinystan_2.5.0      codetools_0.2-18     reshape2_1.4.4      
[76] stats4_4.0.3         rstantools_2.1.1     glue_1.4.2           V8_3.4.0             RcppParallel_5.0.2  
[81] vctrs_0.3.6          nloptr_1.2.2.2       httpuv_1.5.4         gtable_0.3.0         purrr_0.3.4         
[86] ggplot2_3.3.3        mime_0.9             xtable_1.8-4         coda_0.19-4          later_1.1.0.1       
[91] rsconnect_0.8.17     tibble_3.0.5         shinythemes_1.2.0    gamm4_0.2-6          statmod_1.4.35      
[96] ellipsis_0.3.1       bridgesampling_1.1-2
> getOption("buildtools.check")
function (action) 
{
    if (identical(.Platform$pkgType, "mac.binary.mavericks")) {
        .Call("rs_canBuildCpp")
    }
    else {
        if (!.Call("rs_canBuildCpp")) {
            .rs.installBuildTools(action)
            FALSE
        }
        else {
            TRUE
        }
    }
}
<environment: 0x7fd8ed8f7520>

Path inside a job

I work with RStudio Projects and am used to construct my relative path with here::here(). I tried to use this to save a large object that I ran with job::job but the saving failed and all results were lost.

The saving failed as the base directory of here changed to a temporary directory.

here() starts at /tmp/RtmpTjtK75

I will use absolute path from now on but I just thought it might be good to know that this might be a problem for some people.

Thanks for your very useful package!

'Run selection as job' changes the search path (compared to interactive use)

  • Using the plugin for Rstudio to 'Run selection as job' changes the search path, compared to interactive use.
  • The effect is a different masking of functions.
  • This means that set_names may refer to rlang::set_names in interactive use, but to magrittr::set_names in a job.
  • This causes code that works interactively, to fail as a job.

Example

Running this code interactively will have rlang prioritized in the search path (masking magrittr).
But running this code as a job will have magrittr prioritized in the search path (masking rlang).

library(magrittr)
library(rlang)
searchpaths() |> print()

It would be nice if job could somehow use the same search path as in interactive use 😁

Test on Linux, Mac, and oldrel

The test suite is basically useless on GitHub actions etc. We need people running the tests from within RStudio.

  • Linux
  • MacOS R 3.6 (actually, 3.2)
  • MacOS R 4.X
  • Windows R 3.6
  • Windows R 4.X

Using job::job() within RMarkdown file

I am working on compiling one large RMarkdown file that reproduces all of the analyses for a scientific manuscript. A few of the analyses take a long time, so I've used job::job() to run them as jobs, which has worked great when I'm working through the RMarkdown file in RStudio.

But, I'd like to be able to knit the RMarkdown file to html/pdf to share with the manuscript too. But I get an error in the first chunk that includes a job::job() call when trying to render:
Error in check_available():
! You must run this from the RStudio main session.
Backtrace:

  1. job::job(...)
  2. job:::check_available()
    Execution halted

Is there something I'm missing that would make it possible to render the RMarkdown even with the job sections? Or is this just fundamentally incompatible?

Including `devtools::load_all` package is creating an error

I'm getting this error

2021-11-15 19:14:28: Job started. Attaching packages: rscripts, lubridate, patchwork, ggfortify, broom, forcats, dplyr, purrr, readr, tidyr, tibble, ggplot2, tidyverse, stringr, zeallot, searcher, testthat, glue, devtools, usethis, magrittr, fcuk...Error in library(x, ...) : there is no package called 'rscripts'
Calls: sourceWithProgress ... FUN -> suppressMessages -> withCallingHandlers -> library
Execution halted

And rscripts is the name of the pseudo package I've created to keep track of my functions, etc. in this project that I'm assembling..

So I have a call like this:

devtools::load_all()

I suspect this is due to .package(). So running this I get:

> .packages() %>% print
 [1] "rscripts"  "lubridate" "patchwork" "ggfortify" "broom"     "forcats"   "dplyr"     "purrr"     "readr"    
[10] "tidyr"     "tibble"    "ggplot2"   "tidyverse" "stringr"   "stats"     "graphics"  "grDevices" "utils"    
[19] "datasets"  "zeallot"   "searcher"  "testthat"  "glue"      "devtools"  "usethis"   "magrittr"  "fcuk"     
[28] "methods"   "base"  

Alright, so that's where the problem lies..

Is this an issue that can be dealt with in this package?

I'll make a work-around for my purpose.

could not find function ".rs.checkBuildTools"

Hi thanks for developing the package!

The example brm model runs well in console. However, when I ran the example codes to get it in jobs:

# Send long-running code to a job
job::job(brm_result = {
  fit = brm(model, data)
  print(summary(fit))  # Show a summary in the job
})

I encountered this error:

Compiling Stan program...
Error in .rs.checkBuildTools(action) : 
  could not find function ".rs.checkBuildTools"
Calls: sourceWithProgress ... eval -> .fun -> cxxfunctionplus -> <Anonymous> -> check
Execution halted

Let me know how I should deal with this error. Thank you so much!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.