์ฝ˜ํ…์ธ ๋กœ ๊ฑด๋„ˆ๋›ฐ๊ธฐ

์ฐธ์กฐ hub_sdk/helpers/utils.py

์ฐธ๊ณ 

์ด ํŒŒ์ผ์€ https://github.com/ultralytics/ hub-sdk/blob/main/ hub_sdk/helpers/utils .py์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฌธ์ œ๋ฅผ ๋ฐœ๊ฒฌํ•˜๋ฉด ํ’€ ๋ฆฌํ€˜์ŠคํŠธ (๐Ÿ› ๏ธ)๋ฅผ ์ œ์ถœํ•˜์—ฌ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๋ฐ ๋„์›€์„ ์ฃผ์„ธ์š”. ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค ๐Ÿ™!



hub_sdk.helpers.utils.threaded(func)

๋Œ€์ƒ ํ•จ์ˆ˜๋ฅผ ๋ฉ€ํ‹ฐ ์Šค๋ ˆ๋“œํ™”ํ•˜๊ณ  ์Šค๋ ˆ๋“œ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

์‚ฌ์šฉ๋ฒ•: ์Šค๋ ˆ๋“œ ๋ฐ์ฝ”๋ ˆ์ดํ„ฐ.

์˜ ์†Œ์Šค ์ฝ”๋“œ hub_sdk/helpers/utils.py
def threaded(func):
    """
    Multi-threads a target function and returns thread.

    Usage: @threaded decorator.
    """

    def wrapper(*args, **kwargs):
        """Multi-threads a given function and returns the thread."""
        thread = threading.Thread(target=func, args=args, kwargs=kwargs, daemon=True)
        thread.start()
        return thread

    return wrapper