Solution: use drush to integrate.
========
Hi
I have two importers that need to run in a specific order. For example:
1) Importer 'Films' imports all the films showing at a cinema, creating 'film' nodes.
2) Importer 'Showtimes' imports the show times for each film, creating 'showtime' nodes.
Both importers are scheduled to run every day. 'Showtimes' must always run after 'Films' is fully imported, as it creates node references to film nodes.
Things I have tried:
Using Rules instead of Job Scheduler. I created a custom rules action using this code:
while (FEEDS_BATCH_COMPLETE != feeds_source('my_importer_id', $node->nid)->import());
I created a rule that triggers on cron with two actions: import films, import showtimes. This kind of works but when I look at the newly created nodes, showtime nodes are being generated before all the film nodes are created. So I guess a rules actions aren't processed sequentially...?
Using Feeds Rules to chain one import onto another. Feeds Rules provides a 'after Feeds import' rules event.
So I tried creating a rule that triggers 'showtimes' importer (using my custom action above) after 'films' importer has run. But I ran into a problem applying a condition on the rule provided by the module.
Thanks,
Jason
Comments
Comment #1
bstras21 commentedDid you ever figure out how to do this? I need the exact same thing.
Thanks
Comment #2
Jason Dean commentedYep I ended up using two drush commands (after applying this excellent patch). Then the commands can be run using any kind of script at any scheduled times.
I guess the ideal solution would still be a custom module. That way, it could check that the first import ran successfully before triggering the next. But the drush method is working well for me.
Comment #3
imclean commentedYou could also use hook_feeds_after_import() to start another import.
Comment #4
clemens.tolboomComment #5
clemens.tolboomThis issue is fixed.
Comment #7
steva1982 commentedThe possibility to import feeds consecutively with two drush commands would be great. Could you specify these commands and the script to run them at any scheduled times?
Thank you