Skip to content

Commit

Permalink
Release version 1.6.2, Merge pull request #287 from sentinel-hub/develop
Browse files Browse the repository at this point in the history
Release version 1.6.2
  • Loading branch information
zigaLuksic authored Oct 17, 2023
2 parents 44b0351 + 0ae89b5 commit 30e20de
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 16 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [Version 1.6.2] - 2023-10-17

- Fixed a bug in `BatchDownloadPipeline` where the evalscript was not read correctly.


## [Version 1.6.1] - 2023-10-11

- Pipelines can now save EOPatches in Zarr format
Expand Down
2 changes: 1 addition & 1 deletion eogrow/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""The main module of the eo-grow package."""

__version__ = "1.6.1"
__version__ = "1.6.2"
13 changes: 8 additions & 5 deletions eogrow/pipelines/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,7 @@ def _get_output_features(self) -> list[Feature]:
return self.config.features

def _get_download_node(self, session_loader: SessionLoaderType) -> EONode:
evalscript_path = fs.path.join(
self.storage.get_folder(self.config.evalscript_folder_key), self.config.evalscript_path
)
with self.storage.filesystem.open(evalscript_path) as evalscript_file:
evalscript = evalscript_file.read()
evalscript = self._get_evalscript()

time_diff = None if self.config.time_difference is None else dt.timedelta(minutes=self.config.time_difference)

Expand All @@ -326,6 +322,13 @@ def _get_download_node(self, session_loader: SessionLoaderType) -> EONode:
)
return EONode(download_task)

def _get_evalscript(self) -> str:
evalscript_path = fs.path.join(
self.storage.get_folder(self.config.evalscript_folder_key), self.config.evalscript_path
)
with self.storage.filesystem.open(evalscript_path) as evalscript_file:
return evalscript_file.read()


class DownloadTimelessPipeline(BaseDownloadPipeline):
"""Pipeline to download timeless data"""
Expand Down
17 changes: 8 additions & 9 deletions eogrow/pipelines/download_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
SentinelHubRequest,
monitor_batch_analysis,
monitor_batch_job,
read_data,
)

from ..core.area.batch import BatchAreaManager
Expand Down Expand Up @@ -198,15 +197,8 @@ def _create_new_batch_request(self) -> BatchRequest:
if self.config.save_userdata:
responses.append(SentinelHubRequest.output_response("userdata", MimeType.JSON))

evalscript_path = fs.path.join(
self.storage.get_folder(self.config.evalscript_folder_key), self.config.evalscript_path
)
with self.storage.filesystem.open(evalscript_path) as evalscript_file:
evalscript = evalscript_file.read()
evalscript = (read_data(self.config.evalscript_path, data_format=MimeType.TXT),)

sentinelhub_request = SentinelHubRequest(
evalscript=evalscript,
evalscript=self._get_evalscript(),
input_data=[
SentinelHubRequest.input_data(
data_collection=input_config.data_collection,
Expand Down Expand Up @@ -240,6 +232,13 @@ def _create_new_batch_request(self) -> BatchRequest:
description=f"eo-grow - {self.__class__.__name__} pipeline with ID {self.pipeline_id}",
)

def _get_evalscript(self) -> str:
evalscript_path = fs.path.join(
self.storage.get_folder(self.config.evalscript_folder_key), self.config.evalscript_path
)
with self.storage.filesystem.open(evalscript_path) as evalscript_file:
return evalscript_file.read()

def _trigger_user_action(self, batch_request: BatchRequest) -> BatchUserAction:
"""According to status and configuration parameters decide what kind of user action to perform."""
if self.config.analysis_only:
Expand Down
6 changes: 5 additions & 1 deletion eogrow/utils/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ def run_config(
*,
output_folder_key: str | None = None,
reset_output_folder: bool = True,
check_logs: bool = True,
) -> str | None:
"""Runs a pipeline (or multiple) and checks the logs that all the executions were successful. Returns the full path
of the output folder (if there is one) so it can be inspected further. In case of chain configs, the output folder
Expand All @@ -264,6 +265,8 @@ def run_config(
:param config_path: A path to the config file
:param output_folder_key: Type of the folder containing results of the pipeline, inferred from config if None
:param reset_output_folder: Delete the content of the results folder before running the pipeline
:param check_logs: If pipeline logs should be checked after the run completes. If EOWorkflows were used, the
function fails if there were unsuccessful executions.
"""
crude_configs = collect_configs_from_path(config_path)
raw_configs = [interpret_config_from_dict(config) for config in crude_configs]
Expand All @@ -281,7 +284,8 @@ def run_config(

pipeline.run()

check_pipeline_logs(pipeline)
if check_logs:
check_pipeline_logs(pipeline)

return pipeline.storage.get_folder(output_folder_key, full_path=True) if output_folder_key else None

Expand Down

0 comments on commit 30e20de

Please sign in to comment.