I have 1678 nodes. Each node has one computed field.

Stuck at:

Re-computing field_vitalscount
0%
Initializing.

field_vitalscount, simply counts the values in a multiple value field; super simple computation.

$node_field[0]['value'] = count($node->field_vitals);

If I manually edit the node, the computed field works. Maybe this batch thingy doesn't work for Pressflow; maybe that's the problem? I'm going to leave it overnight, to see what happens.

Maybe someone knows why it's stuck at 0%

CommentFileSizeAuthor
#6 stuckat0.jpg9.61 KBcj-a-min

Comments

cj-a-min’s picture

This worked:

http://drupal.org/node/195013#comment-3760332

regenerate_9

Took approx 3-5 minutes; don't remember.

frakke’s picture

Hi,

There should be no issues with Pressflow6. The module is used on multiple pressflow6 sites where I work.

Have you tried to take a look in the Reports log right after you have run the batch-job?
Which kind of cck-field is it?

You might try the code:
$node_field[0]['value'] = (empty($node->field_vitals) || !is_array($node->field_vitals)) ? 0 : count($node->field_vitals);

(The patch you link to might and should work fine, but it is a lot slower, and the page and block cache is cleared each time a node is saved.)

cj-a-min’s picture

Thanks for reply.

Dang it!

regenerate_9 worked, but it reset my search index to 0%

0% of the site has been indexed. There are 1678 items left to index.

I still haven't further troubleshooted your module, because I thought regenerate_9 solved my problem. Will your module also reset the search index?

frakke’s picture

No, the only thing which is updated is the value in the computed field, so none of the annoying sideffects from re-saving all nodes should appear when using this.

cj-a-min’s picture

I will give it a try again. Be back to report.

cj-a-min’s picture

StatusFileSize
new9.61 KB

Ok I did as you said with all three computed fields:

1.

//$node_field[0]['value'] = count($node->field_vitals);
//this is to recompute field (Computed Field Tools module) without regenerating nodes
$node_field[0]['value'] = (empty($node->field_vitals) || !is_array($node->field_vitals)) ? 0 : count($node->field_vitals);

2.

function ucwordspecific($str,$delimiter){
$delimiter_space = '- ';
return str_replace($delimiter_space,$delimiter,ucwords(str_replace($delimiter,$delimiter_space,$str)));
}
$titlesku = ucwordspecific($node->model,'-');
//$node_field[0]['value'] = $titlesku;
//this is to recompute field (Computed Field Tools module) without regenerating nodes
$node_field[0]['value'] = (empty($titlesku) || !is_array($titlesku)) ? 0 : $titlesku;

3.

//$node_field[0]['value'] = "";
$sku = $node->model;
//$node_field[0]['value'] = $sku;
//this is to recompute field (Computed Field Tools module) without regenerating nodes
$node_field[0]['value'] = (empty($sku) || !is_array($sku)) ? 0 : $sku;

I tired all three on three seperate tries. Stalled at Initializing 0%.

Now keep in mind the first is a super simple compute. The second simply uppercases the first letter in each word, regardless of hyphen. The third simply gets the sku. Easy Peasy.

But it doesn't work. See attached image.

Also there is a typo on your admin/content/types/computed_field_recompute:
Please set site ind maintenance mode before re-computing fields.

Anyways, I hope this gets resolved.

Thanks for your help.

cj-a-min’s picture

Maybe it has something to do with the progress bar. Is there a way to skip the progress bar. This site has a mirror site which runs all intensive php/cron jobs, so there is no php timeouts. So really no need for the progress bar, as we have 30 gigs of ram and all the time in the world to run batch jobs.

If you think this is the problem (progress bar, i.e. javascript), how do I edit your module (just to test) to not use the batch operation progress bar?

thanks

cj-a-min’s picture

Ah Ha. By Golly I think I narrowed the issue. Go with me on this ride.

On the progress bar, I viewed the source repeatedly, i.e. firefox, view page source:

1.<div id="progress" class="progress"><div class="bar"><div class="filled" style="width: 6%"></div></div><div class="percentage">6%</div><div class="message"><br/><p>Processed <em>100</em> of <em>1678</em></p></div></div>

2.<div id="progress" class="progress"><div class="bar"><div class="filled" style="width: 12%"></div></div><div class="percentage">12%</div><div class="message"><br/><p>Processed <em>200</em> of <em>1678</em></p></div></div>

3.<div id="progress" class="progress"><div class="bar"><div class="filled" style="width: 18%"></div></div><div class="percentage">18%</div><div class="message"><br/><p>Processed <em>300</em> of <em>1678</em></p></div></div>

4.<div id="progress" class="progress"><div class="bar"><div class="filled" style="width: 24%"></div></div><div class="percentage">24%</div><div class="message"><br/><p>Processed <em>400</em> of <em>1678</em></p></div></div>

As you can see the fields are being recomputed ONLY WHEN I REFRESH (view source page). But it's not showing correctly on the page (UI), as moving; only in page source. AND the only way it moves, is if I refresh (view source page). And it does 100 nodes every time I view source page. This is very weird, that it will only process when I view page source.

See from the time I typed this post. I viewed page source and it showed up Processed 500 of 1678.

I know the progress bar thingy works, because it works for 'Node Imports Module' when I'm running imports, 1,000+ nodes.

Let me check on another browser. be back

cj-a-min’s picture

Ok I tried Opera browser. And it doesn't move at all, and even when i view page source. Opera, IE, etc.. all have cached enabled. Firefox, as described in above post does not have cache enabled (as we use firefox for site development), it's set to not cache anything. So every time I view page source, it's new information.

So hopefully this can help you decipher the problem. Or, maybe it is an isolated issue with us over here, especially since no else is chiming in on this thread.

I'm betting it's in issue on how the module is calling the batch job, i.e. progress bar. Anyways, I got to keep on moving so, I'll use regenerate_9 for now, and hopefully this gets fixed.

thanks

cj-a-min’s picture

Ok it works; hooorrraaayy.

Finally, anyways this is what I did.

1. Put site in maintenance mode.
1. Click on re-compute.
2. Takes me to our custom theme. Shows 0% stalled.
3. I Hit refresh (in FireFox) takes me to the site-maintenance default theme - it's here when the progress bar moves and the job completes.

But one snag is that the computed field (2) which contains the function, throws an error. I'm guessing it's because you can't put functions into computed fields. Anyways that's another issue. Bottom line is your module works great, and it's super fast! like in seconds!

Thanks

cj-a-min’s picture

Ok Im back,

Just wanted say, I love you man.

Turns out the function api thingy for computed fields is more work than I was willing to endure! So, I got rid of the function (which had nothing to do with the capabilities of your module) with this work around:

$titlesku1 = str_replace('-','- ',$node->model);
$titlesku2 = ucwords($titlesku1);
$titlesku3 = str_replace('- ','-',$titlesku2); 
$node_field[0]['value'] = $titlesku3;

So everything works great!

Have a merry xmas and a happy new year!

frakke’s picture

Status: Active » Closed (works as designed)

Great that it worked out for you :-)