diff options
| author | VG <vg@devys.org> | 2016-04-06 21:34:34 +0200 | 
|---|---|---|
| committer | VG <vg@devys.org> | 2016-04-06 21:34:34 +0200 | 
| commit | 5d1b21751b056342771e69a545e842440060199d (patch) | |
| tree | dbe8800fb68c364573fb7531a7bcd001c67b6cb0 | |
| parent | 587b76de425fd84bdc3fa319af79dbc2d4245f05 (diff) | |
| download | wqueue-5d1b21751b056342771e69a545e842440060199d.tar.gz wqueue-5d1b21751b056342771e69a545e842440060199d.tar.bz2 wqueue-5d1b21751b056342771e69a545e842440060199d.zip | |
Auto-commit on 807fe7afb37fe2cfcf15c9457d04f64fa11b7511
| -rwxr-xr-x | tests/wqueue2.py | 16 | 
1 files changed, 13 insertions, 3 deletions
| diff --git a/tests/wqueue2.py b/tests/wqueue2.py index 5858fcd..0a3791f 100755 --- a/tests/wqueue2.py +++ b/tests/wqueue2.py @@ -18,6 +18,7 @@ class PersistentJobQueue2:          self.queue = deque.deque()          self.current_job = deque.deque()          self.event = asyncio.Event(loop=loop) +        self.loop = loop      def push_job(self, item):          self.queue.push_right(item) @@ -39,16 +40,25 @@ class PersistentJobQueue2:          assert not self.current_job.empty()          self.current_job.pop() -      def dump_queue(self, filename): +        ''' +            note: current file is not saved since it would be inconsistent if +            the queue is reloaded but file has finished being processed +            between. + +            Thus a file being processed is considered either done if done +            between dump and reload, or failed if the queue is shut down +            before its end. + +            The view here is we do not want to redo the work on a file, if the +            wanted result is a success: do not close the queue. +        '''          with u8open(filename, 'w') as f: -            f.write(self.current_job.dump())              f.write(self.queue.dump())      def reload_from_filename(self, filename):          with u8open(filename) as f:              items = f.read().parse() -        if   class PersistentJobQueue: | 
