-
Notifications
You must be signed in to change notification settings - Fork 3
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
Specify the task CPU and memory (IT-4056) #83
Open
tschaffter
wants to merge
2
commits into
Sage-Bionetworks-IT:dev
Choose a base branch
from
tschaffter:set-task-memory
base: dev
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.
+121
−21
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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,71 @@ | ||
from enum import Enum | ||
|
||
|
||
class FargateCpuMemory(Enum): | ||
CPU_256_MEM_512 = (256, 512) | ||
CPU_256_MEM_1024 = (256, 1024) | ||
CPU_256_MEM_2048 = (256, 2048) | ||
CPU_512_MEM_1024 = (512, 1024) | ||
CPU_512_MEM_2048 = (512, 2048) | ||
CPU_512_MEM_3072 = (512, 3072) | ||
CPU_512_MEM_4096 = (512, 4096) | ||
CPU_1024_MEM_2048 = (1024, 2048) | ||
CPU_1024_MEM_3072 = (1024, 3072) | ||
CPU_1024_MEM_4096 = (1024, 4096) | ||
CPU_1024_MEM_5120 = (1024, 5120) | ||
CPU_1024_MEM_6144 = (1024, 6144) | ||
CPU_1024_MEM_7168 = (1024, 7168) | ||
CPU_1024_MEM_8192 = (1024, 8192) | ||
CPU_2048_MEM_4096 = (2048, 4096) | ||
CPU_2048_MEM_5120 = (2048, 5120) | ||
CPU_2048_MEM_6144 = (2048, 6144) | ||
CPU_2048_MEM_7168 = (2048, 7168) | ||
CPU_2048_MEM_8192 = (2048, 8192) | ||
CPU_2048_MEM_9216 = (2048, 9216) | ||
CPU_2048_MEM_10240 = (2048, 10240) | ||
CPU_2048_MEM_11264 = (2048, 11264) | ||
CPU_2048_MEM_12288 = (2048, 12288) | ||
CPU_2048_MEM_13312 = (2048, 13312) | ||
CPU_2048_MEM_14336 = (2048, 14336) | ||
CPU_2048_MEM_15360 = (2048, 15360) | ||
CPU_2048_MEM_16384 = (2048, 16384) | ||
CPU_4096_MEM_8192 = (4096, 8192) | ||
CPU_4096_MEM_9216 = (4096, 9216) | ||
CPU_4096_MEM_10240 = (4096, 10240) | ||
CPU_4096_MEM_11264 = (4096, 11264) | ||
CPU_4096_MEM_12288 = (4096, 12288) | ||
CPU_4096_MEM_13312 = (4096, 13312) | ||
CPU_4096_MEM_14336 = (4096, 14336) | ||
CPU_4096_MEM_15360 = (4096, 15360) | ||
CPU_4096_MEM_16384 = (4096, 16384) | ||
CPU_4096_MEM_30720 = (4096, 30720) | ||
CPU_8192_MEM_16384 = (8192, 16384) | ||
CPU_8192_MEM_20480 = (8192, 20480) | ||
CPU_8192_MEM_24576 = (8192, 24576) | ||
CPU_8192_MEM_28672 = (8192, 28672) | ||
CPU_8192_MEM_61440 = (8192, 61440) | ||
CPU_16384_MEM_32768 = (16384, 32768) | ||
CPU_16384_MEM_40960 = (16384, 40960) | ||
CPU_16384_MEM_49152 = (16384, 49152) | ||
CPU_16384_MEM_57344 = (16384, 57344) | ||
CPU_16384_MEM_122880 = (16384, 122880) | ||
|
||
@property | ||
def cpu(self) -> int: | ||
"""Returns the CPU value of the pair.""" | ||
return self.value[0] | ||
|
||
@property | ||
def memory(self) -> int: | ||
"""Returns the memory value of the pair.""" | ||
return self.value[1] | ||
|
||
@staticmethod | ||
def valid_combinations() -> list: | ||
"""Returns all valid CPU and memory combinations.""" | ||
return [(item.cpu, item.memory) for item in FargateCpuMemory] | ||
|
||
@staticmethod | ||
def is_valid(cpu: int, memory: int) -> bool: | ||
"""Checks if a CPU and memory pair is valid.""" | ||
return (cpu, memory) in FargateCpuMemory.valid_combinations() |
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.
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.
i'm not a fan of this because these combinations are already kept in AWS and they could change over time. Keeping a copy here would introduce a maintenance burden of keeping this up to date. Instead how about we just query AWS for the correct combination and if the user doesn't provide the right combination throw an exception and provide a link for the user to lookup valid combos in AWS?