Python Tutorial - how to use concurrent futures in python to run multiple functions at the same time

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 พ.ย. 2024

ความคิดเห็น • 21

  • @davidaliaga4708
    @davidaliaga4708 8 หลายเดือนก่อน +4

    Why FInished in time is printed so many times?

    • @SahilAmin-ev4cr
      @SahilAmin-ev4cr 4 หลายเดือนก่อน

      time.perf_counter() doing it

  • @pihanimations804
    @pihanimations804 4 ปีที่แล้ว +2

    Nice vid, what I needed.

  • @brijeshkumar5603
    @brijeshkumar5603 4 ปีที่แล้ว +1

    Good one...

  • @elifebres466
    @elifebres466 3 ปีที่แล้ว +6

    How do you make it stop running the rest of the script until the futures are done running?

    • @krishna_o15
      @krishna_o15 วันที่ผ่านมา

      debugging such code is a nightmare

  • @judeleon8485
    @judeleon8485 3 ปีที่แล้ว +4

    Thanks Johan. I want to ask why you placed the 'if __name__=="__main__" ' statement within the context manager and not the other way. I can see there plenty "finished in time :" lines printed in the video. Meanwhile, I tried it the other way by placing the 'if __name__=="__main__" ' statement above and outside the context manager, I got expected result, less print outputs. Is there any particular reason you did it that way?

    • @Raecast
      @Raecast หลายเดือนก่อน

      Yeah seems really weird. Since when is name==main a requirement anywhere?

  • @soskokojsj3740
    @soskokojsj3740 3 ปีที่แล้ว +1

    Thank you for your great video ,!! I'd like to see a tuto of futures trading python of crossing two ema with taking profit targets . I 'm really stucked with functions and logics of taking profits with futures . I made a lot of research in the net but i didn't find much information . Please if possible explain it in a tutorial for your future videos . Thank you master

  • @Oopsiedaisy861
    @Oopsiedaisy861 ปีที่แล้ว

    Is there a way to pass in multiple arguments to that submit function call?

    • @isidrodeleon673
      @isidrodeleon673 ปีที่แล้ว

      You can pass all arguments declared in the function definition, separated with commas.

  • @immortalsun
    @immortalsun ปีที่แล้ว

    Great video! Although your link to the code doesn’t work anymore.

  • @klawpaw97918
    @klawpaw97918 2 ปีที่แล้ว

    some one explain me how i can stop a program in running time like we say alexa what news today the she say first news,2 news, 3 news but at time program is live running then we say stop program program is stop how ? plss explain

  • @SatishKumar-tg3bg
    @SatishKumar-tg3bg 3 ปีที่แล้ว

    how to run multiple selenium driver python script one by one in python

  • @devavratsinghbisht
    @devavratsinghbisht 3 ปีที่แล้ว

    def test(num):
    time.sleep(num)
    return "hello"
    start = time.time()
    with concurrent.futures.ProcessPoolExecutor() as executor:
    if __name__ == "__main__":
    f1 = executor.submit(test, 1)
    f2 = executor.submit(test, 1)

    print(time.time() - start)
    This is the code I used it's taking a little bit more than 14 seconds to execute where as on the cpu it took 2 second. Can you please help me and point out the mistake if there any ?

    • @ashutoshshukla2325
      @ashutoshshukla2325 ปีที่แล้ว

      You did not call the test function so please check that.

  • @mohmedside7133
    @mohmedside7133 3 ปีที่แล้ว +1

    The photo of your pc
    Photo in tamr Tg channel