Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#154 deprecation message #157

Open
wants to merge 4 commits into
base: issue126_remove_geospaas_urls
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions geospaas/nansat_ingestor/management/commands/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ 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.")
non_ingested_uris, n_points, nansat_options = self._get_args(*args, **options)

for non_ingested_uri in non_ingested_uris:
Expand Down
4 changes: 2 additions & 2 deletions geospaas/nansat_ingestor/management/commands/ingest_hyrax.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ 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.")
print('Searching netcdf files. May take some time...\n\n\n')
nc_uris = find_netcdf_uris(args[0])
num_nc_uris = len(nc_uris)
Expand Down Expand Up @@ -42,5 +44,3 @@ def find_netcdf_uris(uri0, sleep=1.0):
print('Server error %s'%e.message)
# return all links to netCDF
return nc_uris


Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ 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.")
if not len(options['url']) == 1:
raise IOError('Please provide a url to the data')
url = options.pop('url')[0]
Expand Down
6 changes: 3 additions & 3 deletions geospaas/nansat_ingestor/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
7 changes: 0 additions & 7 deletions geospaas/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down