General plugins

New Virtual Programming Lab (VPL) module

 
Picture of Gildredge VLE Administrator
Re: New Virtual Programming Lab (VPL) module
 

Hi - we are really enjoying using VPL and are looking into developing the use of GUIs with our students. I've worked out how to get tkinter with Python working but am having problems working out how to incorporate images. I've put the image into the execution files - its a gif (I know tkinter doesn't like many image file types!) but I keep getting an error that the image cannot be found. 

Any help would be appreciated.

Kind regards

Estelle

 
Average of ratings: -
Picture of m k
Re: New Virtual Programming Lab (VPL) module
 

Here's what I found out about customizing the jail server.


When it gets a valid request from moodle, it:


  • forks a new process (still running as root)
  • uses "chroot" on the configured JAILPATH (usually /jail)
  • creates a new user & their HOME in the chrooted environment
  • uses "su" to switch execution mode to that user
  • creates the files it got in the request (submission and things like vpl_evaluate.sh) inside the new user's HOME
  • runs by default either "vpl_run.sh" or "vpl_evaluate.sh"
  • then runs "vpl_execution" that the previous steps should create
  • cleanup, etc.


From this flow, the important step for you is the "chroot" & "su" one. If you want to make extra files visible to the execution environment, you need to put them in either:


  • JAILPATH and make them world readable(/executable); that way, each execution will see the file "$JAILPATH/myfile" inside the execution env. as "/myfile" due to chroot, and will have read permissions
  • or in "/bin" or "/sbin", as these are mounted as read/execute-only inside JAILPATH, so things in them will naturally be visible (and also be in PATH)
  • the submission files themselves, but this is annoying and unnecessary


In either case, it would help to customize the vpl_run.sh for your specific type of task, so it symlinks or copies the "/myfile" to "$HOME/myfile" (will be cleaned up with the whole HOME) for the time of the execution if it is necessary to have it in the same directory or to be able to write it as well.


You can do that by putting your own "${your_language_with_dashes}_run.sh" (eg. "python-with-tkinter_run.sh") file in this folder on moodle: "$MOODLEPATH/mod/vpl/jail/default_scripts" (repo examples). 


Then you will get your own flavor of python from the "Run script" dropdown in "Execution options" in a moodle VPL activity.

 
Average of ratings: -
Picture of Juan Carlos Rodríguez-del-Pino
Re: New Virtual Programming Lab (VPL) module
Plugin developers

Hi, Gildredge

Notice that by security reason all "execution files" are removed after compilation phase and before the execution phase. If you want to change this behavior go to "Files to keep when running" and select the image files.

Best regards.

 
Average of ratings: -
Picture of Gildredge VLE Administrator
Re: New Virtual Programming Lab (VPL) module
 

Hi Juan


I have done that - I have also adapted the run script to make it run as an X-windows application, everything works fine with the tkinter code until I try to include an image an then I get the error that the image cannot be found. I have tested the code in IDLE and it works fine so it isn't an issue with the code itself.


I really appreciate the help.


Estelle

 
Average of ratings: -