mirror of
https://github.com/wassname/ray.git
synced 2026-07-19 11:27:32 +08:00
[Core] Add option to override environment variables for tasks and actors (#11619)
This commit is contained in:
+13
-4
@@ -418,7 +418,8 @@ class ActorClass:
|
||||
lifetime=None,
|
||||
placement_group=None,
|
||||
placement_group_bundle_index=-1,
|
||||
placement_group_capture_child_tasks=None):
|
||||
placement_group_capture_child_tasks=None,
|
||||
override_environment_variables=None):
|
||||
"""Configures and overrides the actor instantiation parameters.
|
||||
|
||||
The arguments are the same as those that can be passed
|
||||
@@ -458,7 +459,9 @@ class ActorClass:
|
||||
placement_group=placement_group,
|
||||
placement_group_bundle_index=placement_group_bundle_index,
|
||||
placement_group_capture_child_tasks=(
|
||||
placement_group_capture_child_tasks))
|
||||
placement_group_capture_child_tasks),
|
||||
override_environment_variables=(
|
||||
override_environment_variables))
|
||||
|
||||
return ActorOptionWrapper()
|
||||
|
||||
@@ -478,7 +481,8 @@ class ActorClass:
|
||||
lifetime=None,
|
||||
placement_group=None,
|
||||
placement_group_bundle_index=-1,
|
||||
placement_group_capture_child_tasks=None):
|
||||
placement_group_capture_child_tasks=None,
|
||||
override_environment_variables=None):
|
||||
"""Create an actor.
|
||||
|
||||
This method allows more flexibility than the remote method because
|
||||
@@ -515,6 +519,9 @@ class ActorClass:
|
||||
placement_group_capture_child_tasks: Whether or not children tasks
|
||||
of this actor should implicitly use the same placement group
|
||||
as its parent. It is True by default.
|
||||
override_environment_variables: Environment variables to override
|
||||
and/or introduce for this actor. This is a dictionary mapping
|
||||
variable names to their values.
|
||||
|
||||
Returns:
|
||||
A handle to the newly created actor.
|
||||
@@ -661,7 +668,9 @@ class ActorClass:
|
||||
placement_group_bundle_index,
|
||||
placement_group_capture_child_tasks,
|
||||
# Store actor_method_cpu in actor handle's extension data.
|
||||
extension_data=str(actor_method_cpu))
|
||||
extension_data=str(actor_method_cpu),
|
||||
override_environment_variables=override_environment_variables
|
||||
or dict())
|
||||
|
||||
actor_handle = ActorHandle(
|
||||
meta.language,
|
||||
|
||||
Reference in New Issue
Block a user