Skip to content

Commit 1f8cf68

Browse files
author
Phil Varner
authored
guard cleanup of workdir (#86)
* guard cleanup of workdir
1 parent 3d2f989 commit 1f8cf68

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGELOG.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8-
## [Unreleased]
8+
## [v0.4.0] - 2024-02-14
9+
10+
### Fixed
11+
12+
- ([#86](https://github.com/stac-utils/stac-task/pull/86)) Guard cleanup of workdir to ensure task was actually created.
913

1014
### Added
1115

12-
- ([#72]) Given that `_get_file` is part of the `AsyncFileSystem` spec, this
16+
- ([#72](https://github.com/stac-utils/stac-task/pull/72)) Given that `_get_file` is part of the `AsyncFileSystem` spec, this
1317
adds the synchronous `get_file` as a way to retrieve files if `_get_file` is
1418
not found.
1519
- ([#77](https://github.com/stac-utils/stac-task/pull/77)) Added option `keep_original_filenames` to download routines to
@@ -54,6 +58,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
5458
Initial release.
5559

5660
<!-- [Unreleased]: <https://github.com/stac-utils/stac-task/compare/v0.1.1...main> -->
61+
[v0.4.0]: <https://github.com/stac-utils/stac-task/compare/v0.3.0...v0.4.0>
5762
[v0.3.0]: <https://github.com/stac-utils/stac-task/compare/v0.2.0...v0.3.0>
5863
[v0.2.0]: <https://github.com/stac-utils/stac-task/compare/v0.1.1...v0.2.0>
5964
[v0.1.1]: <https://github.com/stac-utils/stac-task/compare/v0.1.0...v0.1.1>

stactask/task.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ def post_process_item(self, item: Dict[str, Any]) -> Dict[str, Any]:
342342

343343
@classmethod
344344
def handler(cls, payload: Dict[str, Any], **kwargs: Any) -> Dict[str, Any]:
345+
task = None
345346
try:
346347
if "href" in payload or "url" in payload:
347348
# read input
@@ -362,7 +363,8 @@ def handler(cls, payload: Dict[str, Any], **kwargs: Any) -> Dict[str, Any]:
362363
task.logger.error(err, exc_info=True)
363364
raise err
364365
finally:
365-
task.cleanup_workdir()
366+
if task:
367+
task.cleanup_workdir()
366368

367369
@classmethod
368370
def parse_args(cls, args: List[str]) -> Dict[str, Any]:

0 commit comments

Comments
 (0)