Skip to content

Commit

Permalink
Add a timing to log output
Browse files Browse the repository at this point in the history
  • Loading branch information
parejkoj authored and cmsaunders committed Nov 10, 2022
1 parent dabb542 commit c0b4e8f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/lsst/meas/algorithms/convertRefcatManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import os.path
import itertools
import multiprocessing
import time

import astropy.time
import astropy.units as u
Expand Down Expand Up @@ -125,8 +126,13 @@ def run(self, inputFiles):
for i in range(self.htmRange[0], self.htmRange[1]):
fileLocks[i] = manager.Lock()
self.log.info("File locks created.")

start_time = time.perf_counter()
with multiprocessing.Pool(self.config.n_processes) as pool:
result = pool.starmap(self._convertOneFile, zip(inputFiles, itertools.repeat(fileLocks)))
end_time = time.perf_counter()
self.log.info("Finished writing files. Elapsed time: %.2f seconds", end_time-start_time)

return {id: self.filenames[id] for item in result for id in item}

def _convertOneFile(self, filename, fileLocks):
Expand Down

0 comments on commit c0b4e8f

Please sign in to comment.