Skip to content

Commit

Permalink
created new branch to workaround ray workflow error that did not reco…
Browse files Browse the repository at this point in the history
…gnize the ID created by start_tracking and used by end_tracking - rasterization no longer uses this variable (it is set to a meaningles string)
  • Loading branch information
julietcohen committed Mar 8, 2023
1 parent 46c60f5 commit 4f1dfdc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
30 changes: 18 additions & 12 deletions pdgraster/RasterTiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,9 @@ def rasterize_vector(self, path, overwrite=True):
bounds = self.tiles.get_bounding_box(tile)

# Track and log the event
id = self.__start_tracking('geotiffs_from_vectors')
logger.info(f'Rasterizing {path} for tile {tile} to {out_path}.')
#id = self.__start_tracking('geotiffs_from_vectors')
#print(f'Using ID: {id}')
print(f'OUT_PATH PRINTED HERE: Rasterizing {path} for tile {tile} to {out_path}.')

gdf = gpd.read_file(path)

Expand Down Expand Up @@ -317,8 +318,8 @@ def parent_geotiff_from_children(self, tile, overwrite=True):
return None

message = f'Creating tile {tile} from child geotiffs.'
id = self.__start_tracking(
'parent_geotiffs_from_children', message=message)
#id = self.__start_tracking(
# 'parent_geotiffs_from_children', message=message)

# Get paths to children geotiffs that we will use to make the
# composite, parent geotiff.
Expand Down Expand Up @@ -435,8 +436,8 @@ def webtile_from_geotiff(self, geotiff_path, overwrite=True):
tile = self.tiles.tile_from_path(geotiff_path)

message = f'Creating web tile {tile} from geotiff {geotiff_path}.'
id = self.__start_tracking(
'webtiles_from_geotiffs', message=message)
#id = self.__start_tracking(
# 'webtiles_from_geotiffs', message=message)

for i in range(len(stats)):
stat = stats[i]
Expand Down Expand Up @@ -578,7 +579,7 @@ def __start_tracking(self, event_type=None, message=None):

def __end_tracking(
self,
id=None,
id="id_replacement",
raster=None,
tile=None,
image=None,
Expand Down Expand Up @@ -614,11 +615,16 @@ def __end_tracking(
end_time = time.time()
if not hasattr(self, 'running_processes'):
self.running_processes = {}
if id in self.running_processes:
start_time, event_type = self.running_processes.pop(id)
total_time = end_time - start_time
else:
raise Exception(f'No event with id {id} found.')
# if id in self.running_processes:
# start_time, event_type = self.running_processes.pop(id)
# total_time = end_time - start_time
# else:
# raise Exception(f'No event with id {id} found.')

# replacement code for chunk above
# do not pull in variable id bc cannot get it working with ray
event_type = "event_type_replacement"
start_time = "start_time_replacement"

event = {
'id': id,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'morecantile >= 3.1, < 4',
'Rtree >= 0.9, < 1',
'rasterio >= 1.2, < 2',
'pdgstaging @ git+https://github.com/PermafrostDiscoveryGateway/viz-staging.git#egg=pdgstaging',
#'pdgstaging @ git+https://github.com/PermafrostDiscoveryGateway/viz-staging.git#egg=pdgstaging',
'colormaps @ git+https://github.com/pratiman-91/colormaps.git#egg=colormaps'
],
python_requires='>=3.9, <4',
Expand Down

0 comments on commit 4f1dfdc

Please sign in to comment.