Skip to content

Commit 8f7c5f0

Browse files
mgr/vol: add comments to explain queuing data structures
Add some comment to explains the purpose and details of data structures that are used for queuing of async jobs since right now it's not obvious from initialization. Signed-off-by: Rishabh Dave <[email protected]>
1 parent a1cd410 commit 8f7c5f0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/pybind/mgr/volumes/fs/async_job.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,16 @@ class AsyncJobs(threading.Thread):
118118
def __init__(self, volume_client, name_pfx, nr_concurrent_jobs):
119119
threading.Thread.__init__(self, name="{0}.tick".format(name_pfx))
120120
self.vc = volume_client
121-
# queue of volumes for starting async jobs
121+
# self.q is a deque of names of a volumes for which async jobs needs
122+
# to be started.
122123
self.q = deque() # type: deque
123-
# volume => job tracking
124+
125+
# self.jobs is a dictionary where volume name is the key and value is
126+
# a tuple containing two members: the async job and an instance of
127+
# threading.Thread that performs that job.
128+
# in short, self.jobs = {volname: (async_job, thread instance)}.
124129
self.jobs = {}
130+
125131
# lock, cv for kickstarting jobs
126132
self.lock = threading.Lock()
127133
self.cv = threading.Condition(self.lock)

0 commit comments

Comments
 (0)