use D6 batch API ?

douggreen - September 22, 2007 - 06:05
Project:Devel
Version:6.x-1.x-dev
Component:devel_generate
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Devel_generate is restricted to the php timeout. However if devel_generate used the new batch API, it could be used to an unlimited number of nodes. I wanted to create 100,000 nodes for testing some search changes, which simply can't be done with the current implementation. Yet, thanks to the batch API, this CAN be done relatively easily in 6.x.

#1

moshe weitzman - September 22, 2007 - 06:29

my understanding is that mysql time doesn't count toward the timeout so perhaps this is not needed? did you try it? anyway, this is a probably a good idea.

#2

douggreen - September 23, 2007 - 06:57
Status:active» patch (code needs work)

The attached patch adds the batch API for the admin/content/generate form. I've marked the patch as "needs work" only because similar (but easier) functions need to be created for the user and taxonomy generate forms. I've put a @TODO in the comment to indicate where this needs to be done. Also, there's really no reason that most of the work needs to stay in the new devel_generate_batch.inc file. I did most of the work here, mostly so that I could have a clean patch and change as little of the existing code as possible.

AttachmentSize
177722.patch8.78 KB

#3

moshe weitzman - September 23, 2007 - 09:17

i'd like to hear from chad or dww about any project profile impact.

#4

douggreen - September 23, 2007 - 12:07

I don't understand what you mean by "project profile impact." How would this patch to devel module impact the project module?

#5

hunmonk - September 23, 2007 - 17:03

we need to keep devel_generate_content() consistent IMO. there's no need to break any existing programatic implementations of the function when we can make it a wrapper.

also, it might be best to change over taxo and user creation in new issues, instead of creating a mega patch.

#6

douggreen - September 23, 2007 - 23:17
Status:patch (code needs work)» patch (code needs review)

I've reimplemented devel_generate_content for backward compatibility. I've also removed the TODO's by restoring the original generate taxonomies and users functions as-is... It makes less sense to change these because you're less likely to want large numbers of those tables.

AttachmentSize
177722_0.patch8.19 KB

#7

moshe weitzman@... - September 27, 2007 - 18:21
Status:patch (code needs review)» patch (code needs work)

i committed some pending changes i had to devel_generate_content. this likely needs a reroll. sorry about that. if you can reroll, i will commit before anything else sneaks in. thx.

#8

douggreen - May 11, 2008 - 00:49
Version:7.x-1.x-dev» 6.x-1.x-dev
Component:Code» devel_generate

LIVE FROM THE MINNESOTA SEARCH SPRINT, I'm reviving this old issue in preparation for search performance testing... I'm working off of a 6.x version for now, but will also post a 7.x version (which I suspect will be almost identical, if not exactly identical). This patch isn't quite right, but it's close.

AttachmentSize
177722.patch7.25 KB

#9

douggreen - May 11, 2008 - 01:24

... and a working version. However, it's not deleting content properly. I'm not sure if the not deleting content properly is a problem with devel or this patch, but because it's not working right, I'm still leaving as CNR.

AttachmentSize
177722.patch7.38 KB

#10

moshe weitzman - May 11, 2008 - 13:07

Hi Doug. If you are already in devel_generate and are motivated to do so, I want to switch the node creation so that taxonomy and comment work on the pre-save operation of nodeapi(). Other modules will plug themselves in there too (I want bulk creation of og nodes and og posts). Just a thought. Thanks for working on this.

Note that project module's install profile uses node creation programmatically so they won't be able to use the batch creation but I think thats fine and we are not likely to break anything for them.

#11

douggreen - May 11, 2008 - 21:52
Status:patch (code needs work)» patch (code needs review)

I fixed the delete problem. The attached patch now works. I used it last night to create 100,000 nodes.

AttachmentSize
177722.patch7.41 KB

#12

douggreen - May 11, 2008 - 22:03

And one more roll, this time with the new devel_generate_batch.inc.

AttachmentSize
177722.patch9.69 KB

#13

douggreen - May 11, 2008 - 22:47

This fixes num_comments.

AttachmentSize
177722.patch9.66 KB

#14

douggreen - May 11, 2008 - 22:49

And here's the 7.x patch

AttachmentSize
177722-7x.patch9.55 KB

#15

yched - May 11, 2008 - 23:23

No time to actually test, but shouldn't this line

+    $operations = array('devel_batch_generate_content_kill', array());

be
+    $operations[] = array('devel_batch_generate_content_kill', array());

?

#16

douggreen - May 12, 2008 - 01:51

Thanks yched, Yes it should! Attached patch is for 7.x.

AttachmentSize
177722-7x.patch9.56 KB

#17

douggreen - May 12, 2008 - 01:51

And here's the 6.x patch.

AttachmentSize
177722.patch9.66 KB

#18

douggreen - May 14, 2008 - 14:28

I'd love to see this committed before things get out-of-date again... Would you like me to commit it, or would you like some additional testing/comments? BTW, the batch api only kicks in if you try to create more than 50 nodes, so if you're testing, try creating 500 nodes.

#19

moshe weitzman - May 14, 2008 - 14:42
Status:patch (code needs review)» patch (reviewed & tested by the community)

@Doug - you may commit this to DRUPAL-6--1 and HEAD. I hope you will stay around to fix any bugs that may come up. Also note that I committed to devel_generate yesterday so please be careful to merge before committing.

#20

douggreen - May 14, 2008 - 16:34
Status:patch (reviewed & tested by the community)» fixed

Committed to both DRUPAL-6--1 and HEAD. Thanks!

#21

Anonymous (not verified) - May 28, 2008 - 16:35
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.