Skip to content
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 error reporting for RAM/CPU misconfigurations #48

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Fixed
- **Create** - Fix GPU AMI not being selected.
- **Parser** - Fix GPU flag not being passed properly to the config dict.

- **Create** - Better error reporting regarding RAM and CPU misconfigurations.

## [1.1.0] - 2024-02-26

Expand Down
14 changes: 14 additions & 0 deletions src/forge/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,9 +707,23 @@ def get_instance_details(config, task_list):
ram = config.get('ram', None)
cpu = config.get('cpu', None)
ratio = config.get('ratio', None)
service = config.get('service', None)
worker_count = config.get('workers', None)
destroy_flag = config.get('destroy_after_failure')

rc_length = 1 if service == 'single' else 2 if service == 'cluster' else None

if not ram and not cpu:
logger.error('Invalid configuration, either ram or cpu must be provided.')
if destroy_flag:
destroy(config)
sys.exit(1)
elif (ram and len(ram) != rc_length) or (cpu and len(cpu) != rc_length):
logger.error('Invalid configuration, ram or cpu must have one value for single jobs, and two for cluster jobs.')
if destroy_flag:
destroy(config)
sys.exit(1)

instance_details = {}

def _check(x, i):
Expand Down
Loading