Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

Adjust year ranges for Science Museum #946

Merged
merged 2 commits into from
Jan 5, 2023

Conversation

stacimc
Copy link
Contributor

@stacimc stacimc commented Jan 4, 2023

Fixes

We received an error during a recent run of the Science Museum DAG:

Request https://collection.sciencemuseumgroup.org.uk/search/date[from]/1935/date[to]/1945/images/image_license?page[size]=100&page[number]=50 contains more than 50 pages of data and cannot be fully ingested. Reduce the size of the year range in order to complete ingestion.

Description

We're currently needing to split Science Museum ingestion up into small sections by date ranges, to circumvent an issue where we receive unexpected results when querying a dataset larger than 50 pages. The above error message was added to warn us when one of our year ranges exceeds 50 pages, so that we can decrease the range.

For this PR, I did a quick audit of the page count for each of our existing year ranges and adjusted all of them to ensure that they all have less than 40 pages of results. This should hopefully prevent us from needing to tweak this again.

Testing Instructions

just test should be sufficient.

If you want to repeat my test for making sure each range has less than 40 pages, you can locally update get_batch_data:

def get_batch_data(self, response_json):
        if response_json:
            # Log the URL for the last page
            logger.info(response_json.get("links", {}).get("last"))
        
        # Return None early so it goes fast for testing purposes
        return None

Checklist

  • My pull request has a descriptive title (not a vague title like
    Update index.md).
  • My pull request targets the default branch of the repository (main) or
    a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible
    errors.
  • I ran the DAG documentation generator (if applicable).

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@stacimc stacimc added 🟧 priority: high Stalls work on the project or its dependents 🛠 goal: fix Bug fix 💻 aspect: code Concerns the software code in the repository labels Jan 4, 2023
@stacimc stacimc self-assigned this Jan 4, 2023
@stacimc stacimc marked this pull request as ready for review January 4, 2023 00:53
@stacimc stacimc requested a review from a team as a code owner January 4, 2023 00:53
@AetherUnbound AetherUnbound changed the title Adjust year ranges Adjust year ranges for Science Museum Jan 4, 2023
Copy link
Contributor

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you for the quick fix!

Copy link
Member

@krysal krysal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stacimc stacimc merged commit 11b0b3b into main Jan 5, 2023
@stacimc stacimc deleted the fix/adjust-science-museum-year-ranges branch January 5, 2023 17:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟧 priority: high Stalls work on the project or its dependents
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants