Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Migrating our monolith to Python 3

This presentation describes our journey in the process of migrating our monolith from Python 2.7 to Python 3.6

  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

Migrating our monolith to Python 3

  1. 1. Migrating our monolith to Python 3 Django Bulgaria Meetup Group 18th of November, 2019
  2. 2. About Me Ilian Iliev Platform Engineer at Lifesum ilian@ilian.io www.ilian.io
  3. 3. The Status Quo ● One monolith running Python 2.7 ● 7 years old codebase ● MySQL, Django, Celery, Redis ● 38M users all around the world
  4. 4. The Plan ● Make the code Python 3 compatible ● Have it run on our test environments for a while ● Do a round of manual testing ● Ship it
  5. 5. I. Set it up ● Not all of our dependencies were Python 3 compatible ● Suds ● Add tests to mock the calls ● Replace it with zeep ● Verify
  6. 6. II. Make it run ● Failing imports ● Local imports ● Six ○ Moved libs ○ six.iteritems ○ Six.text_type ● Setup CircleCI to test both 2.7 and 3.6
  7. 7. III. Make tests pass ● six.iteritems ● six.text_type ● hashlib requires bytes ● exception.message ● xrange ● dict_keys ● filter ● Comparing with None ● round behaving differently
  8. 8. IV. Upgrade migrations & Manual test ● Custom column names existed as bytes in migrations ● Same for choices and help_text ● Some third party apps generated new migrations ● Manual tests
  9. 9. V. Release
  10. 10. VI. Rollback and aftermath ● Sentry could not handle the error load ● Redis is an issue ○ Via Django ○ Direct usage ● Python 3 incompatible code not covered by tests ● filter ● Lesson learned - Monday morning == Friday evening
  11. 11. VI. Second Try
  12. 12. Questions?
  13. 13. Thank you

×