@@ -1979,59 +1979,73 @@ ${details}
1979
1979
this . course_actions . clear_activity ( id ) ;
1980
1980
}
1981
1981
1982
- if (
1983
- grade_project_id != course_project_id &&
1984
- grade_project_id != student_project_id
1985
- ) {
1986
- // Make a fresh copy of the assignment files to the grade project.
1987
- // This is necessary because grading the assignment may depend on
1988
- // data files that are sent as part of the assignment. Also,
1989
- // student's might have some code in text files next to the ipynb.
1990
- await webapp_client . project_client . copy_path_between_projects ( {
1991
- src_project_id : course_project_id ,
1992
- src_path : student_path ,
1993
- target_project_id : grade_project_id ,
1994
- target_path : student_path ,
1995
- overwrite_newer : true ,
1996
- delete_missing : true ,
1997
- backup : false ,
1998
- } ) ;
1999
- }
1982
+ let ephemeralGradePath ;
1983
+ try {
1984
+ if (
1985
+ grade_project_id != course_project_id &&
1986
+ grade_project_id != student_project_id
1987
+ ) {
1988
+ ephemeralGradePath = true ;
1989
+ // Make a fresh copy of the assignment files to the grade project.
1990
+ // This is necessary because grading the assignment may depend on
1991
+ // data files that are sent as part of the assignment. Also,
1992
+ // student's might have some code in text files next to the ipynb.
1993
+ await webapp_client . project_client . copy_path_between_projects ( {
1994
+ src_project_id : course_project_id ,
1995
+ src_path : student_path ,
1996
+ target_project_id : grade_project_id ,
1997
+ target_path : student_path ,
1998
+ overwrite_newer : true ,
1999
+ delete_missing : true ,
2000
+ backup : false ,
2001
+ } ) ;
2002
+ } else {
2003
+ ephemeralGradePath = false ;
2004
+ }
2000
2005
2001
- const opts = {
2002
- timeout_ms : store . getIn (
2003
- [ "settings" , "nbgrader_timeout_ms" ] ,
2004
- NBGRADER_TIMEOUT_MS ,
2005
- ) ,
2006
- cell_timeout_ms : store . getIn (
2007
- [ "settings" , "nbgrader_cell_timeout_ms" ] ,
2008
- NBGRADER_CELL_TIMEOUT_MS ,
2009
- ) ,
2010
- max_output : store . getIn (
2011
- [ "settings" , "nbgrader_max_output" ] ,
2012
- NBGRADER_MAX_OUTPUT ,
2013
- ) ,
2014
- max_output_per_cell : store . getIn (
2015
- [ "settings" , "nbgrader_max_output_per_cell" ] ,
2016
- NBGRADER_MAX_OUTPUT_PER_CELL ,
2017
- ) ,
2018
- student_ipynb,
2019
- instructor_ipynb,
2020
- path : student_path ,
2021
- project_id : grade_project_id ,
2022
- } ;
2023
- /*console.log(
2006
+ const opts = {
2007
+ timeout_ms : store . getIn (
2008
+ [ "settings" , "nbgrader_timeout_ms" ] ,
2009
+ NBGRADER_TIMEOUT_MS ,
2010
+ ) ,
2011
+ cell_timeout_ms : store . getIn (
2012
+ [ "settings" , "nbgrader_cell_timeout_ms" ] ,
2013
+ NBGRADER_CELL_TIMEOUT_MS ,
2014
+ ) ,
2015
+ max_output : store . getIn (
2016
+ [ "settings" , "nbgrader_max_output" ] ,
2017
+ NBGRADER_MAX_OUTPUT ,
2018
+ ) ,
2019
+ max_output_per_cell : store . getIn (
2020
+ [ "settings" , "nbgrader_max_output_per_cell" ] ,
2021
+ NBGRADER_MAX_OUTPUT_PER_CELL ,
2022
+ ) ,
2023
+ student_ipynb,
2024
+ instructor_ipynb,
2025
+ path : student_path ,
2026
+ project_id : grade_project_id ,
2027
+ } ;
2028
+ /*console.log(
2024
2029
student_id,
2025
2030
file,
2026
2031
"about to launch autograding with input ",
2027
2032
opts
2028
2033
);*/
2029
- const r = await nbgrader ( opts ) ;
2030
- /* console.log(student_id, "autograding finished successfully", {
2034
+ const r = await nbgrader ( opts ) ;
2035
+ /* console.log(student_id, "autograding finished successfully", {
2031
2036
file,
2032
2037
r,
2033
2038
});*/
2034
- result [ file ] = r ;
2039
+ result [ file ] = r ;
2040
+ } finally {
2041
+ if ( ephemeralGradePath ) {
2042
+ await webapp_client . project_client . exec ( {
2043
+ project_id : grade_project_id ,
2044
+ command : "rm" ,
2045
+ args : [ "-rf" , student_path ] ,
2046
+ } ) ;
2047
+ }
2048
+ }
2035
2049
2036
2050
if ( ! nbgrader_grade_project && stop_student_project ) {
2037
2051
const idstop = this . course_actions . set_activity ( {
0 commit comments