Skip to content

Commit

Permalink
Revert rename of ingest_archive_record.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgdaily committed May 20, 2024
1 parent fa15fa4 commit 4f6a012
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
^^^^^^^^^^
Expand Down
7 changes: 3 additions & 4 deletions ocs_ingester/ingester.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
6 changes: 3 additions & 3 deletions tests/test_ingester.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)


Expand Down

0 comments on commit 4f6a012

Please sign in to comment.