Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
#304 checks if download has been cancelled and remove unfinieshed ds
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzysztof (Chris) Bernat committed Sep 26, 2017
1 parent 2612319 commit 5bf0968
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion cate/ds/esa_cci_odp.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
from math import ceil, floor, isnan
from typing import Sequence, Tuple, Optional, Any

from numba.tests.test_utils import C
from shapely.geometry import Polygon
from xarray.backends import NetCDF4DataStore

Expand All @@ -60,7 +61,7 @@
from cate.core.ds import DATA_STORE_REGISTRY, DataStore, DataSource, Schema, open_xarray_dataset
from cate.core.types import PolygonLike, TimeLike, TimeRange, TimeRangeLike, VarNamesLike, VarNames
from cate.ds.local import add_to_data_store_registry, LocalDataSource, LocalDataStore
from cate.util.monitor import Monitor
from cate.util.monitor import Cancellation, Monitor

ESA_CCI_ODP_DATA_STORE_ID = 'esa_cci_odp'

Expand Down Expand Up @@ -1007,6 +1008,9 @@ def make_local(self,
if not local_ds.is_complete:
try:
self._make_local(local_ds, time_range, region, var_names, monitor=monitor)
except Cancellation as c:
local_store.remove_data_source(local_ds)
raise c
except Exception as e:
if local_ds.is_empty:
local_store.remove_data_source(local_ds)
Expand Down
1 change: 0 additions & 1 deletion cate/ds/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import psutil
import shutil
import uuid
import warnings
import xarray as xr
from collections import OrderedDict
from datetime import datetime
Expand Down

0 comments on commit 5bf0968

Please sign in to comment.