Get the assigned resources to this worker. By default for tasks, this will return {"CPU": 1}. By default for actors, this will return {}. This is because actors do not have CPUs assigned to them by default. Returns: A dictionary mapping the name of a res
(self)
| 502 | return self.worker.should_capture_child_tasks_in_placement_group |
| 503 | |
| 504 | def get_assigned_resources(self): |
| 505 | """Get the assigned resources to this worker. |
| 506 | |
| 507 | By default for tasks, this will return {"CPU": 1}. |
| 508 | By default for actors, this will return {}. This is because |
| 509 | actors do not have CPUs assigned to them by default. |
| 510 | |
| 511 | Returns: |
| 512 | A dictionary mapping the name of a resource to a float, where |
| 513 | the float represents the amount of that resource reserved |
| 514 | for this worker. |
| 515 | """ |
| 516 | assert ( |
| 517 | self.worker.mode == ray._private.worker.WORKER_MODE |
| 518 | ), f"This method is only available when the process is a\ |
| 519 | worker. Current mode: {self.worker.mode}" |
| 520 | self.worker.check_connected() |
| 521 | resource_id_map = self.worker.core_worker.resource_ids() |
| 522 | resource_map = { |
| 523 | res: sum(amt for _, amt in mapping) |
| 524 | for res, mapping in resource_id_map.items() |
| 525 | } |
| 526 | result = parse_pg_formatted_resources_to_original(resource_map) |
| 527 | return result |
| 528 | |
| 529 | def get_runtime_env_string(self): |
| 530 | """Get the runtime env string used for the current driver or worker. |
nothing calls this directly
no test coverage detected