From d324b87aa8bba4ecafaa3ea7080a322e6f5b7e7e Mon Sep 17 00:00:00 2001 From: azamifard Date: Wed, 10 Mar 2021 10:22:38 +0100 Subject: [PATCH 1/4] #154 deprecation message --- geospaas/nansat_ingestor/management/commands/ingest.py | 3 +++ geospaas/nansat_ingestor/management/commands/ingest_hyrax.py | 5 +++-- .../management/commands/ingest_thredds_crawl.py | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/geospaas/nansat_ingestor/management/commands/ingest.py b/geospaas/nansat_ingestor/management/commands/ingest.py index b1732881..986ec5c5 100644 --- a/geospaas/nansat_ingestor/management/commands/ingest.py +++ b/geospaas/nansat_ingestor/management/commands/ingest.py @@ -44,6 +44,9 @@ def _get_args(self, *args, **options): def handle(self, *args, **options): """ Ingest one Dataset per file that has not previously been ingested """ + print("WARNING!!! nansat_ingestor app will be deprecated soon and no longer " + "accessible. Please use `LOCALHarvester` of geospaas harvesting package instead.") + input("Press Enter to continue...") non_ingested_uris, n_points, nansat_options = self._get_args(*args, **options) for non_ingested_uri in non_ingested_uris: diff --git a/geospaas/nansat_ingestor/management/commands/ingest_hyrax.py b/geospaas/nansat_ingestor/management/commands/ingest_hyrax.py index 8edb27dc..1d0bfb70 100644 --- a/geospaas/nansat_ingestor/management/commands/ingest_hyrax.py +++ b/geospaas/nansat_ingestor/management/commands/ingest_hyrax.py @@ -13,6 +13,9 @@ class Command(IngestCommand): help = 'Add file to catalog from HYRAX server' def handle(self, *args, **options): + print("WARNING!!! nansat_ingestor app will be deprecated soon and no longer " + "accessible. Please use `LOCALHarvester` of geospaas harvesting package instead.") + input("Press Enter to continue...") print('Searching netcdf files. May take some time...\n\n\n') nc_uris = find_netcdf_uris(args[0]) num_nc_uris = len(nc_uris) @@ -42,5 +45,3 @@ def find_netcdf_uris(uri0, sleep=1.0): print('Server error %s'%e.message) # return all links to netCDF return nc_uris - - diff --git a/geospaas/nansat_ingestor/management/commands/ingest_thredds_crawl.py b/geospaas/nansat_ingestor/management/commands/ingest_thredds_crawl.py index cb7069e5..f96505ab 100644 --- a/geospaas/nansat_ingestor/management/commands/ingest_thredds_crawl.py +++ b/geospaas/nansat_ingestor/management/commands/ingest_thredds_crawl.py @@ -89,6 +89,9 @@ def add_arguments(self, parser): help='''Filename of a specific dataset''') def handle(self, *args, **options): + print("WARNING!!! nansat_ingestor app will be deprecated soon and no longer " + "accessible. Please use `LOCALHarvester` of geospaas harvesting package instead.") + input("Press Enter to continue...") if not len(options['url']) == 1: raise IOError('Please provide a url to the data') url = options.pop('url')[0] From d39a4262607656982afe3d1e8c53f5432542f930 Mon Sep 17 00:00:00 2001 From: azamifard Date: Wed, 10 Mar 2021 11:03:31 +0100 Subject: [PATCH 2/4] #154 remove input line --- geospaas/nansat_ingestor/management/commands/ingest.py | 1 - geospaas/nansat_ingestor/management/commands/ingest_hyrax.py | 1 - .../nansat_ingestor/management/commands/ingest_thredds_crawl.py | 1 - 3 files changed, 3 deletions(-) diff --git a/geospaas/nansat_ingestor/management/commands/ingest.py b/geospaas/nansat_ingestor/management/commands/ingest.py index 986ec5c5..76251c5d 100644 --- a/geospaas/nansat_ingestor/management/commands/ingest.py +++ b/geospaas/nansat_ingestor/management/commands/ingest.py @@ -46,7 +46,6 @@ def handle(self, *args, **options): """ print("WARNING!!! nansat_ingestor app will be deprecated soon and no longer " "accessible. Please use `LOCALHarvester` of geospaas harvesting package instead.") - input("Press Enter to continue...") non_ingested_uris, n_points, nansat_options = self._get_args(*args, **options) for non_ingested_uri in non_ingested_uris: diff --git a/geospaas/nansat_ingestor/management/commands/ingest_hyrax.py b/geospaas/nansat_ingestor/management/commands/ingest_hyrax.py index 1d0bfb70..a418f45a 100644 --- a/geospaas/nansat_ingestor/management/commands/ingest_hyrax.py +++ b/geospaas/nansat_ingestor/management/commands/ingest_hyrax.py @@ -15,7 +15,6 @@ class Command(IngestCommand): def handle(self, *args, **options): print("WARNING!!! nansat_ingestor app will be deprecated soon and no longer " "accessible. Please use `LOCALHarvester` of geospaas harvesting package instead.") - input("Press Enter to continue...") print('Searching netcdf files. May take some time...\n\n\n') nc_uris = find_netcdf_uris(args[0]) num_nc_uris = len(nc_uris) diff --git a/geospaas/nansat_ingestor/management/commands/ingest_thredds_crawl.py b/geospaas/nansat_ingestor/management/commands/ingest_thredds_crawl.py index f96505ab..4e94e2fe 100644 --- a/geospaas/nansat_ingestor/management/commands/ingest_thredds_crawl.py +++ b/geospaas/nansat_ingestor/management/commands/ingest_thredds_crawl.py @@ -91,7 +91,6 @@ def add_arguments(self, parser): def handle(self, *args, **options): print("WARNING!!! nansat_ingestor app will be deprecated soon and no longer " "accessible. Please use `LOCALHarvester` of geospaas harvesting package instead.") - input("Press Enter to continue...") if not len(options['url']) == 1: raise IOError('Please provide a url to the data') url = options.pop('url')[0] From f1c02292ed4071ed5eb4dfd4d35a503425009873 Mon Sep 17 00:00:00 2001 From: azamifard Date: Wed, 10 Mar 2021 11:18:10 +0100 Subject: [PATCH 3/4] rebase #154 remove incorrect test --- geospaas/tests.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/geospaas/tests.py b/geospaas/tests.py index bbbf3274..55a26d8f 100644 --- a/geospaas/tests.py +++ b/geospaas/tests.py @@ -6,13 +6,6 @@ from geospaas.utils import utils class TestUtils(TestCase): - @patch('urllib3.PoolManager') - def test_validate_uri_opendap_does_not_exist(self, mock_PoolManager): - uri = 'http://www.ifremer.fr' - mock_PoolManager.status=1 - with self.assertRaises(OSError) as cm: - utils.validate_uri(uri) - self.assertEqual('NetCDF: file not found', cm.exception.args[1]) @patch('geospaas.utils.utils.os.path.isfile') def test_validate_uri_local(self, mock_isfile): From f95e96bf484327c98b2a0b7fa5842e29d3cce098 Mon Sep 17 00:00:00 2001 From: azamifard Date: Wed, 10 Mar 2021 11:52:55 +0100 Subject: [PATCH 4/4] #154 minors --- geospaas/nansat_ingestor/tests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/geospaas/nansat_ingestor/tests.py b/geospaas/nansat_ingestor/tests.py index 616ad1c2..cfa80ca5 100644 --- a/geospaas/nansat_ingestor/tests.py +++ b/geospaas/nansat_ingestor/tests.py @@ -238,20 +238,20 @@ def test_ingest_no_args(self): with captured_output() as (out, err): call_command('ingest_thredds_crawl', self.uri) output = out.getvalue().strip() - self.assertEqual(output, 'Successfully added metadata of 10 datasets') + self.assertEqual(output, 'WARNING!!! nansat_ingestor app will be deprecated soon and no longer accessible. Please use `LOCALHarvester` of geospaas harvesting package instead.\nSuccessfully added metadata of 10 datasets') def test_ingest_with_year_arg(self): with captured_output() as (out, err): call_command('ingest_thredds_crawl', self.uri, date=['2019/01/24']) output = out.getvalue().strip() - self.assertEqual(output, 'Successfully added metadata of 10 datasets') + self.assertEqual(output, 'WARNING!!! nansat_ingestor app will be deprecated soon and no longer accessible. Please use `LOCALHarvester` of geospaas harvesting package instead.\nSuccessfully added metadata of 10 datasets') def test_ingest_with_filename_arg(self): with captured_output() as (out, err): call_command('ingest_thredds_crawl', self.uri, filename='S2A_MSIL1C_20190124T115401_N0207_R023_T30VWP_20190124T120414.nc') output = out.getvalue().strip() - self.assertEqual(output, 'Successfully added metadata of 10 datasets') + self.assertEqual(output, 'WARNING!!! nansat_ingestor app will be deprecated soon and no longer accessible. Please use `LOCALHarvester` of geospaas harvesting package instead.\nSuccessfully added metadata of 10 datasets') class TestIngestThreddsCrawl__crawl__function(TestCase):