tbrown122387 / gradeR

helps grade R script assignment submissions!
Other
4 stars 3 forks source link

calcGrades() function stuck in infinite loop #19

Closed kinson2 closed 2 years ago

kinson2 commented 2 years ago

I have been using graderR consistently this fall with no real trouble running things until today. This morning for some reason, I run the calcGrades() function on my work files and even on your original files in the vignette and it's not working properly. The calcGrades() function is stuck running infinitely without any clear reason why. It was working for me fine on Friday Sep 9, 2022. Any ideas about what's going on?

kinson2 commented 2 years ago

Screenshot (217)

kinson2 commented 2 years ago

I'm using the CRAN version not the development version. Windows 10.

tbrown122387 commented 2 years ago

It probably depends on the submission code gradeR is trying to run. Can you post the content of the submissions files, or ideally make the example self contained? Set verbose=TRUE at the very least and it will tell you which file it's getting hung up on.

The vignette code seems to work fine for me:

library(gradeR)
setwd("~/gradeR/vignettes/example/distributed_assignment/") # the folder with the data set inside it
calcGrades(submission_dir = "../submissions/", 
           your_test_file = "../grading_resources/assignment1_grading_file.r",
           suppress_warnings = F,
           verbose = T)
kinson2 commented 2 years ago

On a different machine, I added your verbose=TRUE argument and it ran once very stable. Then I changed the data in the both student files to R's internal dataset "iris", thus, myDataFrame <- iris. Then I get the infinite loop again! But the loop does not show any verbose messages other than graderfile.r repeatedly. I close RStudio. Try in R thinking it's an RStudio issue. Same trouble. Then I create a new directory, which is a copy of the existing one with a new name graderorig2. I still get the infinite loop, but now it's at least showing me verbose messages. I stop the code after a few seconds. See the following:

# load in the package
> library(gradeR)
> 
> # this is the directory with all of the student submissions
> submissionDir <- "C:/Users/dj-ck/Desktop/graderorig2/"
> 
> # get the grades
> grades <- calcGrades(submission_dir = submissionDir, 
+                      your_test_file = "C:/Users/dj-ck/Desktop/graderorig2/sub/testthat.r",
+                      verbose=TRUE)
EEE
grading:  jd1.r 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
[1] "error: file(file, \"rt\")"

 Stack trace:

 12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, q ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  jd2.r 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
[1] "error: file(file, \"rt\")"

 Stack trace:

 12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, q ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  sub/graderfile.r 
|
 jd1.r : 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
 "error: file(file, \"rt\")"

 Stack trace:

-12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, quote = quote,  ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  jd2.r 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
 "error: file(file, \"rt\")"

 Stack trace:

/12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, quote = quote,  ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  sub/graderfile.r 
/
 jd1.r : 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
 "error: file(file, \"rt\")"

 Stack trace:

-12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, quote = quote,  ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  jd2.r 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
 "error: file(file, \"rt\")"

 Stack trace:

/12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, quote = quote,  ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  sub/graderfile.r 
/
 jd1.r : 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
 "error: file(file, \"rt\")"

 Stack trace:

-12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, quote = quote,  ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  jd2.r 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
 "error: file(file, \"rt\")"

 Stack trace:

/12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, quote = quote,  ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  sub/graderfile.r 
/
 jd1.r : 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
 "error: file(file, \"rt\")"

 Stack trace:

-12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, quote = quote,  ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  jd2.r 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
 "error: file(file, \"rt\")"

 Stack trace:

/12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, quote = quote,  ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  sub/graderfile.r 
/
 jd1.r : 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
 "error: file(file, \"rt\")"

 Stack trace:

\12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, quote = quote,  ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  jd2.r 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
 "error: file(file, \"rt\")"

 Stack trace:

-12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, quote = quote,  ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  sub/graderfile.r 
-
 jd1.r : 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
 "error: file(file, \"rt\")"

 Stack trace:

\12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, quote = quote,  ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  jd2.r 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
 "error: file(file, \"rt\")"

 Stack trace:

-12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, quote = quote,  ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  sub/graderfile.r 
-
 jd1.r : 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
 "error: file(file, \"rt\")"

 Stack trace:

|12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, quote = quote,  ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  jd2.r 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
 "error: file(file, \"rt\")"

 Stack trace:

\12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, quote = quote,  ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  sub/graderfile.r 
\
 jd1.r : 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
 "error: file(file, \"rt\")"

 Stack trace:

|12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, quote = quote,  ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  jd2.r 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
 "error: file(file, \"rt\")"

 Stack trace:

\12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, quote = quote,  ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  sub/graderfile.r 
\
 jd1.r : 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
 "error: file(file, \"rt\")"

 Stack trace:

|12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, quote = quote,  ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  jd2.r 
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'data.csv': No such file or directory
 "error: file(file, \"rt\")"

 Stack trace:

\12. (function (source_file_path)  ...
 13. base:::source(source_file_path, rogueEnv)
 14. base:::withVisible(eval(ei, envir))
 15. base:::eval(ei, envir)
 16. base:::eval(ei, envir)
 17. utils:::read.csv("data.csv")
 18. utils:::read.table(file = file, header = header, sep = sep, quote = quote,  ...
 19. base:::file(file, "rt")
 20. base:::.handleSimpleError(function (e)  ...
 21. h(simpleError(msg, call))

 x cannot open the connection 

[1] "assigning all zeros for this student due to bug in submissions"
grading:  sub/graderfile.r 
-
> 
kinson2 commented 2 years ago

What I expected was that the calcGrades() function would at least stop itself after recognizing the trouble, but it keeps going. Constantly trying to run the same things over and over. I'm wondering if it's a cached issue. Like once it does the infinite loop thing, it never wants to return to non-infinite loop status. I even tried changing the student data to your same data.csv file in the same directory as all other files. No dice. I also tried using a public link for the data.csv in github: https://github.com/kinson2/testing-gh-cli/blob/main/data.csv. No dice either.

kinson2 commented 2 years ago

jd1.r

# Jane Doe's assignment 1
# Aug. 8 2019
# STAT 101

# question 1
myVector <- 1:3

# question 2
myString <- "Jane Doe"

# question 3
myDataFrame <- read.csv("data.csv")

jd2.r

# John Doe's assignment 1

# question 1
myVector <- c(1,2,3)

# question 2
# I had a little trouble with this one!

# question 3
myDataFrame <- read.csv("data.csv")
kinson2 commented 2 years ago

I think I figured out the problem. I was making a file called grader.R that lived in the same directory as the other submission files and test_that file. The grader.R file contained the code:

library(gradeR)

 # this is the directory with all of the student submissions
 submissionDir <- "C:/Users/dj-ck/Desktop/graderorig2/"

 # get the grades
 grades <- calcGrades(submission_dir = submissionDir, 
                      your_test_file = "C:/Users/dj-ck/Desktop/graderorig2/sub/testthat.r",
                      verbose=TRUE)