-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add pydantic support #136
Open
nuwang
wants to merge
28
commits into
main
Choose a base branch
from
add_pydantic_support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add pydantic support #136
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
bb60acb
Refactor linter
nuwang 082b76d
Initial use of pydantic for entity validation
nuwang 14ace41
Add black configuration
nuwang 4e3410a
Fix invalid tag tests
nuwang c8bb8f9
Fix loader propagation and other minor fixes
nuwang 105c57b
Gpus can only be whole numbers
nuwang 135e4df
Process inheritance of loaded entities
nuwang 9f5ebd9
Only apply Rule properties if instance of Rule
nuwang e5935e6
Change factory for GlobalConfig
nuwang f7ce2e4
Allow cores and mem to be int as well
nuwang 3a058f9
Fix bug in setting tags
nuwang b83abc2
Fix incorrect variable reference
nuwang 288f402
Change field ordering
nuwang 00239ea
Fix pattern for tag filtering
nuwang 535b3ad
Add error message when failing to load a file
nuwang 40bb79f
Allow any datatype for params and convert env to str
nuwang 973a52c
Fix tag_values_match function in helpers
nuwang 8981c91
Add back entity.filter() and fix score function
nuwang e3a567b
Make sure min_cores/mem etc. types match specified
nuwang d52c44a
Restore original tag_values_match helper function
nuwang f2a2ef2
Allow bool or str for if conditions
nuwang edaa37e
Fix score function
nuwang 9b1b32f
Fix tests for invalidly tagged users
nuwang 4766f0e
Switch tests to python 3.11
nuwang 0076bc3
Refactor code evaluation interface
nuwang e337fe3
Reactivate lru cache for inherit_matching_entities
nuwang 1412029
Drop commented code and restore tests
nuwang 52f274f
Bump major version
nuwang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,10 @@ match=^[Tt]est | |
|
||
[bdist_wheel] | ||
universal = 1 | ||
|
||
[black] | ||
line-length = 88 | ||
|
||
[isort] | ||
line_length = 88 | ||
profile = black |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
global: | ||
default_inherits: default | ||
|
||
tools: | ||
default: | ||
abstract: true | ||
cores: 2 | ||
mem: 8 | ||
env: {} | ||
scheduling: | ||
require: [] | ||
prefer: | ||
- general | ||
accept: | ||
reject: | ||
- pulsar | ||
rules: [] | ||
invalidly_tagged_tool: | ||
scheduling: | ||
require: | ||
- general | ||
reject: | ||
- general | ||
|
||
destinations: | ||
local: | ||
runner: local | ||
max_accepted_cores: 4 | ||
max_accepted_mem: 16 | ||
scheduling: | ||
prefer: | ||
- general | ||
k8s_environment: | ||
runner: k8s | ||
max_accepted_cores: 16 | ||
max_accepted_mem: 64 | ||
max_accepted_gpus: 2 | ||
scheduling: | ||
prefer: | ||
- pulsar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,12 +46,6 @@ users: | |
scheduling: | ||
require: | ||
- earth | ||
[email protected]: | ||
scheduling: | ||
require: | ||
- pulsar | ||
reject: | ||
- pulsar | ||
.*@vortex.org: | ||
scheduling: | ||
require: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,12 +68,6 @@ users: | |
scheduling: | ||
require: | ||
- earth | ||
[email protected]: | ||
scheduling: | ||
require: | ||
- pulsar | ||
reject: | ||
- pulsar | ||
.*@vortex.org: | ||
scheduling: | ||
require: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,12 +52,6 @@ users: | |
max_mem: cores * 6 | ||
- if: input_size >= 5 | ||
fail: Just because | ||
[email protected]: | ||
scheduling: | ||
require: | ||
- pulsar | ||
reject: | ||
- pulsar | ||
.*@vortex.org: | ||
scheduling: | ||
require: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,12 +60,6 @@ users: | |
max_mem: cores * 6 | ||
- if: input_size >= 5 | ||
fail: Just because | ||
[email protected]: | ||
scheduling: | ||
require: | ||
- pulsar | ||
reject: | ||
- pulsar | ||
.*@vortex.org: | ||
scheduling: | ||
require: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,12 +42,6 @@ users: | |
scheduling: | ||
require: | ||
- earth | ||
[email protected]: | ||
scheduling: | ||
require: | ||
- pulsar | ||
reject: | ||
- pulsar | ||
.*@vortex.org: | ||
scheduling: | ||
require: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
global: | ||
default_inherits: default | ||
|
||
tools: | ||
default: | ||
cores: 2 | ||
mem: 8 | ||
gpus: 1 | ||
env: {} | ||
scheduling: | ||
require: [] | ||
prefer: | ||
- general | ||
accept: | ||
reject: | ||
- pulsar | ||
params: | ||
native_spec: "--mem {mem} --cores {cores}" | ||
rules: [] | ||
|
||
users: | ||
default: | ||
max_cores: 3 | ||
max_mem: 4 | ||
env: {} | ||
scheduling: | ||
require: [] | ||
prefer: | ||
- general | ||
accept: | ||
reject: | ||
- pulsar | ||
rules: [] | ||
[email protected]: | ||
scheduling: | ||
require: | ||
- pulsar | ||
reject: | ||
- pulsar | ||
|
||
destinations: | ||
local: | ||
runner: local | ||
max_accepted_cores: 4 | ||
max_accepted_mem: 16 | ||
scheduling: | ||
prefer: | ||
- general | ||
accept: | ||
- pulsar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,12 +60,6 @@ users: | |
- earth | ||
reject: | ||
- pulsar | ||
[email protected]: | ||
scheduling: | ||
require: | ||
- pulsar | ||
reject: | ||
- pulsar | ||
[email protected]: | ||
max_cores: 4 | ||
max_mem: 32 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,10 @@ | |
class TestMapperUser(unittest.TestCase): | ||
|
||
@staticmethod | ||
def _map_to_destination(tool, user): | ||
def _map_to_destination(tool, user, tpv_config_path=None): | ||
galaxy_app = mock_galaxy.App(job_conf=os.path.join(os.path.dirname(__file__), 'fixtures/job_conf.yml')) | ||
job = mock_galaxy.Job() | ||
tpv_config = os.path.join(os.path.dirname(__file__), 'fixtures/mapping-user.yml') | ||
tpv_config = tpv_config_path or os.path.join(os.path.dirname(__file__), 'fixtures/mapping-user.yml') | ||
gateway.ACTIVE_DESTINATION_MAPPER = None | ||
return gateway.map_tool_to_destination(galaxy_app, job, tool, user, tpv_config_files=[tpv_config]) | ||
|
||
|
@@ -40,8 +40,9 @@ def test_map_invalidly_tagged_user(self): | |
tool = mock_galaxy.Tool('bwa') | ||
user = mock_galaxy.User('infinitely', '[email protected]') | ||
|
||
with self.assertRaises(IncompatibleTagsException): | ||
self._map_to_destination(tool, user) | ||
config = os.path.join(os.path.dirname(__file__), 'fixtures/mapping-user-invalid-tags.yml') | ||
with self.assertRaisesRegex(Exception, r"Duplicate tags found: 'pulsar' in \['require', 'reject'\]"): | ||
self._map_to_destination(tool, user, tpv_config_path=config) | ||
|
||
def test_map_user_by_regex(self): | ||
tool = mock_galaxy.Tool('bwa') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Just flagging these for release notes. This is a simplification we can use over the existing code, but the existing filter method will also still work.