-
Notifications
You must be signed in to change notification settings - Fork 432
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
[Test] Add e2e test for sample RayJob yaml on kind #935
Merged
kevin85421
merged 20 commits into
ray-project:master
from
architkulkarni:test-rayjob-sample-yaml
Apr 17, 2023
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b5cc33a
Add e2e test for sample RayJob yaml on kind
architkulkarni 6756db1
Remove unused Rule
architkulkarni a717ec6
Add back EasyJobRule to test cluster startup
architkulkarni 72fd359
Update tests/framework/prototype.py
architkulkarni 36d4760
Merge branch 'test-rayjob-sample-yaml' of https://github.com/architku…
architkulkarni 9512b33
Specify 1 cpu in Sample YAML to deflake test
architkulkarni ef86d56
Fix resource specification in sample YAML
architkulkarni f5113ef
Fix RayJobRule
architkulkarni 9c83d55
Add RayJobRule to test script
architkulkarni 6cf5e30
Merge branch 'master' of https://github.com/ray-project/kuberay into …
architkulkarni 6ae6309
Skip RayJobSuccessRule
architkulkarni 0c804d7
Merge branch 'master' of https://github.com/ray-project/kuberay into …
architkulkarni c2658c6
Merge branch 'master' of https://github.com/ray-project/kuberay into …
architkulkarni bdce2ef
Merge branch 'master' of https://github.com/ray-project/kuberay into …
architkulkarni 9654cd9
Merge branch 'master' of https://github.com/ray-project/kuberay into …
architkulkarni 43fba2d
Update version to 0.5
architkulkarni 23d5644
Add RayJobSuccessRule
architkulkarni 74a7d40
Merge branch 'test-rayjob-sample-yaml' of https://github.com/architku…
architkulkarni c67073b
Revert "Add RayJobSuccessRule"
architkulkarni fc05572
Delete RayJobSuccessRule
architkulkarni 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
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,58 @@ | ||
''' Test sample RayJob YAML files to catch invalid and outdated ones. ''' | ||
import unittest | ||
import os | ||
import logging | ||
import yaml | ||
|
||
from framework.prototype import ( | ||
RuleSet, | ||
GeneralTestCase, | ||
RayJobAddCREvent, | ||
EasyJobRule, | ||
) | ||
|
||
from framework.utils import ( | ||
CONST | ||
) | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
if __name__ == '__main__': | ||
NAMESPACE = 'default' | ||
SAMPLE_PATH = CONST.REPO_ROOT.joinpath("ray-operator/config/samples/") | ||
YAMLs = ['ray_v1alpha1_rayjob.yaml'] | ||
|
||
sample_yaml_files = [] | ||
for filename in YAMLs: | ||
filepath = SAMPLE_PATH.joinpath(filename) | ||
with open(filepath, encoding="utf-8") as cr_yaml: | ||
for k8s_object in yaml.safe_load_all(cr_yaml): | ||
if k8s_object['kind'] == 'RayJob': | ||
sample_yaml_files.append( | ||
{'path': filepath, 'name': filename, 'cr': k8s_object} | ||
) | ||
break | ||
# TODO(architkulkarni): Add RayJobSuccessRule. Currently fails with the following error: | ||
# Failed to start Job Supervisor actor: The name _ray_internal_job_actor_rayjob-sample-8tzrb | ||
# (namespace=SUPERVISOR_ACTOR_RAY_NAMESPACE) is already taken. | ||
rs = RuleSet([EasyJobRule()]) | ||
image_dict = { | ||
CONST.RAY_IMAGE_KEY: os.getenv('RAY_IMAGE', default='rayproject/ray:2.3.0'), | ||
CONST.OPERATOR_IMAGE_KEY: os.getenv('OPERATOR_IMAGE', default='kuberay/operator:nightly'), | ||
} | ||
logger.info(image_dict) | ||
|
||
# Build a test plan | ||
logger.info("Building a test plan ...") | ||
test_cases = unittest.TestSuite() | ||
for index, new_cr in enumerate(sample_yaml_files): | ||
logger.info('[TEST %d]: %s', index, new_cr['name']) | ||
addEvent = RayJobAddCREvent(new_cr['cr'], [rs], 300, NAMESPACE, new_cr['path']) | ||
test_cases.addTest(GeneralTestCase('runtest', image_dict, addEvent)) | ||
|
||
# Execute all testsCRs | ||
runner = unittest.TextTestRunner() | ||
test_result = runner.run(test_cases) | ||
|
||
# Without this line, the exit code will always be 0. | ||
assert test_result.wasSuccessful() |
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.
Will RayJob automatically clean up the Ray Pods after it succeeds?
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.
By default, the terminate cluster on completion flag is set to False, though we may change this behavior in the future. (I'm not sure it's intentional that the default is False, and it doesn't seem to be documented at the moment)