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

[ORCA-306] Get and update Challenge submissions #37

Merged
merged 36 commits into from
Mar 1, 2024

Conversation

jaymedina
Copy link
Contributor

@jaymedina jaymedina commented Feb 27, 2024

problem

Helper methods needed to be added for basic operations with Synapse, such as retrieving the submissions with a certain submission status and updating submission statuses. This is for the new Sage Bionetworks Challenges backend workflow for handling submissions, which includes running an automated Airflow process that retrieves submissions and updates their status before piping them over to the Nextflow workflow.

solution

  • Add a method to get submissions of a desired submission status (default is RECEIVED)
  • Add a method to update submission statuses of input submission(s)
  • Add tests
  • Add challengeutils as a dependency
  • Add documentation where appropriate
  • Fix failing CI jobs

testing & preview

Unit tests were added to test_ops.py to cover basic functionality and error-handling.

Further, here are some screenshots from actual communications with the API:

image image image image

@jaymedina jaymedina added the enhancement New feature or request label Feb 27, 2024
@jaymedina jaymedina self-assigned this Feb 27, 2024
Copy link

swarmia bot commented Feb 27, 2024

@jaymedina jaymedina force-pushed the ORCA-306-challenge-submissions branch from 7ad8b61 to ecd5b77 Compare February 27, 2024 14:42
Copy link
Collaborator

@thomasyu888 thomasyu888 left a comment

Choose a reason for hiding this comment

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

Awesome - I know you're still actively working on it, so just some preliminary comments.

src/orca/services/synapse/ops.py Outdated Show resolved Hide resolved

from challengeutils import utils
Copy link
Collaborator

@thomasyu888 thomasyu888 Feb 27, 2024

Choose a reason for hiding this comment

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

This package is going to be deprecated in favor of cnb-tools eventually. For now it's ok, but the package isn't being regularly maintained.

Probably need to add this to the pipfile.

Maybe some of the challenge module should be added to the python client.

@jaymedina
Copy link
Contributor Author

jaymedina commented Feb 27, 2024

Hi @thomasyu888 thanks for the comments. Since this PR is a blocker for ORCA-302, I'd like to give a status update:

I see no way of mocking the get_submissions test since it requires retrieving submissions from an actual submissions view, so I'm constructing a set of integration tests where I build up and tear down a Project with an Evaluation queue for testing. This is what I'm working on right now and will aim to wrap up before the end of the day. @BWMac

@thomasyu888
Copy link
Collaborator

Hi @thomasyu888 thanks for the comments. Since this PR is a blocker for ORCA-302, I'd like to give a status update:

I see no way of mocking the get_submissions test since it requires retrieving submissions from an actual submissions view, so I'm constructing a set of integration tests where I build up and tear down a Project with an Evaluation queue for testing. This is what I'm working on right now and will aim to wrap up before the end of the day. @BWMac

See something like this: https://github.com/Sage-Bionetworks/Genie/blob/429dafbaed3bc78bbf71ff6bfffb7d88a6f49d4d/tests/test_clinical.py#L15-L46. There is a way to create unit tests by mocking the behavior of tableQuery which may be lower lift than an integration test. That said, those tests I wrote are a bit dated. There are most likely other ways to achieve the mocking of a table query.

Copy link

codecov bot commented Feb 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (d15c5b7) to head (e0c160c).

❗ Current head e0c160c differs from pull request most recent head 0b8c6d2. Consider uploading reports for the commit 0b8c6d2 to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #37   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           28        28           
  Lines          920       932   +12     
  Branches       140       141    +1     
=========================================
+ Hits           920       932   +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

.pre-commit-config.yaml Outdated Show resolved Hide resolved
src/orca/services/synapse/ops.py Outdated Show resolved Hide resolved
src/orca/services/synapse/ops.py Outdated Show resolved Hide resolved
src/orca/services/synapse/ops.py Outdated Show resolved Hide resolved
src/orca/services/synapse/ops.py Outdated Show resolved Hide resolved
.pre-commit-config.yaml Outdated Show resolved Hide resolved
@BWMac BWMac self-requested a review February 28, 2024 18:20
Copy link
Contributor

@BWMac BWMac left a comment

Choose a reason for hiding this comment

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

My summary review comment got lost somehow, but I think your tests need some work. See my comments about mocking. I like to use the patch method from unittest.mock. agora-data-tools has some examples that you can reference.

@BWMac BWMac self-requested a review March 1, 2024 16:55
setup.cfg Show resolved Hide resolved
src/orca/services/synapse/ops.py Outdated Show resolved Hide resolved
setup.cfg Show resolved Hide resolved
@BWMac BWMac self-requested a review March 1, 2024 20:24
Copy link
Contributor

@BWMac BWMac left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks! Let me know when the new version has been released.

src/orca/services/synapse/ops.py Outdated Show resolved Hide resolved
Copy link

sonarqubecloud bot commented Mar 1, 2024

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@jaymedina jaymedina merged commit a2d7eb0 into main Mar 1, 2024
2 checks passed
@jaymedina jaymedina deleted the ORCA-306-challenge-submissions branch March 5, 2024 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants