Given a bash script that specifies the SGE option -t (that is, an array job), this function submits that job using qsub for a given list of task IDs. This function is useful in case some tasks for a given job failed which you can find using qstat | grep Eqw or other options.

array_submit(
  job_bash,
  task_ids,
  submit =
    file.exists("/cm/shared/apps/sge/sge-8.1.9/default/common/accounting_20191007_0300.txt"),
  restore = TRUE
)

Arguments

job_bash

A character(1) vector with the name of a bash script in the current working directory.

task_ids

A set of task ids that will get parsed by parse_task_ids.

submit

A logical(1) vector determining whether to actually submit the tasks or not using qsub.

restore

A logical(1) vector determining whether to restore the script to the original state.

Value

The path to job_bash.

Author

Leonardo Collado-Torres

Examples


## Choose a script name
job_name <- paste0("array_submit_example_", Sys.Date())

## Create an array job on the temporary directory
with_wd(tempdir(), {
    ## Create an array job script to use for this example
    job_single(
        name = job_name,
        create_shell = TRUE,
        task_num = 100
    )

    ## Now we can submit the SGE job for a set of task IDs
    array_submit(
        job_bash = paste0(job_name, ".sh"),
        task_ids = "225019-225038:1,225040,225043",
        submit = FALSE
    )
})
#> 2023-05-07 07:12:13.527015 creating the logs directory at:  logs
#> 2023-05-07 07:12:13.528366 creating the shell file array_submit_example_2023-05-07.sh
#> To submit the job use: qsub array_submit_example_2023-05-07.sh
#> 2023-05-07 07:12:13.529713 resubmitting the SGE job for task 225019-225038:1
#> qsub array_submit_example_2023-05-07.sh
#> 2023-05-07 07:12:13.530386 resubmitting the SGE job for task 225040-225040
#> qsub array_submit_example_2023-05-07.sh
#> 2023-05-07 07:12:13.531011 resubmitting the SGE job for task 225043-225043
#> qsub array_submit_example_2023-05-07.sh
#> [1] "array_submit_example_2023-05-07.sh"