Master Flaky Systems With Retries in Python 🐍 (avoid self-DDoS)

Поделиться
HTML-код
  • Опубликовано: 25 дек 2024

Комментарии • 21

  • @AbdolaMike
    @AbdolaMike 2 дня назад +1

    Hynek this looka awesome i'll definitely use stamina in some projects i was already using Tenacity but just setting retries to 3 but your video convinced me i need a little better tuning! appreciate it and love your videos!

  • @biophysics
    @biophysics 16 дней назад +5

    "I care a lot about automated testing, because I don't trust myself to write correct code, and if I did by accident, I don't trust myself to not break it in the future." - Hynek 2024
    Pure poetry, I love it. ^^

    • @The_Hynek
      @The_Hynek  16 дней назад

      the secret is to know one's limits 🧘‍♂️

  • @Lexaire
    @Lexaire 16 дней назад +2

    New Hynek video dropped! Love the library, will be trying it out soon!

  • @timseguine2
    @timseguine2 16 дней назад +1

    cool library. will probably use

  • @SFPython
    @SFPython 14 дней назад +1

    Stamina is great! I love that now I'm getting paged 3 times with jittered, exponential backoff. ;D

    • @The_Hynek
      @The_Hynek  14 дней назад

      Just like with food, there's *good* and *bad* paging!!1!

  • @squishy-tomato
    @squishy-tomato 16 дней назад +2

    thank you, Jason Segel of Python

    • @The_Hynek
      @The_Hynek  16 дней назад +1

      oof man i wish i had his hair ;)

  • @rednafi
    @rednafi 16 дней назад +1

    This is amazing. I like that Stamina has nicer defaults than Tenacity. The type hints are an added bonus. One question: when you say loops can’t handle exceptions, I was wondering what that means. We can use a try...except in loops, can’t we? Could you please point to a resource that explains why the context manager within the iterator helps here?

    • @The_Hynek
      @The_Hynek  16 дней назад

      YOU can use a try-except but the whole point of stamina (and Tenacity) is that we handle the errors automatically for you. I guess we could do something like `try: whatever() except Exception as e: attempt.handle()` but that's no way better than wrapping it into a context manager.

  • @iplith
    @iplith 16 дней назад +2

    Great video, thanks !

  • @goparism
    @goparism 16 дней назад +1

    Good stuff. Usually I write a simple basic retry decorator with all the things you've mentioned instead pip installing another library. Not sure if I'll end up using it, but I'll check it out :)

    • @The_Hynek
      @The_Hynek  16 дней назад

      Heh I’ve done it manually before too; the only thing that can get tricky is proper backoff computation. Fortunately there’s boltons with its drop-in-friendly design: boltons.readthedocs.io/en/latest/iterutils.html#boltons.iterutils.backoff_iter (I.e: no installation needed)

  • @glyph_official
    @glyph_official 16 дней назад +3

    If you're concerned about engagement with the youtube algorithm just do an aesthetic desk setup video where you talk about all the python packages you have installed in ~/.local while slow-panning over the logitech MX master, the CalDigit TS4, an ultrawide monitor and a macbook in clamshell mode in a vertical stand. Bonus points if it's *your* desk, but honestly that's probably not necessary

    • @glyph_official
      @glyph_official 16 дней назад +1

      Or do that distributed retry budgets video. 3 hour runtime easy, super high retention because every way to get it wrong is a cliffhanger

    • @The_Hynek
      @The_Hynek  16 дней назад +1

      I mean I own some of those things, but I'll need a lot more views to upgrade my TS3 to a TS4 and get a new monitor - like and subscribe everybody!

    • @The_Hynek
      @The_Hynek  16 дней назад +1

      @@glyph_official i think i'll need to figure out how to switch my LEDs to purple first