-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Add RayParams to refactor the parameters used by ray python. #3558
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
Conversation
|
Test FAILed. |
|
Test FAILed. |
52171be to
97d1527
Compare
|
This is great. We can merge this as is, but should it actually be a proto so it can be used in c++ as well? |
|
@ericl I don't really understand how do we use it c++. |
|
Test FAILed. |
raulchen
left a comment
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.
Thanks, I left a few small comments. Will take a closer take later.
97d1527 to
b3848d1
Compare
|
Test FAILed. |
python/ray/params.py
Outdated
| temp_dir=None, | ||
| include_log_monitor=None, | ||
| _internal_config=None, | ||
| autoscaling_config=None): |
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.
_internal_config should come last?
python/ray/params.py
Outdated
| if (hasattr(self, arg)): | ||
| setattr(self, arg, kwargs[arg]) | ||
| else: | ||
| raise Exception("Invalid RayParams parameter in" |
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.
raise ValueError?
python/ray/scripts/scripts.py
Outdated
| temp_dir=temp_dir, | ||
| _internal_config=internal_config) | ||
| .format(ray_params.node_ip_address)) | ||
| ray_params.redis_port = redis_port |
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.
should we be using the apply_config method here?
python/ray/services.py
Outdated
| following parameters could be checked: redis_address, | ||
| node_ip_address, worker_path, resources, object_manager_ports, | ||
| node_manager_ports, redis_password | ||
| index (int): the index used in resources, object_manager_ports, |
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.
what is the index of specifically? does it indicate Raylet index? Would be ideal to have this documented.
python/ray/services.py
Outdated
| worker_path (str): The path of the source code that will be run by the | ||
| worker. | ||
| ray_params (ray.params.RayParams): The RayParams instance. The | ||
| following parameters could be checked: address_info, |
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.
hm I feel like these docs aren't particularly helpful. If I wanted to know which attributes were going to be used, I can just check the code.
One thing that would be good is to note specifically how the params instance is updated (which default values are being set, etc).
python/ray/services.py
Outdated
| config = json.loads( | ||
| ray_params._internal_config) if ray_params._internal_config else None | ||
|
|
||
| if ray_params.include_log_monitor is None: |
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.
this pattern appears pretty often; would it makes sense to have some method that batches this?
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 add a function called apply_when_none.
python/ray/services.py
Outdated
|
|
||
| # Start any raylets that do not exist yet. | ||
| for i in range(len(raylet_socket_names), num_local_schedulers): | ||
| for i in range(len(raylet_socket_names), ray_params.num_local_schedulers): |
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.
can we use a better variable here? like worker index or something
python/ray/test/cluster_utils.py
Outdated
| "object_store_memory": 100 * (2**20) # 100 MB | ||
| } | ||
| node_kwargs.update(override_kwargs) | ||
| ray_params = RayParams() |
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.
why not just (
ray_params = RayParams(
node_ip_address=services.get_node_ip_address(),
**node_kwargs)
|
@ericl Thanks for the approve. I am working on other 2 PRs. I will come back and fix the comments soon. |
|
Test FAILed. |
|
Test FAILed. |
|
Test FAILed. |
|
For |
|
Test FAILed. |
13d4dd7 to
82dd26a
Compare
|
Test FAILed. |
|
Test FAILed. |
|
Test FAILed. |
7bb3870 to
12f444f
Compare
|
Test FAILed. |
|
Test FAILed. |
12f444f to
2facd3f
Compare
2facd3f to
d0347ec
Compare
|
Test PASSed. |
|
Test PASSed. |
d0347ec to
414d07d
Compare
|
This Jenkins test passed, so I reverted the temporary Jenkins fix and kept the related commit. |
|
Test FAILed. |
python/ray/parameter.py
Outdated
| def update_if_absent(self, **kwargs): | ||
| """Update the settings when the target fields are None. | ||
|
|
||
| Attributes: |
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.
Should be Args:
python/ray/parameter.py
Outdated
| def update(self, **kwargs): | ||
| """Update the settings according to the keyword arguments. | ||
|
|
||
| Attributes: |
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.
Args:
|
@guoyuhong this looks great, thanks for this PR! |
|
Looking over these changes made me think:
In subsequent PRs.. |
|
Test PASSed. |
What do these changes do?
Current ray parameters appears in multiple places. Therefore, many same parameters are passed through many functions. If we need to add a single parameter, we need to add this parameter to all the functions and document this parameter every time. It's verbose and error-prone.
In this PR, all the parameters are stored in one class. The developer can add one parameter once and use it in the ray function call stack deeply.
Related issue number
N/A