Skip to content

Commit 06e0cac

Browse files
committed
Regenerate remove_default_chunk_size.patch -- still do not use this
1 parent e989b8d commit 06e0cac

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

remove_default_chunk_size.patch

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ This will remove the default chunk size for each priority level.
33
Do not yet use, this is a work-in-progress, and if you do not specify explicit chunk sizes, you will suffer a significant drop in performance.
44

55
diff --git a/nonblock/BackgroundWrite.py b/nonblock/BackgroundWrite.py
6-
index 8b9765c..b76cc28 100644
6+
index 3e812b4..7fd3e8e 100644
77
--- a/nonblock/BackgroundWrite.py
88
+++ b/nonblock/BackgroundWrite.py
9-
@@ -26,8 +26,9 @@ __all__ = ('BackgroundWriteProcess', 'BackgroundIOPriority', 'bgwrite', 'bgwrite
10-
# Uncomment the "DEBUG" sections you want to see below. Search for DEBUG.
11-
#DEBUG = False
9+
@@ -27,8 +27,9 @@ __all__ = ('BackgroundWriteProcess', 'BackgroundIOPriority', 'bgwrite', 'bgwrite
10+
#if DEBUG:
11+
# import sys
1212

1313
+_SIZE_MEG = 1024 * 1024
1414

@@ -17,16 +17,16 @@ index 8b9765c..b76cc28 100644
1717
'''
1818
bgwrite - Start a background writing process
1919

20-
@@ -46,7 +47,7 @@ def bgwrite(fileObj, data, closeWhenFinished=False, chainAfter=None, ioPrio=4):
20+
@@ -47,7 +48,7 @@ def bgwrite(fileObj, data, closeWhenFinished=False, chainAfter=None, ioPrio=4):
2121
@return - BackgroundWriteProcess - An object representing the state of this operation. @see BackgroundWriteProcess
2222
'''
23-
23+
2424
- thread = BackgroundWriteProcess(fileObj, data, closeWhenFinished, chainAfter, ioPrio)
2525
+ thread = BackgroundWriteProcess(fileObj, data, closeWhenFinished, chainAfter, ioPrio, chunkSize)
2626
thread.start()
2727

2828
return thread
29-
@@ -65,9 +66,9 @@ def bgwrite_chunk(fileObj, data, chunkSize, closeWhenFinished=False, chainAfter=
29+
@@ -66,9 +67,9 @@ def bgwrite_chunk(fileObj, data, chunkSize, closeWhenFinished=False, chainAfter=
3030

3131
@param chunkSize <integer> - The max siZe of each chunk.
3232
'''
@@ -38,7 +38,7 @@ index 8b9765c..b76cc28 100644
3838

3939

4040
class BackgroundIOPriority(object):
41-
@@ -77,9 +78,9 @@ class BackgroundIOPriority(object):
41+
@@ -78,9 +79,9 @@ class BackgroundIOPriority(object):
4242
See __init__ for fields
4343
'''
4444

@@ -48,9 +48,9 @@ index 8b9765c..b76cc28 100644
4848
- def __init__(self, chainPollTime, defaultChunkSize, bandwidthPct, numChunksRateSmoothing=5):
4949
+ def __init__(self, chainPollTime, bandwidthPct, numChunksRateSmoothing=5):
5050
'''
51-
__init__ - Create a BackgroundIOPriority.
51+
__init__ - Create a BackgroundIOPriority.
5252

53-
@@ -89,12 +90,6 @@ class BackgroundIOPriority(object):
53+
@@ -90,12 +91,6 @@ class BackgroundIOPriority(object):
5454
@param chainPollTime - float > 0, When chaining, this is the sleep time between checking if prior is finished.
5555
Too low and the polling takes up CPU time, too high and you'll lose a little time in between chained writes, while gaining interactivity elsewhere.
5656

@@ -63,24 +63,24 @@ index 8b9765c..b76cc28 100644
6363
A high number means higher throughput at the cost of lest interactivity for other tasks, a low number means the opposite.
6464

6565
So, for example, a bandwidthPct of "50" will attempt to use "50%" of the available bandwidth. Note, this does not represent theroetical
66-
@@ -107,7 +102,7 @@ class BackgroundIOPriority(object):
66+
@@ -108,7 +103,7 @@ class BackgroundIOPriority(object):
6767
See #bandwidthPct for the other half of the story. The higher this number, the more "fair" your application will be against a constant
6868
rate of I/O by other applications, but the less able it may be to play fair when the external I/O is spiking.
6969

7070
- Also, consider that this is related to the #defaultChunkSize, as it is not a constant period of time. The default of "5" should be okay,
7171
+ Also, consider that this is related to the #chunkSize, as it is not a constant period of time. The default of "5" should be okay,
7272
but you may want to tune it if you use really large or really small chunk sizes.
73-
74-
75-
@@ -116,7 +111,6 @@ class BackgroundIOPriority(object):
73+
74+
75+
@@ -117,7 +112,6 @@ class BackgroundIOPriority(object):
7676

7777

7878
self.chainPollTime = chainPollTime
7979
- self.defaultChunkSize = defaultChunkSize
8080
self.bandwidthPct = float(bandwidthPct)
8181
if bandwidthPct <= 0 or bandwidthPct > 100:
8282
raise ValueError('Given bandwidthPct %f must be > 0 and <= 100')
83-
@@ -138,16 +132,16 @@ _SIZE_MEG = 1024 * 1024
83+
@@ -139,16 +133,16 @@ _SIZE_MEG = 1024 * 1024
8484

8585
# BG_IO_PRIOS - Predefined I/O priorities, 1-10. The lower the number, the more throughput at the cost of interactivity
8686
BG_IO_PRIOS = {
@@ -107,7 +107,7 @@ index 8b9765c..b76cc28 100644
107107
}
108108

109109

110-
@@ -165,7 +159,7 @@ class BackgroundWriteProcess(threading.Thread):
110+
@@ -166,7 +160,7 @@ class BackgroundWriteProcess(threading.Thread):
111111
'''
112112
# Design question: What about errors?
113113

@@ -116,7 +116,7 @@ index 8b9765c..b76cc28 100644
116116
'''
117117
__init__ - Create the BackgroundWriteProcess thread. You should probably use bgwrite or bgwrite_chunk instead of calling this directly.
118118

119-
@@ -179,6 +173,12 @@ class BackgroundWriteProcess(threading.Thread):
119+
@@ -180,6 +174,12 @@ class BackgroundWriteProcess(threading.Thread):
120120

121121
@param ioPrio <int/BackgroundIOPriority> - If an integer (1-10), a predefined BackgroundIOPriority will be used. 1 is highest throughput, 10 is most interactivity. You can also pass in your own BackgroundIOPriority object if you want to define a custom profile.
122122

@@ -129,7 +129,7 @@ index 8b9765c..b76cc28 100644
129129

130130
@raises ValueError - If ioPrio is neither a BackgroundIOPriority nor integer 1-10 inclusive
131131
- If chainAfter is not a BackgroundWriteProcess or None
132-
@@ -195,7 +195,8 @@ class BackgroundWriteProcess(threading.Thread):
132+
@@ -196,7 +196,8 @@ class BackgroundWriteProcess(threading.Thread):
133133
raise ValueError('Invalid ioPrio: %s. Available priority levels are: %s' %(str(ioPrio), str(list(BG_IO_PRIOS.keys()))) )
134134

135135
if type(dataBlocks) not in (list, tuple):

0 commit comments

Comments
 (0)