From 5bf096893491b9267a49a359d147cb3a0b6e49cf Mon Sep 17 00:00:00 2001 From: "Krzysztof (Chris) Bernat" Date: Tue, 26 Sep 2017 15:11:15 +0100 Subject: [PATCH] #304 checks if download has been cancelled and remove unfinieshed ds --- cate/ds/esa_cci_odp.py | 6 +++++- cate/ds/local.py | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cate/ds/esa_cci_odp.py b/cate/ds/esa_cci_odp.py index 7305c672f..754141c4a 100644 --- a/cate/ds/esa_cci_odp.py +++ b/cate/ds/esa_cci_odp.py @@ -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 @@ -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' @@ -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) diff --git a/cate/ds/local.py b/cate/ds/local.py index fee31401f..49dc1994e 100644 --- a/cate/ds/local.py +++ b/cate/ds/local.py @@ -42,7 +42,6 @@ import psutil import shutil import uuid -import warnings import xarray as xr from collections import OrderedDict from datetime import datetime