per page, with , order by , clip by
Results of 1 - 10 of about 34 for worker (0.011 sec.)
concurrent.futures --- 並列タスク実行 — Python 3.14.8 ドキュメント 11615
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 並行実行 » concurrent.futures --- 並列タスク実行 テーマ 自動 ライト ダーク | concurrent.futures --- 並列タスク実行 ¶ Added in versi ... ようにスケジュールし、呼び出し可能オブジェクトの実行を表現する Future オブジェクトを返します。 with ThreadPoolExecutor ( max_workers = 1 ) as executor : future = executor . submit ( pow , 323 , 1235 ) print ( future . result ()) map ( fn , * iterables , ... ecutor (waiting as if Executor.shutdown() were called with wait set to True ): import shutil with ThreadPoolExecutor ( max_workers = 4 ) as e : e . submit ( shutil . copy , 'src1.txt' , 'dest1.txt' ) e . submit ( shutil . copy , 'src2.txt' , 'dest2.txt ... ) print ( a . result ()) # a will never complete because it is waiting on b. return 6 executor = ThreadPoolExecutor ( max_workers = 2 ) a = executor . submit ( wait_on_b ) b = executor . submit ( wait_on_a ) 以下でも同様です: def wait_on_future (): f ...
https://man.mtool.work/python/3.14/library/concurrent.futures.html
concurrent.futures --- 並列タスク実行 — Python 3.14.8 ドキュメント 11615
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 並行実行 » concurrent.futures --- 並列タスク実行 テーマ 自動 ライト ダーク | concurrent.futures --- 並列タスク実行 ¶ Added in versi ... ようにスケジュールし、呼び出し可能オブジェクトの実行を表現する Future オブジェクトを返します。 with ThreadPoolExecutor ( max_workers = 1 ) as executor : future = executor . submit ( pow , 323 , 1235 ) print ( future . result ()) map ( fn , * iterables , ... ecutor (waiting as if Executor.shutdown() were called with wait set to True ): import shutil with ThreadPoolExecutor ( max_workers = 4 ) as e : e . submit ( shutil . copy , 'src1.txt' , 'dest1.txt' ) e . submit ( shutil . copy , 'src2.txt' , 'dest2.txt ... ) print ( a . result ()) # a will never complete because it is waiting on b. return 6 executor = ThreadPoolExecutor ( max_workers = 2 ) a = executor . submit ( wait_on_b ) b = executor . submit ( wait_on_a ) 以下でも同様です: def wait_on_future (): f ...
https://man.mtool.work/python/3.14/library/concurrent.futures.html
Logging クックブック — Python 3.14.8 ドキュメント 11360
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python HOWTO » Logging クックブック テーマ 自動 ライト ダーク | Logging クックブック ¶ Author : Vinay Sajip <vinay_sajip at red-dove dot com> このページは、過去に ... ん。 次の例はmain (初期) スレッドとそれ以外のスレッドからのロギングの例です: import logging import threading import time def worker ( arg ): while not arg [ 'stop' ]: logging . debug ( 'Hi from myfunc' ) time . sleep ( 0.5 ) def main (): logging . basicC ... t = ' %(relativeCreated)6d %(threadName)s %(message)s ' ) info = { 'stop' : False } thread = threading . Thread ( target = worker , args = ( info ,)) thread . start () while True : try : logging . debug ( 'Hello from main' ) time . sleep ( 0.75 ) excep ... om random import choice , random import time # # Because you'll want to define the logging configurations for listener and workers, the # listener and worker process functions take a configurer parameter which is a callable # for configuring logging fo ...
https://man.mtool.work/python/3.14/howto/logging-cookbook.html
ライブラリと拡張 FAQ — Python 3.14.8 ドキュメント 10816
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python よくある質問 » ライブラリと拡張 FAQ テーマ 自動 ライト ダーク | ライブラリと拡張 FAQ ¶ ライブラリ一般の質問 ¶ 作業 X を行うためのモジュールやアプリケーショ ... なれば、 # それ以上の作業はないとして終了 (exit) する。 # (現実的には ワーカーは終了する (terminated) まで走り続ける) def worker (): print ( 'Running worker' ) time . sleep ( 0.1 ) while True : try : arg = q . get ( block = False ) except queue . Empt ... y : print ( 'Worker' , threading . current_thread (), end = ' ' ) print ( 'queue empty' ) break else : print ( 'Worker' , threading . current_ ... # キュー作成 q = queue . Queue () # 5つのワーカープールをスタート for i in range ( 5 ): t = threading . Thread ( target = worker , name = 'worker %i ' % ( i + 1 )) t . start () # キューへの作業追加を開始 for i in range ( 50 ): q . put ( i ) # スレッド ...
https://man.mtool.work/python/3.14/faq/library.html
ライブラリと拡張 FAQ — Python 3.14.8 ドキュメント 10816
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python よくある質問 » ライブラリと拡張 FAQ テーマ 自動 ライト ダーク | ライブラリと拡張 FAQ ¶ ライブラリ一般の質問 ¶ 作業 X を行うためのモジュールやアプリケーショ ... なれば、 # それ以上の作業はないとして終了 (exit) する。 # (現実的には ワーカーは終了する (terminated) まで走り続ける) def worker (): print ( 'Running worker' ) time . sleep ( 0.1 ) while True : try : arg = q . get ( block = False ) except queue . Empt ... y : print ( 'Worker' , threading . current_thread (), end = ' ' ) print ( 'queue empty' ) break else : print ( 'Worker' , threading . current_ ... # キュー作成 q = queue . Queue () # 5つのワーカープールをスタート for i in range ( 5 ): t = threading . Thread ( target = worker , name = 'worker %i ' % ( i + 1 )) t . start () # キューへの作業追加を開始 for i in range ( 50 ): q . put ( i ) # スレッド ...
https://man.mtool.work/python/3.14/faq/library.html
Logging クックブック — Python 3.14.8 ドキュメント 10752
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python HOWTO » Logging クックブック テーマ 自動 ライト ダーク | Logging クックブック ¶ Author : Vinay Sajip <vinay_sajip at red-dove dot com> このページは、過去に ... ん。 次の例はmain (初期) スレッドとそれ以外のスレッドからのロギングの例です: import logging import threading import time def worker ( arg ): while not arg [ 'stop' ]: logging . debug ( 'Hi from myfunc' ) time . sleep ( 0.5 ) def main (): logging . basicC ... t = ' %(relativeCreated)6d %(threadName)s %(message)s ' ) info = { 'stop' : False } thread = threading . Thread ( target = worker , args = ( info ,)) thread . start () while True : try : logging . debug ( 'Hello from main' ) time . sleep ( 0.75 ) excep ... om random import choice , random import time # # Because you'll want to define the logging configurations for listener and workers, the # listener and worker process functions take a configurer parameter which is a callable # for configuring logging fo ...
https://man.mtool.work/python/3.14/howto/logging-cookbook.html
キュー — Python 3.14.8 ドキュメント 8963
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » ネットワーク通信とプロセス間通信 » asyncio --- 非同期 I/O » キュー テーマ 自動 ライト ダーク | キュー ¶ ソースコード: Lib/asyncio/q ... って、並行処理を行う複数のタスクにワークロードを分散させることができます: import asyncio import random import time async def worker ( name , queue ): while True : # Get a "work item" out of the queue. sleep_for = await queue . get () # Sleep for the "sle ... sleep_for = random . uniform ( 0.05 , 1.0 ) total_sleep_time += sleep_for queue . put_nowait ( sleep_for ) # Create three worker tasks to process the queue concurrently. tasks = [] for i in range ( 3 ): task = asyncio . create_task ( worker ( f 'worke ... ed. started_at = time . monotonic () await queue . join () total_slept_for = time . monotonic () - started_at # Cancel our worker tasks. for task in tasks : task . cancel () # Wait until all worker tasks are cancelled. await asyncio . gather ( * tasks ...
https://man.mtool.work/python/3.14/library/asyncio-queue.html
キュー — Python 3.14.8 ドキュメント 8643
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » ネットワーク通信とプロセス間通信 » asyncio --- 非同期 I/O » キュー テーマ 自動 ライト ダーク | キュー ¶ ソースコード: Lib/asyncio/q ... って、並行処理を行う複数のタスクにワークロードを分散させることができます: import asyncio import random import time async def worker ( name , queue ): while True : # Get a "work item" out of the queue. sleep_for = await queue . get () # Sleep for the "sle ... sleep_for = random . uniform ( 0.05 , 1.0 ) total_sleep_time += sleep_for queue . put_nowait ( sleep_for ) # Create three worker tasks to process the queue concurrently. tasks = [] for i in range ( 3 ): task = asyncio . create_task ( worker ( f 'worke ... ed. started_at = time . monotonic () await queue . join () total_slept_for = time . monotonic () - started_at # Cancel our worker tasks. for task in tasks : task . cancel () # Wait until all worker tasks are cancelled. await asyncio . gather ( * tasks ...
https://man.mtool.work/python/3.14/library/asyncio-queue.html
asyncio and free-threaded Python — Python 3.14.8 ドキュメント 8308
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » ネットワーク通信とプロセス間通信 » asyncio --- 非同期 I/O » asyncio and free-threaded Python テーマ 自動 ライト ダーク | asyncio an ... those loops independently. Here's an example of how to use asyncio with threads: import asyncio import threading async def worker ( name : str ) -> None : print ( f "Worker { name } starting" ) await asyncio . sleep ( 1 ) print ( f "Worker { name } don ... e" ) def run_loop ( name : str ) -> None : asyncio . run ( worker ( name )) threads = [ threading . Thread ( target = run_loop , args = ( f "T { i } " ,)) for i in range ( 4 ) ] for t in t ...
https://man.mtool.work/python/3.14/library/asyncio-threading.html
asyncio and free-threaded Python — Python 3.14.8 ドキュメント 8308
ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » ネットワーク通信とプロセス間通信 » asyncio --- 非同期 I/O » asyncio and free-threaded Python テーマ 自動 ライト ダーク | asyncio an ... those loops independently. Here's an example of how to use asyncio with threads: import asyncio import threading async def worker ( name : str ) -> None : print ( f "Worker { name } starting" ) await asyncio . sleep ( 1 ) print ( f "Worker { name } don ... e" ) def run_loop ( name : str ) -> None : asyncio . run ( worker ( name )) threads = [ threading . Thread ( target = run_loop , args = ( f "T { i } " ,)) for i in range ( 4 ) ] for t in t ...
https://man.mtool.work/python/3.14/library/asyncio-threading.html
PREV 1 2 3 4 NEXT