Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

wrong args for environment subassignment

Offen
#285 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
50/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Ruhig
Tech-Stack
r
Bereich
backend, hpc

Rechercherichtung

Start with the _targets.R example, process_chunks(), and the MulticoreParam/bplapply() call, then run tar_make() under the shown memory limits. Trace how the failure is reported after the parallel workers exit; done means the OOM case produces a meaningful memory-related error instead of wrong args for environment subassignment.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Hi,

I had the following error when trying to use MulticoreParam with R targets pipeline. Debugging doesn't reproduce the error. I later figured out it was OOM as it needed more than 2GB to process the data on HPC, while my local R session used to debug had more than 20GB memory allocations.

It would be ideal the print the more meaningful error message.

# _targets.R
library(targets)
library(crew)
library(crew.cluster)
library(BiocParallel)

controller_default <- crew_controller_slurm(
  name                           = "slurm_default",
  workers                        = 4,
  seconds_idle                   = 30,
  slurm_memory_gigabytes_per_cpu = 2,
  slurm_cpus_per_task            = 4
)

tar_option_set(
  controller = controller_default,
  resources  = tar_resources(
    crew = tar_resources_crew(controller = "slurm_default")
  )
)

process_chunks <- function() {
  
  cores <- as.numeric(Sys.getenv("SLURM_CPUS_PER_TASK", unset = 1)) - 1L
  if (nzchar(Sys.getenv("_R_CHECK_LIMIT_CORES_")))
    cores <- min(cores, 2L)
  
  bp <- MulticoreParam(workers = cores, progressbar = TRUE)
  
  bplapply(
    seq_len(cores + 1L),   
    FUN = function(i) {
      message(sprintf("[bpworker PID %d] task %d: allocating ~4 GB",
                      Sys.getpid(), i))
      n <- as.integer(2000 * 1024^2 / 8)   
      x <- rnorm(n)                         
      y <- rnorm(n)                          
      sum(x * y)
    },
    BPPARAM = bp
  )
}

# ── pipeline ──────────────────────────────────────────────────────────────────
list(
  tar_target(
    oom_bp,
    process_chunks()   # crew worker (2 GB) + forked bplapply children → OOM
  )
)

> library(targets)
> tar_make(store = "~", script = "~/_targets.R")
+ oom_bp dispatched                                         
✖ oom_bp errored                                             
✖ errored pipeline [50.9s, 0 completed, 0 skipped]           
Warning messages:
1: script_lines was deprecated on 2024-10-09 (version 0.3.2.9005). Alternative: options_cluster argument. 
2: slurm_memory_gigabytes_per_cpu was deprecated on 2024-10-09 (version 0.3.2.9005). Alternative: options_cluster argument. 
3: slurm_cpus_per_task was deprecated on 2024-10-09 (version 0.3.2.9005). Alternative: options_cluster argument. 
4: 1 targets produced warnings. Run targets::tar_meta(fields = warnings, complete_only = TRUE) for the messages. 
Error:
! Error in tar_make():
  wrong args for environment subassignment
  See https://books.ropensci.org/targets/debugging.html

Debug:

> tar_workspace(oom_bp, store = "~", script = "~/_targets.R")
Warning messages:
1: In readLines(script) : incomplete final line found on '~/_targets.R'
2: slurm_memory_gigabytes_per_cpu was deprecated on 2024-10-09 (version 0.3.2.9005). Alternative: options_cluster argument. 
3: slurm_cpus_per_task was deprecated on 2024-10-09 (version 0.3.2.9005). Alternative: options_cluster argument. 

> process_chunks()
  |                                                                                                                               |   0%
[bpworker PID 1690242] task 4: allocating ~4 GB
  |================                                                                                                               |  12%
[bpworker PID 1690239] task 1: allocating ~4 GB
  |================================                                                                                               |  25%
[bpworker PID 1690240] task 2: allocating ~4 GB
  |================================================                                                                               |  38%
[bpworker PID 1690245] task 7: allocating ~4 GB
  |================================================================                                                               |  50%
[bpworker PID 1690241] task 3: allocating ~4 GB
  |===============================================================================                                                |  62%
[bpworker PID 1690244] task 6: allocating ~4 GB
  |===============================================================================================                                |  75%
[bpworker PID 1690243] task 5: allocating ~4 GB
  |===============================================================================================================                |  88%
[bpworker PID 1690270] task 8: allocating ~4 GB
  |===============================================================================================================================| 100%

[[1]]
[1] 4439.251

[[2]]
[1] 14078.1

[[3]]
[1] -2978.421

[[4]]
[1] -35503.84

[[5]]
[1] -7880.825

[[6]]
[1] -3674.885

[[7]]
[1] 9433.41

[[8]]
[1] -9041.888
Vorherrschende Sprache
R
Sterne
69
Forks
32
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus Bioconductor/BiocParallel

Alle Issues in Bioconductor/BiocParallel

Ähnliche Issues

Weitere Issues zu R

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.