diff options
author | brian.quinlan <devnull@localhost> | 2009-05-10 11:40:27 +0000 |
---|---|---|
committer | brian.quinlan <devnull@localhost> | 2009-05-10 11:40:27 +0000 |
commit | 7d3328c003c816a11c466b7bea077687b38d2c8c (patch) | |
tree | 047422e860d79b36f90f18d98c3118165c8c27d3 | |
parent | b32b0bfba4f6c8cd4f0b71cf7cfbad979c6c2695 (diff) | |
download | futures-7d3328c003c816a11c466b7bea077687b38d2c8c.tar.gz |
Remove broken example.
-rw-r--r-- | copy.py | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/copy.py b/copy.py deleted file mode 100644 index e06cf74..0000000 --- a/copy.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python - -import functools -import futures.thread as futures -import shutil -import os -import os.path - -def copy_many(destination, sources_files): - for source_file in sources_files: - copied_files = [] - try: - shutil.copy2(source_file, destination) - except IOError, e: - for delete_file in copied_files: - try: - os.remove(delete_file) - except: - pass - raise - else: - copied_files.append(source_files) - -p = futures.ThreadPoolExecutor(max_threads=15) - -def copy_many(destination, sources_files): - copies = p.run( - (functools.partial(shutil.copy2, sources_file, destination) - for sources_file in sources_files), - run_until=futures.FIRST_EXCEPTION) - - if copies.has_exception_futures(): - copies.cancel() - for f in map(copies: - if not f.exception(): - - functools.partial(os.path.) - raise copies.get_exception_futures()[0].exception() - -""" -def copy_many(sources_and_destinations): - copies = p.run( - (functools.partial(shutil.copytree, source, destination) - for source, destination in sources_and_destinations), - run_until=futures.FIRST_EXCEPTION) - - print('copies:', copies) - if copies.has_exception_futures(): - print('HAS EXCEPTIONS') - copies.cancel(exit_running=True, wait_unit_finished=True) - p.run( - (functools.partial(shutil.rmtree, destination, ignore_errors=True) - for _, destination in sources_and_destinations), - run_until=futures.ALL_COMPLETED) - raise copies.get_exception_futures()[0].exception() - print('copies:', copies) - - -copy_many([('source1', 'destination/source1'), - ('source2', 'destination/source2'), - ('source3', 'destination/source3')]) -""" - -copy_many2('destination', ['source1', 'source2', 'source3', 'source4', 'source5', - 'source6', 'source7', 'source8', 'source9', 'source11'])
\ No newline at end of file |