-
Notifications
You must be signed in to change notification settings - Fork 1k
[Resources] Add cpus in resource specification
#1622
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
Changes from 11 commits
d5b5511
3e0fa4a
22fe74b
386b1dc
23a0ea5
28b0c5a
0d8cf90
a825cf7
d65634c
4959f8f
5d57fd5
9067308
797a632
b4e0b00
b95c56b
9324e52
12f4bbe
09ad032
83a7a9d
c400dea
75cf94a
afd80fe
89ba768
e4ae323
6103c2e
1961191
f856b66
40ac63b
2ac7471
62f78a2
b141f75
bc7cd0a
a6f4355
8033bbf
add2811
aa926af
0368415
54faa77
8f9dabc
97dc60e
4599f36
01021c9
4949000
fec1b7a
13607fd
2059309
6a2b554
99a66e7
ad4827b
2c08184
014f63c
1f8a031
62aa150
4ea39d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -274,10 +274,9 @@ def is_same_cloud(self, other: clouds.Cloud): | |
| return isinstance(other, AWS) | ||
|
|
||
| @classmethod | ||
| def get_default_instance_type(cls) -> str: | ||
| # General-purpose instance with 8 vCPUs and 32 GB RAM. | ||
| # Intel Ice Lake 8375C | ||
| return 'm6i.2xlarge' | ||
| def get_default_instance_type(cls, | ||
| cpu: Optional[str] = None) -> Optional[str]: | ||
| return service_catalog.get_default_instance_type(cpu=cpu, clouds='aws') | ||
|
|
||
| # TODO: factor the following three methods, as they are the same logic | ||
| # between Azure and AWS. | ||
|
|
@@ -350,16 +349,21 @@ def _make(instance_list): | |
| # Setting this to None as AWS doesn't separately bill / | ||
| # attach the accelerators. Billed as part of the VM type. | ||
| accelerators=None, | ||
| cpu=None, | ||
| ) | ||
| resource_list.append(r) | ||
| return resource_list | ||
|
|
||
| # Currently, handle a filter on accelerators only. | ||
| accelerators = resources.accelerators | ||
| if accelerators is None: | ||
| # No requirements to filter, so just return a default VM type. | ||
| return (_make([AWS.get_default_instance_type()]), | ||
| fuzzy_candidate_list) | ||
| # Return a default instance type with the given number of vCPUs. | ||
| default_instance_type = AWS.get_default_instance_type( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For discussion/a thought: This is now dynamically picking a VM type based on Should we remove this interface (Cloud.get_default_instance_type()) then? Wdyt? (I can see arguments for both choices.)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it cannot be
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The naming part sounds good. Sorry, I did not spell out in my comment but was thinking removing one interface from Cloud will make it easier to add new clouds. Also, it's a shallow method (1-line dispatch). How about removing it and just calling
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't it be still useful to explicitly show what the default type is?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mind clarifying what you meant? Currently, the Cloud interface includes a shallow method, which does not show the default type: @classmethod
def get_default_instance_type(cls,
cpu: Optional[str] = None) -> Optional[str]:
return service_catalog.get_default_instance_type(cpu=cpu, clouds='aws')
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean one can easily find which instance type is default for AWS by calling
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense. |
||
| cpu=resources.cpu) | ||
| if default_instance_type is None: | ||
| return ([], fuzzy_candidate_list) | ||
| else: | ||
| return (_make([default_instance_type]), fuzzy_candidate_list) | ||
concretevitamin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| assert len(accelerators) == 1, resources | ||
| acc, acc_count = list(accelerators.items())[0] | ||
|
|
@@ -368,6 +372,7 @@ def _make(instance_list): | |
| acc, | ||
| acc_count, | ||
| use_spot=resources.use_spot, | ||
| cpu=resources.cpu, | ||
| region=resources.region, | ||
| zone=resources.zone, | ||
| clouds='aws') | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.