Non-core contributed modules

Script for generating course data

Details

  • Type: New Feature New Feature
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.9.1
  • Fix Version/s: 1.9.17, 2.0.8
  • Component/s: Tool: Generators
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE

Description

This is a script with the following features:

1. Web and CLI interfaces (run with "php generator.php" to see usage)
2. Generation of:
a. Courses
b. Participants
c. Activities
d. Resources
e. Questions
3. Assignments of
a. Participants to courses
b. Questions to quizes

Can be found in contrib/tools/generators/generator.php

Issue Links

Activity

Hide
Nicolas Connault added a comment -

Script now works with 2.0 and 1.9.2

Show
Nicolas Connault added a comment - Script now works with 2.0 and 1.9.2
Hide
Pierre Pichet added a comment -

Will propose code for calculated type

Show
Pierre Pichet added a comment - Will propose code for calculated type
Hide
Pierre Pichet added a comment -

I think that the best way to create a complete calculated question will be to use the structure build when importing a calculated question using the xml import.
Unless you want to simulate the edit_calculated_form.php, the datasetdefinitions_form.php and the datasetitems_form.php.
The code you put on 1.9 seems to use this hypothesis but needs correction if you want to do it this way.
Can you give some instructions on how to use the generator.php i.e. where do you put the generator code?

Show
Pierre Pichet added a comment - I think that the best way to create a complete calculated question will be to use the structure build when importing a calculated question using the xml import. Unless you want to simulate the edit_calculated_form.php, the datasetdefinitions_form.php and the datasetitems_form.php. The code you put on 1.9 seems to use this hypothesis but needs correction if you want to do it this way. Can you give some instructions on how to use the generator.php i.e. where do you put the generator code?
Hide
Nicolas Connault added a comment -

Please see the README and TODO files recently added to CVS.

Show
Nicolas Connault added a comment - Please see the README and TODO files recently added to CVS.
Hide
Ashley Holman added a comment -

Hi, I'm having problems using this script with 1.9.2.

From command line:

$ php generator.php -u admin -pw loadtest -P mdl_ -v -nc 100 -ns 500 -nq 50 -qq 20
Notice: Undefined index: no-data in /var/www/html/loadtest/moodle/generator.php on line 277
Generating 500 students...

Notice: Undefined variable: DB in /var/www/html/loadtest/moodle/generator.php on line 318

Fatal error: Call to a member function get_field_sql() on a non-object in /var/www/html/loadtest/moodle/generator.php on line 318

From web interface:
Notice: Undefined index: no-data in /var/www/html/loadtest/moodle/generator.php on line 277
Generating 500 students...

Notice: Undefined variable: DB in /var/www/html/loadtest/moodle/generator.php on line 318

Fatal error: Call to a member function get_field_sql() on a non-object in /var/www/html/loadtest/moodle/generator.php on line 318

Any advice on how I can get this going? Thanks..

Show
Ashley Holman added a comment - Hi, I'm having problems using this script with 1.9.2. From command line: $ php generator.php -u admin -pw loadtest -P mdl_ -v -nc 100 -ns 500 -nq 50 -qq 20 Notice: Undefined index: no-data in /var/www/html/loadtest/moodle/generator.php on line 277 Generating 500 students... Notice: Undefined variable: DB in /var/www/html/loadtest/moodle/generator.php on line 318 Fatal error: Call to a member function get_field_sql() on a non-object in /var/www/html/loadtest/moodle/generator.php on line 318 From web interface: Notice: Undefined index: no-data in /var/www/html/loadtest/moodle/generator.php on line 277 Generating 500 students... Notice: Undefined variable: DB in /var/www/html/loadtest/moodle/generator.php on line 318 Fatal error: Call to a member function get_field_sql() on a non-object in /var/www/html/loadtest/moodle/generator.php on line 318 Any advice on how I can get this going? Thanks..
Hide
Nicolas Connault added a comment -

Yes, the trouble is that you are using the HEAD version of this script. You need to checkout the contrib branch with the MOODLE_19_STABLE tag. It should work fine then.

Show
Nicolas Connault added a comment - Yes, the trouble is that you are using the HEAD version of this script. You need to checkout the contrib branch with the MOODLE_19_STABLE tag. It should work fine then.
Hide
Ashley Holman added a comment -

Thanks.

I found that ~80% of the this script's running time is spent in rebuild_course_cache().

I moved the rebuild_course_cache() outside of the two nested loops for section/module creation and it sped it up dramatically. It looks like it should be OK to do the cache rebuilding at the end of the module/section generation because the cache information doesn't look like it gets used inbetween (unless someone was trying to view the course while the generator was still creating it?). I've attached a patch if you would like to take a look (i'm using the MOODLE_19_STABLE version).

Show
Ashley Holman added a comment - Thanks. I found that ~80% of the this script's running time is spent in rebuild_course_cache(). I moved the rebuild_course_cache() outside of the two nested loops for section/module creation and it sped it up dramatically. It looks like it should be OK to do the cache rebuilding at the end of the module/section generation because the cache information doesn't look like it gets used inbetween (unless someone was trying to view the course while the generator was still creating it?). I've attached a patch if you would like to take a look (i'm using the MOODLE_19_STABLE version).
Hide
Wen Hao Chuang added a comment -

By the way, if I remember correctly, this tool so far still can not generate "quiz attempt" data. Am I correct on this? It would be really nice if this tool could also generate quiz attempt data for testing Quiz Performance issues (for larger classes with lots of quiz questions and lots of quiz attempts, e.g. > 100,000 attempts for one quiz)...thanks!

Show
Wen Hao Chuang added a comment - By the way, if I remember correctly, this tool so far still can not generate "quiz attempt" data. Am I correct on this? It would be really nice if this tool could also generate quiz attempt data for testing Quiz Performance issues (for larger classes with lots of quiz questions and lots of quiz attempts, e.g. > 100,000 attempts for one quiz)...thanks!

People

Vote (3)
Watch (6)

Dates

  • Created:
    Updated: