...
https://github.com/macdiesel/edx-split-utils
How To Find the Size of All Active Structures
Issue this command at the MongoDB command line of the replica DB:
Code Block | ||||
---|---|---|---|---|
| ||||
db.modulestore.active_versions.find().forEach(
function(obj) {
var published_id = obj["versions"]["published-branch"];
struct_obj = db.modulestore.structures.findOne(published_id);
var curr = Object.bsonsize(struct_obj);
print(curr + " :: " + obj["org"] + "/" + obj["course"] + "/" + obj["run"]);
}
) |
How To Walk Structure History Backwards From the Current Active Version
Code Block | ||
---|---|---|
| ||
rs.slaveOk(); var course_id = { "org": "HarvardX", "course": "SPU27x", "run": "2015_Q2"}; course_idx = db.modulestore.active_versions.findOne(course_id); print("Course Index:") printjson(course_idx); var pub_struct_id = course_idx["versions"]["draft-branch"]; /* Walk the draft structure version tree backwards. */ var curr_struct = db.modulestore.structures.findOne( { "_id": pub_struct_id }, {_id: 1, edited_on: 1, previous_version: 1} ); print("Current draft structure: " + curr_struct._id); print("Edited on: " + curr_struct.edited_on); var generation = 1; while ( curr_struct != null ) { curr_struct = db.modulestore.structures.findOne( { "_id": curr_struct.previous_version }, {_id: 1, edited_on: 1, previous_version: 1} ); print("Previous: " + curr_struct._id + " - Edited on: " + curr_struct.edited_on + " - generation: " + generation); generation++; } |