Skip to content

Commit

Permalink
Log paths in GeopySparkRandomForestModel. #562
Browse files Browse the repository at this point in the history
  • Loading branch information
EmileSonneveld committed Apr 1, 2024
1 parent eceacd4 commit d1dc18c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions openeogeotrellis/ml/GeopySparkRandomForestModel.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import logging

import shutil
import typing
import uuid
Expand All @@ -11,6 +13,7 @@

from openeo_driver.utils import generate_unique_id

logger = logging.getLogger(__name__)

class GeopySparkRandomForestModel(DriverMlModel):

Expand Down Expand Up @@ -92,6 +95,7 @@ def write_assets(self, directory: Union[str, Path]) -> Dict[str, StacAsset]:
:return: STAC assets dictionary: https://github.com/radiantearth/stac-spec/blob/master/item-spec/item-spec.md#assets
"""
logging.info(f"write_assets({directory=})") # For debugging S3 paths
directory = Path(directory)
if not directory.is_dir():
directory = Path(directory).parent
Expand All @@ -100,6 +104,7 @@ def write_assets(self, directory: Union[str, Path]) -> Dict[str, StacAsset]:
shutil.make_archive(base_name=str(model_path), format='gztar', root_dir=directory)
shutil.rmtree(model_path)
model_path = Path(str(model_path) + '.tar.gz')
logging.info(f"{model_path=}") # For debugging S3 paths
return {model_path.name: {"href": str(model_path)}}

def get_model(self):
Expand Down

0 comments on commit d1dc18c

Please sign in to comment.