0

I setup my Drupal 7 feed importer to import from a csv file with 20,000 nodes. I'm able to get it working with 20 nodes just to test to make sure everything is working. But is there a setting to be able to process X amount of nodes at once? My csv file is 12MB and I'd like to just do 300 at a time, but I don't see an option for this anywhere.

How would I make it process a set amount?

2 Answers 2

2

Recent versions of Feeds (since 7.x-2.0-beta1) will try to import as many items as it can per cron run. Imports can be ran on cron runs by either using the "Process in background" option or by setting the "Periodic import" option. By default, Feeds indeed imports items in batches of 50, but on each cron run Feeds will try to run as many batches as it can one minute.

If you want Feeds to run longer than one minute on each cron run, you can do so by altering the time limit of the queue 'feeds_source_import' by implementing hook_cron_queue_info_alter():

/**
 * Implements hook_cron_queue_info_alter().
 */
function mymodule_cron_queue_info_alter(&$queues) {
  // Run Feeds imports at max. 5 minutes per cron run.
  $queues['feeds_source_import']['time'] = 300;
}

You can also increase the batch size by setting the 'feeds_process_limit' variable:

// Process 250 items per batch.
variable_set('feeds_process_limit', 250);

Do so only if you are using an alternative way of importing the data (as on cron runs Feeds will already try to import multiple batches).

Finally, the dev version of Feeds has improved support for larger files downloaded with the HTTP Fetcher. I'm still working on the issue that a large CSV file must be completely imported within 6 hours. If you need more than 6 hours to complete the import (for example: if cron doesn't run often), try the patch from https://www.drupal.org/node/1029102.

5
  • on the latest feeds. i don't see any internal variable set for feeds_process_limit when i do a drush vget Commented Aug 30, 2017 at 20:31
  • on the latest feeds. i don't see any internal variable set for feeds_process_limit when i do a drush vget.. i manually added it with drush vset. If i was to change this variable in the code would I do it in plugins/FeedsProcessor.inc? That's the only file i see with define('FEEDS_PROCESS_LIMIT', 50) Commented Aug 30, 2017 at 20:43
  • fyi, i'm activating this via 'drush cron' so maybe its bypassing my manually set value? Commented Aug 30, 2017 at 20:58
  • If you want to change the 'feeds_process_limit' variable, you can do this by executing the PHP code in the answer, using drush vset, or by setting it in your settings.php file: $conf['feeds_process_limit'] = 100;. Changing it in plugins/FeedsProcessor.inc is highly discouraged, for reasons see drupal.org/docs/7/site-building-best-practices/never-hack-core.
    – MegaChriz
    Commented Aug 31, 2017 at 9:43
  • Note that if you are using cron to run your imports and you are using the latest Feeds version, changing the 'feeds_process_limit' variable has no gain (except when you are dealing with very large rows and Drupal runs out of memory during an import: in this case you would want to lower the 'feeds_process_limit' variable).
    – MegaChriz
    Commented Aug 31, 2017 at 9:47
1

Which version of Drupal are you using? I haven't checked on Feeds for Drupal 8, but Feeds for Drupal 7 (unless it's changed in the last few years) has a hard-coded item limit of 50. If you're importing from a CSV, your node architecture is probably pretty simple. You could try the Feed Import module instead of Feeds, in my experience it's better suited for very large imports.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.