I’m trying to run some code with Rscript, but the job is taking longer than the time allowed by the scheduler.

How can I use DMTCP to restart jobs that surpass the time limit?

Here is a very simplified version of my code:

```
my_function <- function(curr.seq, weights){
# This function takes some time which I simulate here, using system sleep command
Sys.sleep (100)
return( rnorm(4) )
}
#simulate input parameters
set.seed(12345)
N <- 10000
a.seq <- sapply(1:N, FUN=function(x){paste0(sample(c("A","C","G","T"), 2000, replace=T), collapse="")})
weights <- c( 0.15,0.1,0.6,0.15)
#initialize matrix to be filled with computed values in the loop
result <- matrix(NA, nrow=N, ncol=4)
for ( i in 1:N ) {
# here I perform a number of intermediate calculations
# call function that takes relatively long time to finish
result[i,] <- my_function(a.seq[i], weights)
# Since the number of sequences this loop needs to go through is very large,
# I would like to add a DMTCP checkpoint here. How do I do this?
}
```

**CURATOR:** jpessin1