From 4f6a0126bf7ba6a61b6789be7479ecc2d59d52fe Mon Sep 17 00:00:00 2001 From: Matt Daily Date: Mon, 20 May 2024 16:05:06 -0700 Subject: [PATCH] Revert rename of ingest_archive_record. --- docs/documentation.rst | 2 +- ocs_ingester/ingester.py | 7 +++---- setup.py | 4 +++- tests/test_ingester.py | 6 +++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/docs/documentation.rst b/docs/documentation.rst index a8d79e9..4f2dd25 100644 --- a/docs/documentation.rst +++ b/docs/documentation.rst @@ -6,7 +6,7 @@ Documentation Ingester API and Example Usage ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. automodule:: ingester - :members: frame_exists, validate_fits_and_create_archive_record, upload_file_to_s3, ingest_archive_frame_record + :members: frame_exists, validate_fits_and_create_archive_record, upload_file_to_s3, ingest_archive_record Exceptions ^^^^^^^^^^ diff --git a/ocs_ingester/ingester.py b/ocs_ingester/ingester.py index 96dfbd8..ef75421 100644 --- a/ocs_ingester/ingester.py +++ b/ocs_ingester/ingester.py @@ -17,7 +17,7 @@ >>> if not ingester.frame_exists(fileobj): >>> record = ingester.validate_fits_and_create_archive_record(fileobj) >>> s3_version = ingester.upload_file_to_s3(fileobj) - >>> ingested_record = ingester.ingest_archive_frame_record(s3_version, record) + >>> ingested_record = ingester.ingest_archive_record(s3_version, record) Ingest a file in one step: @@ -159,9 +159,9 @@ def upload_file_to_file_store(fileobj, path=None, file_metadata=None): raise BackoffRetryError(str(fce)) -def ingest_archive_frame_record(version, record, api_root=ingester_settings.API_ROOT, +def ingest_archive_record(version, record, api_root=ingester_settings.API_ROOT, auth_token=ingester_settings.AUTH_TOKEN): - """Adds a record to the science archive database. + """Adds a frame record to the science archive database. Args: version (dict): Version information returned from the upload to S3 @@ -290,7 +290,6 @@ def ingest(self): raise NonFatalDoNotRetryError('Version with this md5 already exists') # Upload the file to s3 and get version information back - # we need to make sure that version = upload_and_collect_metrics(self.filestore, self.datafile) # Make sure our md5 matches amazons diff --git a/setup.py b/setup.py index 017ed6f..9cc92b6 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,9 @@ 'astropy', 'requests', 'boto3', - 'ocs_archive==0.3.0', + # 'ocs_archive==0.3.0', + # install ocs_archive from the local directory + # 'ocs_archive @ file://localhost/Users/mdaily/Documents/ocs_archive', 'python-dateutil', 'lcogt-logging', 'opentsdb-python-metrics>=0.2.0' diff --git a/tests/test_ingester.py b/tests/test_ingester.py index e9fc3c0..cec8bb1 100644 --- a/tests/test_ingester.py +++ b/tests/test_ingester.py @@ -12,7 +12,7 @@ from ocs_archive.input.file import File from ocs_archive.input.filefactory import FileFactory -from ocs_ingester.ingester import (Ingester, upload_file_and_ingest_to_archive, ingest_archive_frame_record, +from ocs_ingester.ingester import (Ingester, upload_file_and_ingest_to_archive, ingest_archive_record, upload_file_to_file_store, validate_fits_and_create_archive_record) from ocs_ingester.exceptions import DoNotRetryError, NonFatalDoNotRetryError @@ -95,11 +95,11 @@ def test_upload_file_to_file_store(self): self.assertIn('md5', version) @patch('requests.post') - def test_ingest_archive_frame_record(self, post_mock): + def test_ingest_archive_record(self, post_mock): with open(FITS_FILE, 'rb') as fileobj: archive_record = validate_fits_and_create_archive_record(fileobj) version = upload_file_to_file_store(fileobj) - ingest_archive_frame_record(version, archive_record, api_root='http://fake') + ingest_archive_record(version, archive_record, api_root='http://fake') self.assertTrue(post_mock.called)