WeBWorK Main Forum

webwork automation

webwork automation

by Siman Wong -
Number of replies: 2
Our department uses webwork for multi-section courses.  To simplify the setup we would like to automate the initial course creation.  We use perl scripts (based on existing WW scripts) to create the individual sections and then copy over the problem set templates (.def files). However, we couldn't figure out how to automatically import these .def files, or in other words to create courses with problem sets already imported.

We are hoping to make things as easy as possible for the individual section instructors and automate as much of the work as possible, so they do not have to spend much time configuring their courses.

Many large schools similar to ours use Webwork, so we wonder if there is a pre-existing solution to automatically create pre-configured course sections.  Where might we look for implementations of this?  In case this matter we are using Webwork 2.7.

Thanks!
In reply to Siman Wong

Re: webwork automation

by D. Brian Walton -
Siman,

I have wondered about the same thing. I have thought of two possible solutions:

1) The import process essentially takes the data in the .def file and creates new entries in the database tables, specifically the "sets" table. I think it should be possible to take a template course and create the assignments and export the "sets" and "problems" using the "wwdb" on the server to a text-based xml file. (See webwork2/bin/wwdb). Then import the relevant database entries into the corresponding tables for the desired courses. I do not know of a web-based approach to this strategy---it requires server access.

2) There are tools to script browser interactions with a webpage. For example, Selenium (http://docs.seleniumhq.org/). It would be possible to create a script that logs into the courses one at a time as an administrator, goes to the Homework Sets Editor, selects "Import", chooses the relevant problem sets, imports them, and then logs out, ready to go to the next course. (If user-lists are correct, it could also assign the problems to all users.)

If you already have server shell access, I would probably try the first method. I hadn't tried it before, but I just tried it out on a test course.

...[open shell on webwork server]
cd /opt/webwork/webwork2/bin/ (change this if needed)
./wwdb MATH205_master export ~/math205_master.xml set problem
./wwdb MATH205_1 import ~/math205_master.xml set problem
./wwdb MATH205_2 import ~/math205_master.xml set problem
(repeated for each new section)

where "MATH205_master" is the course id of my master section where the problem sets were put together, "~/math205_master.xml" is just the name of a file that I put in my home directory for the exported table information -- I just wanted something where permissions would not create problems, and "MATH205_1" and so on are the course ids of the other sections that need the same problem sets.

NOTE: This method does NOT assign the problems to the students -- I think that still needs to be done through the Instructor Tools interface.

Best wishes, and let us know if this works.

D. Brian Walton
James Madison University

In reply to D. Brian Walton

Re: webwork automation

by Gavin LaRose -
Hi Siman and Brian,

There are some contributed scripts that do some of what you're describing documented (and available in) the wiki: see http://webwork.maa.org/wiki/Contributed_Admin_Scripts_%28Large_Installations%29.

In particular, there's a rather large and somewhat unwieldy script there I use to build courses, assign sets, and update course rosters. We also have a stand-alone system that allows our course coordinators to build the required set definition files for a given course and semester; that's not described there, as it's rather site specific.

Gavin