Guest User

Untitled

a guest
Jun 17th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. from datetime import datetime
  2. from bokchoy.chain import Chain, Step
  3. from bokchoy import (
  4. consumers as bokchoy_consumers,
  5. parsers as bokchoy_parsers
  6. )
  7. from tofu import (
  8. parsers as tofu_parsers,
  9. consumers as tofu_consumers
  10. )
  11. from tofu.sources import (
  12. ftp_sources as tofu_sources,
  13. service_sources as tofu_svc_sources,
  14. )
  15.  
  16. logfile = '/data/shared/cron_logs/20180615_ams_coupons.log'
  17. import logging;logging.basicConfig(
  18. filename=logfile,
  19. level=logging.DEBUG,
  20. format=' '.join([
  21. '[%(asctime)s]',
  22. '[%(process)d]',
  23. '[%(name)s]',
  24. '[%(levelname)s]',
  25. '%(message)s']),
  26. )
  27.  
  28.  
  29. ### RUN COUPON CHAIN###
  30. ams_coupons_chain = Chain(name='ams_coupons_chain', steps=[
  31. Step(
  32. name='mix_match_upc_mapping',
  33. source=tofu_sources.MixMatchUpcFTPSource(day=datetime(2018,6,14)), # update date to previous day
  34. parser=tofu_parsers.MixMatchUpcParser(header=True),
  35. consumer=bokchoy_consumers.CollectionsConsumer(
  36. ext_product_identifier='upc')
  37. ),
  38. Step(
  39. name='ams_coupons',
  40. source=tofu_svc_sources.AmsOffersSource(),
  41. parser=bokchoy_parsers.IdentityParser(),
  42. consumer=tofu_consumers.AmsOffersConsumer()
  43. )])
  44. ams_coupons_chain()
Add Comment
Please, Sign In to add comment