Added max-concurrency to loky executor

pull/889/head
Piero Toffanin 2018-07-03 13:01:18 -04:00
rodzic 71de5deeac
commit 0d6fda728e
4 zmienionych plików z 9 dodań i 6 usunięć

Wyświetl plik

@ -26,7 +26,7 @@ def classify(lasFile, smrf=False, slope=1, cellsize=3, maxWindowSize=10, maxDist
def create_dems(filenames, demtype, radius=['0.56'], gapfill=False, def create_dems(filenames, demtype, radius=['0.56'], gapfill=False,
outdir='', suffix='', resolution=0.1, **kwargs): outdir='', suffix='', resolution=0.1, max_workers=None, **kwargs):
""" Create DEMS for multiple radii, and optionally gapfill """ """ Create DEMS for multiple radii, and optionally gapfill """
fouts = [] fouts = []
@ -34,7 +34,7 @@ def create_dems(filenames, demtype, radius=['0.56'], gapfill=False,
filenames, demtype, filenames, demtype,
outdir=outdir, suffix=suffix, resolution=resolution, **kwargs) outdir=outdir, suffix=suffix, resolution=resolution, **kwargs)
with get_reusable_executor(timeout=None) as e: with get_reusable_executor(max_workers=max_workers, timeout=None) as e:
fouts = list(e.map(create_dem_for_radius, radius)) fouts = list(e.map(create_dem_for_radius, radius))
fnames = {} fnames = {}

Wyświetl plik

@ -9,7 +9,7 @@ from opendm import context
from scipy import signal, ndimage from scipy import signal, ndimage
import numpy as np import numpy as np
def create_25dmesh(inPointCloud, outMesh, dsm_resolution=0.05, depth=8, samples=1, maxVertexCount=100000, verbose=False): def create_25dmesh(inPointCloud, outMesh, dsm_resolution=0.05, depth=8, samples=1, maxVertexCount=100000, verbose=False, max_workers=None):
# Create DSM from point cloud # Create DSM from point cloud
# Create temporary directory # Create temporary directory
@ -32,7 +32,8 @@ def create_25dmesh(inPointCloud, outMesh, dsm_resolution=0.05, depth=8, samples=
outdir=tmp_directory, outdir=tmp_directory,
resolution=dsm_resolution, resolution=dsm_resolution,
products=['idw'], products=['idw'],
verbose=verbose verbose=verbose,
max_workers=max_workers
) )
dsm_points = dem_to_points(os.path.join(tmp_directory, 'mesh_dsm.tif'), os.path.join(tmp_directory, 'dsm_points.ply')) dsm_points = dem_to_points(os.path.join(tmp_directory, 'mesh_dsm.tif'), os.path.join(tmp_directory, 'dsm_points.ply'))

Wyświetl plik

@ -106,7 +106,8 @@ class ODMDEMCell(ecto.Cell):
maxsd=args.dem_maxsd, maxsd=args.dem_maxsd,
maxangle=args.dem_maxangle, maxangle=args.dem_maxangle,
decimation=args.dem_decimation, decimation=args.dem_decimation,
verbose=args.verbose verbose=args.verbose,
max_workers=args.max_concurrency
) )
if args.crop > 0: if args.crop > 0:

Wyświetl plik

@ -84,7 +84,8 @@ class ODMeshingCell(ecto.Cell):
dsm_resolution=float(1.0 / args.orthophoto_resolution), dsm_resolution=float(1.0 / args.orthophoto_resolution),
depth=self.params.oct_tree, depth=self.params.oct_tree,
maxVertexCount=self.params.max_vertex, maxVertexCount=self.params.max_vertex,
verbose=self.params.verbose) verbose=self.params.verbose,
max_workers=args.max_concurrency)
else: else:
log.ODM_WARNING('Found a valid ODM 2.5D Mesh file in: %s' % log.ODM_WARNING('Found a valid ODM 2.5D Mesh file in: %s' %
tree.odm_25dmesh) tree.odm_25dmesh)