-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: add TES models with unit tests #32
base: main
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThis pull request introduces Pydantic models for Task Execution Services (TES) along with comprehensive unit tests. The changes focus on enhancing type safety and data validation, conforming to the GA4GH schemas. The implementation includes new models, unit tests, and updates to the package initialization. Class diagram for TES modelsclassDiagram
class TESFileType {
<<enumeration>>
FILE
DIRECTORY
}
class TESState {
<<enumeration>>
UNKNOWN
QUEUED
INITIALIZING
RUNNING
PAUSED
COMPLETE
EXECUTOR_ERROR
SYSTEM_ERROR
CANCELLED
}
class TESOutputFileLog {
+str url
+str path
+str size_bytes
}
class TESExecutorLog {
+Optional~datetime~ start_time
+Optional~datetime~ end_time
+Optional~str~ stdout
+Optional~str~ stderr
+int exit_code
}
class TESExecutor {
+str image
+list~str~ command
+Optional~str~ workdir
+Optional~str~ stdout
+Optional~str~ stderr
+Optional~str~ stdin
+Optional~dict~str, str~~ env
}
class TESResources {
+Optional~int~ cpu_cores
+Optional~bool~ preemptible
+Optional~float~ ram_gb
+Optional~float~ disk_gb
+Optional~list~str~~ zones
}
class TESInput {
+Optional~str~ name
+Optional~str~ description
+Optional~AnyUrl~ url
+str path
+TESFileType type
+Optional~str~ content
}
class TESOutput {
+Optional~str~ name
+Optional~str~ description
+AnyUrl url
+str path
+TESFileType type
}
class TESTaskLog {
+list~TESExecutorLog~ logs
+Optional~dict~str, str~~ metadata
+Optional~datetime~ start_time
+Optional~datetime~ end_time
+list~TESOutputFileLog~ outputs
+Optional~list~str~~ system_logs
}
class TESData {
+str id
+Optional~str~ name
+Optional~str~ description
+Optional~datetime~ creation_time
+Optional~TESState~ state
+list~TESInput~ inputs
+list~TESOutput~ outputs
+list~TESExecutor~ executors
+Optional~TESResources~ resources
+Optional~list~str~~ volumes
+Optional~list~TESTaskLog~ logs
+Optional~dict~str, str~~ tags
}
TESData --> TESInput
TESData --> TESOutput
TESData --> TESExecutor
TESData --> TESResources
TESData --> TESTaskLog
TESInput --> TESFileType
TESOutput --> TESFileType
TESTaskLog --> TESExecutorLog
TESTaskLog --> TESOutputFileLog
TESExecutorLog --> TESState
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Karanjot786 - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟡 Testing: 3 issues found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@Karanjot786, the generally accepted practice to split PRs like this is to cherry pick the commits and then make adjustments. Copying and pasting someones else's code (mine in this case) with no attribution is not very professional. Of course I don't mind all that much, just for future reference : ) |
Hi @SalihuDickson, Thank you for bringing this to my attention and for your understanding. I acknowledge that I copied your code without proper attribution in the recent PR. My intention was solely to replicate the models accurately since we are working on the same project and ensuring consistency is crucial. I wanted to avoid potential discrepancies that might arise from rewriting the models from scratch. I understand that copying code without attribution is not professional, regardless of the circumstances. In the future, I will adhere to best practices by cherry-picking commits and making the necessary adjustments to maintain both integrity and clarity in our work. I appreciate your guidance on this matter and will ensure that all contributions are properly attributed moving forward. Once again, I apologize for any inconvenience this may have caused and thank you for your patience and support. |
Note that since we squash and merge commits in a PR anyways, you can just attribute co-authorship of a commit with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good! :)
However, one major thing from looking at the nice summary that Sourcery provided: Are you sure you created the models for TES v1.1 as previously discussed? There are a few minor inconsistencies with the models, but maybe it's because you have used an older version?
Here's a list of the issues I found:
TESState
(fromtesState
):CANCELING
is missing (added in v1.1)PREEMPTED
is missing (added in v1.1)
TESInput
(fromtesInput
):type
is optional for creating tasks (requirement dropped in v1.1, I believe), but should be filled in once that information becomes available; probably not enforcable on the validation side
TESOutput
(fromtesOutput
):path_prefix
is missing (added in v1.1); note that it is required ifTESOutput.path
contains wildcards; requires custom Pydantic validatortype
as above
TESExecutor
(fromtesExecutor
):ignore_error
is missing (added in v1.1)
TESData
(fromtesTask
):- Only
executors
is required,inputs
andoutputs
are not
- Only
Apart from that, a few minor comments:
- Check the docstrings and make sure they are consistent with Google's docstring style and your other docstrings in the codebase (see individual comment for more info)
- Address the open Sourcery comments
Thank you for your positive feedback and for taking the time to review my PR. I appreciate your thorough and detailed comments. TES Version Alignment You are correct; I inadvertently based the models on an older version of the TES schema. I apologize for this oversight. I will update the models to align with TES v1.1 as we talked about before. Specifically, I will address the following:
|
Objective
ChangesUpdated Models:
Updated Unit Tests:
Documentation:
Linting and Testing:
|
Co-authored-by: salihuDickson <[email protected]>
@uniqueg, I think this is just about ready to merge, maybe you want to do a quick read through of the recent changes. |
hi @uniqueg, just a quick reminder, please take a look at this whenever you have the time. |
Hi @SalihuDickson, I've taken a look at the updates you've made, and they look great. I appreciate the example you've provided, and I will implement the same method in the WES models as well. |
the stated issues have been addressed
hey @uniqueg, just a gentle follow up on my earlier reminder. Need your approval to merge :) |
Introduce Pydantic models for Task Execution Services (TES) to enhance type safety and data validation, conforming to the GA4GH schemas. Additionally, provide comprehensive unit tests to ensure model integrity and functionality.
Changes:
Added Models:
crategen/models/tes_models.py
: Contains all TES-related Pydantic models, includingTESData
,TESInput
,TESOutput
,TESExecutor
,TESTaskLog
,TESResources
,TESExecutorLog
,TESOutputFileLog
,TESFileType
, andTESState
.Added Unit Tests:
tests/unit/test_tes_models.py
: Includes unit tests for all TES models, covering valid instances, validation errors, and edge cases.Updated Package Initialization:
crategen/models/__init__.py
: Added imports for TES models and defined__all__
to specify the public API of themodels
package.Attribution:
Documentation:
tes_models.py
to improve code readability and maintainability.Linting and Testing:
Notes:
tes_converter.py
andwes_converter.py
) and addition of related tests will be handled in subsequent PRs to maintain manageable and focused code reviews.Summary by Sourcery
Add Pydantic models for Task Execution Services (TES) to enhance type safety and data validation, along with comprehensive unit tests to ensure model integrity and functionality. Update package initialization and resolve linting issues.
New Features:
Enhancements:
__all__
to specify the public API of themodels
package.Documentation:
tes_models.py
to improve code readability and maintainability.Tests:
Chores: