Metadata-Version: 1.2
Name: wcpan.worker
Version: 4.1.2
Summary: An asynchronous task queue with priority support.
Home-page: https://github.com/legnaleurc/wcpan.worker
Author: Wei-Cheng Pan
Author-email: legnaleurc@gmail.com
License: UNKNOWN
Description: wcpan.worker
        ============
        
        An asynchronous task queue with priority support.
        
        .. code:: python
        
            from wcpan.worker import AsyncQueue, Task
        
        
            class HighPriorityTask(Task):
        
                @property
                def priority(self) -> int:
                    return 2
        
        
            class LowPriorityTask(Task):
        
                @property
                def priority(self) -> int:
                    return 1
        
        
            # Note this queue is non-preemptive.
            queue = AsyncQueue()
            queue.start()
        
            # function_2 will come first.
            queue.post(LowPriorityTask(function_1))
            queue.post(HighPriorityTask(function_2))
        
            # cancel pending tasks
            queue.flush()
        
            # wait for executing task (if any) ends, then stop the queue
            await queue.stop()
        
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.7
Requires-Python: >= 3.7
