Commit b38c13a
[data] fix resource allocator not respecting max resource requirement (ray-project#59412)
This PR adds a cap on the total budget allocation by max_resource_usage
in ReservationOpResourceAllocator.
Previously, the reservation was capped by max_resource_usage, but the
total budget (reservation + shared resources) could exceed the max. This
could lead to operators being allocated more resources than they can
use, while other operators are starved.
Changes
Cap total allocation by max_resource_usage:
- Total allocation = max(total_reserved, op_usage) + op_shared
- We now cap op_shared so that total allocation ≤ max_resource_usage
- Excess shared resources remain in remaining_shared for other operators
Redistribute remaining shared resources:
- After the allocation loop, any remaining shared resources (from caps)
are given to the most downstream uncapped operator
- An operator is "uncapped" if its max_resource_usage ==
ExecutionResources.inf()
- If all operators are capped, remaining resources are not redistributed
Tests
- test_budget_capped_by_max_resource_usage: Tests that capped operators
don't receive excess shared resources, and remaining goes to uncapped
downstream op
- test_budget_capped_by_max_resource_usage_all_capped: Tests that when
all operators are capped, remaining shared resources are not
redistributed
---------
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: peterxcli <peterxcli@gmail.com>1 parent fa2c4de commit b38c13a
File tree
2 files changed
+171
-1
lines changed- python/ray/data
- _internal/execution
- tests
2 files changed
+171
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
789 | 789 | | |
790 | 790 | | |
791 | 791 | | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
792 | 800 | | |
793 | 801 | | |
794 | 802 | | |
| |||
888 | 896 | | |
889 | 897 | | |
890 | 898 | | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
891 | 913 | | |
892 | 914 | | |
893 | 915 | | |
| |||
896 | 918 | | |
897 | 919 | | |
898 | 920 | | |
899 | | - | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
900 | 925 | | |
901 | 926 | | |
902 | 927 | | |
| |||
915 | 940 | | |
916 | 941 | | |
917 | 942 | | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
918 | 954 | | |
919 | 955 | | |
920 | 956 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
712 | 712 | | |
713 | 713 | | |
714 | 714 | | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
715 | 849 | | |
716 | 850 | | |
717 | 851 | | |
| |||
0 commit comments