|
10 | 10 | # This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
|
11 | 11 | # See the License for the specific language governing permissions and limitations under the License.
|
12 | 12 | import logging
|
| 13 | +import re |
13 | 14 | from datetime import datetime
|
14 | 15 | from os import environ
|
15 | 16 |
|
|
21 | 22 | from cfn_stacks_factory import CfnVpcStack
|
22 | 23 | from conftest import inject_additional_config_settings
|
23 | 24 | from conftest_networking import CIDR_FOR_CUSTOM_SUBNETS
|
24 |
| -from utils import get_instance_info |
| 25 | +from utils import get_instance_info, get_free_tier_instance_types |
| 26 | + |
| 27 | +# REGEX_FREE_TIER_INSTANCE_TYPES = '|'.join(map(re.escape, get_free_tier_instance_types())) |
| 28 | +REGEX_FREE_TIER_INSTANCE_TYPES = '|'.join(map(re.escape, [ |
| 29 | + "c7i-flex.large", |
| 30 | + "t4g.small", |
| 31 | + "t4g.micro", |
| 32 | + "t3.micro", |
| 33 | + "t3.small", |
| 34 | + "m7i-flex.large" |
| 35 | +])) |
25 | 36 |
|
26 | 37 | PROMPTS = {
|
27 | 38 | "region": lambda region: {"prompt": r"AWS Region ID \[.*\]: ", "response": region},
|
28 | 39 | "key_pair": lambda key_name: {"prompt": r"EC2 Key Pair Name \[.*\]: ", "response": key_name},
|
29 | 40 | "scheduler": lambda scheduler: {"prompt": r"Scheduler \[slurm\]: ", "response": scheduler},
|
30 | 41 | "os": lambda os: {"prompt": r"Operating System \[alinux2\]: ", "response": os, "skip_for_batch": True},
|
31 |
| - "head_instance_type": lambda instance: {"prompt": r"Head node instance type \[t.\.micro\]: ", "response": instance}, |
| 42 | + "head_instance_type": lambda instance: {"prompt": rf"Head node instance type \[({REGEX_FREE_TIER_INSTANCE_TYPES})\]: ", "response": instance}, |
32 | 43 | "no_of_queues": lambda n: {"prompt": rf"Number of queues \[{n}\]: ", "response": f"{n}", "skip_for_batch": True},
|
33 | 44 | "queue_name": lambda queue, name: {"prompt": rf"Name of queue {queue} \[queue{queue}\]: ", "response": name},
|
34 | 45 | "no_of_compute_resources": lambda queue_name, queue, n: {
|
|
37 | 48 | "skip_for_batch": True,
|
38 | 49 | },
|
39 | 50 | "compute_instance_type": lambda resource, queue_name, instance: {
|
40 |
| - "prompt": rf"Compute instance type for compute resource {resource} in {queue_name} \[t.\.micro\]: ", |
| 51 | + "prompt": rf"Compute instance type for compute resource {resource} in {queue_name} \[({REGEX_FREE_TIER_INSTANCE_TYPES})\]: ", |
41 | 52 | "response": instance,
|
42 | 53 | "skip_for_batch": True,
|
43 | 54 | },
|
|
0 commit comments