topo_map_processor 0.1.11__tar.gz → 0.1.12__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: topo_map_processor
3
- Version: 0.1.11
3
+ Version: 0.1.12
4
4
  Summary: Library for processing topographic maps
5
5
  Project-URL: homepage, https://github.com/ramSeraph/topo_map_processor
6
6
  Project-URL: repository, https://github.com/ramSeraph/topo_map_processor.git
@@ -1,7 +1,14 @@
1
1
  # file generated by setuptools-scm
2
2
  # don't change, don't track in version control
3
3
 
4
- __all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
5
12
 
6
13
  TYPE_CHECKING = False
7
14
  if TYPE_CHECKING:
@@ -9,13 +16,19 @@ if TYPE_CHECKING:
9
16
  from typing import Union
10
17
 
11
18
  VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
12
20
  else:
13
21
  VERSION_TUPLE = object
22
+ COMMIT_ID = object
14
23
 
15
24
  version: str
16
25
  __version__: str
17
26
  __version_tuple__: VERSION_TUPLE
18
27
  version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
19
30
 
20
- __version__ = version = '0.1.11'
21
- __version_tuple__ = version_tuple = (0, 1, 11)
31
+ __version__ = version = '0.1.12'
32
+ __version_tuple__ = version_tuple = (0, 1, 12)
33
+
34
+ __commit_id__ = commit_id = None
@@ -26,6 +26,8 @@ from osgeo_utils.gdal2tiles import (
26
26
 
27
27
  from pmtiles_mosaic.tile_sources import create_source_from_paths, MissingTileError
28
28
 
29
+ from .utils import relax_open_file_limit
30
+
29
31
  def run_external(cmd):
30
32
  print(f'running cmd - {cmd}')
31
33
  start = time.time()
@@ -445,6 +447,8 @@ def retile_main(args):
445
447
  if tile_extension == 'jpg':
446
448
  tile_extension = 'jpeg'
447
449
 
450
+ relax_open_file_limit()
451
+
448
452
  os.environ['GDAL_CACHEMAX'] = '2048'
449
453
  os.environ['GDAL_MAX_DATASET_POOL_SIZE'] = '5000'
450
454
  os.environ['GDAL_DISABLE_READDIR_ON_OPEN'] = 'TRUE'
@@ -13,6 +13,8 @@ from pprint import pprint
13
13
 
14
14
  from osgeo_utils.gdal2tiles import submain as gdal2tiles_main
15
15
 
16
+ from .utils import relax_open_file_limit
17
+
16
18
  SUPPORTED_FORMATS = ['webp', 'jpeg', 'png']
17
19
 
18
20
  def run_external(cmd):
@@ -95,6 +97,7 @@ def cli():
95
97
  else:
96
98
  attribution_text = args.attribution
97
99
 
100
+ relax_open_file_limit()
98
101
 
99
102
  tiles_dir = Path(args.tiles_dir)
100
103
  tiles_dir.mkdir(parents=True, exist_ok=True)
@@ -0,0 +1,31 @@
1
+
2
+ import resource
3
+
4
+
5
+ def relax_open_file_limit():
6
+
7
+ # Get the current soft and hard limits for open files
8
+ current_soft, current_hard = resource.getrlimit(resource.RLIMIT_NOFILE)
9
+ print(f"Current open file limits: Soft={current_soft}, Hard={current_hard}")
10
+
11
+ # Set new soft and hard limits for open files
12
+ new_soft = resource.RLIM_INFINITY # Set to unlimited
13
+ new_hard = resource.RLIM_INFINITY # Set to unlimited
14
+
15
+ try:
16
+ resource.setrlimit(resource.RLIMIT_NOFILE, (new_soft, new_hard))
17
+ print(f"New open file limits set: Soft={new_soft}, Hard={new_hard}")
18
+ except Exception as e:
19
+ print(f"Error setting resource limit to unlimited: {e}")
20
+ print('Increasing soft limit to match the hard limit instead')
21
+ new_soft = current_hard
22
+ new_hard = current_hard
23
+ try:
24
+ resource.setrlimit(resource.RLIMIT_NOFILE, (new_soft, new_hard))
25
+ print(f"New open file limits set: Soft={new_soft}, Hard={new_hard}")
26
+ except Exception as e:
27
+ print(f"Error setting soft resource limit to match hard limit: {e}")
28
+
29
+ # Verify the new limits
30
+ updated_soft, updated_hard = resource.getrlimit(resource.RLIMIT_NOFILE)
31
+ print(f"Verified open file limits: Soft={updated_soft}, Hard={updated_hard}")