Skip to content

Commit

Permalink
Fix DtoD copy reporting on ltfs_ordered_copy (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
Atsushi Abe authored Oct 29, 2020
1 parent 572c738 commit aa181ad
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/utils/ltfs_ordered_copy
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ class Progress:
if self.logger.getEffectiveLevel() == INFO:
logger.info("")

def writer(logger, prog, q, success, fail):
RESULT_LOCK = threading.Lock()

def writer(logger, prog, q, r):
while True:
try:
ci = q.popleft()
Expand All @@ -232,11 +234,14 @@ def writer(logger, prog, q, success, fail):
exit(1)

prog.update()

result = ci.run()
if result:
success = success + 1
else:
fail = fail + 1

with RESULT_LOCK:
if result:
r[0] = r[0] + 1
else:
r[1] = r[1] + 1

VEA_PREFIX=''
LTFS_SIG_VEA='ltfs.softwareProduct'
Expand Down Expand Up @@ -411,14 +416,18 @@ prog_disk = Progress(logger, 'File copy from disk is on going', len(direct))
if len(direct):
logger.info("Copying on {} disk files with {} threads".format(len(direct), direct_write_threads))
writers = []
result = [0, 0]
for i in range(direct_write_threads):
th = threading.Thread(target = writer, args = ([logger, prog_disk, direct, success, fail]))
th = threading.Thread(target = writer, args = ([logger, prog_disk, direct, result]))
writers.append(th)
th.start()

for th in writers:
th.join()

success = result[0]
fail = result[1]

prog_disk.finish()

# Copy files on LTFS
Expand Down

0 comments on commit aa181ad

Please sign in to comment.