python/ray/tune/schedulers/resource_changing_scheduler.py
def _get_added_bundles(
        self, bundles: List[Dict[str, float]], base_bundles: List[Dict[str, float]]
    ) -> List[Dict[str, float]]:
        """Return the difference between bundles and base_bundles"""
        if self.add_bundles:
            added_bundles = bundles[len(base_bundles) :]
        else:
            if not bundles:
                bundles = [{"CPU": 0, "GPU": 0}]
            if not base_bundles:
                base_bundles = [{"CPU": 0, "GPU": 0}]
            added_bundles = [
                {
                    "CPU": bundles[0].get("CPU", 0) - base_bundles[0].get("CPU", 0),
                    "GPU": bundles[0].get("GPU", 0) - base_bundles[0].get("GPU", 0),
                }
            ]
        return added_bundles
Return the difference between bundles and base_bundles
Return the difference between bundles and base_bundles
Return the difference between bundles and base_bundles
def _get_added_bundles(
        self, bundles: List[Dict[str, float]], base_bundles: List[Dict[str, float]]
    ) -> List[Dict[str, float]]:
        if self.add_bundles:
            added_bundles = bundles[len(base_bundles) :]
        else:
            if not bundles:
                bundles = [{"CPU": 0, "GPU": 0}]
            if not base_bundles:
                base_bundles = [{"CPU": 0, "GPU": 0}]
            added_bundles = [
                {
                    "CPU": bundles[0].get("CPU", 0) - base_bundles[0].get("CPU", 0),
                    "GPU": bundles[0].get("GPU", 0) - base_bundles[0].get("GPU", 0),
                }
            ]
        return added_bundles
def _get_added_bundles ( self , bundles : List [ Dict [ str , float ] ] , base_bundles : List [ Dict [ str , float ] ] ) -> List [ Dict [ str , float ] ] : if self . add_bundles : added_bundles = bundles [ len ( base_bundles ) : ] else : if not bundles : bundles = [ { "CPU" : 0 , "GPU" : 0 } ] if not base_bundles : base_bundles = [ { "CPU" : 0 , "GPU" : 0 } ] added_bundles = [ { "CPU" : bundles [ 0 ] . get ( "CPU" , 0 ) - base_bundles [ 0 ] . get ( "CPU" , 0 ) , "GPU" : bundles [ 0 ] . get ( "GPU" , 0 ) - base_bundles [ 0 ] . get ( "GPU" , 0 ) , } ] return added_bundles
Return the difference between bundles and base_bundles
Return the difference between bundles and base_bundles
"""Return the difference between bundles and base_bundles"""
self
bundles
List[Dict[str, float]]
base_bundles
List[Dict[str, float]]