python/ray/state.py
def chrome_tracing_object_transfer_dump(self, filename=None):
        """Return a list of transfer events that can viewed as a timeline.

        To view this information as a timeline, simply dump it as a json file
        by passing in "filename" or using using json.dump, and then load go to
        chrome://tracing in the Chrome web browser and load the dumped file.
        Make sure to enable "Flow events" in the "View Options" menu.

        Args:
            filename: If a filename is provided, the timeline is dumped to that
                file.

        Returns:
            If filename is not provided, this returns a list of profiling
                events. Each profile event is a dictionary.
        """
        self._check_connected()

        node_id_to_address = {}
        for node_info in self.node_table():
            node_id_to_address[node_info["NodeID"]] = "{}:{}".format(
                node_info["NodeManagerAddress"], node_info["ObjectManagerPort"]
            )

        all_events = []

        for key, items in self.profile_table().items():
            # Only consider object manager events.
            if items[0]["component_type"] != "object_manager":
                continue

            for event in items:
                if event["event_type"] == "transfer_send":
                    object_ref, remote_node_id, _, _ = event["extra_data"]

                elif event["event_type"] == "transfer_receive":
                    object_ref, remote_node_id, _ = event["extra_data"]

                elif event["event_type"] == "receive_pull_request":
                    object_ref, remote_node_id = event["extra_data"]

                else:
                    assert False, "This should be unreachable."

                # Choose a color by reading the first couple of hex digits of
                # the object ref as an integer and turning that into a color.
                object_ref_int = int(object_ref[:2], 16)
                color = self._chrome_tracing_colors[
                    object_ref_int % len(self._chrome_tracing_colors)
                ]

                new_event = {
                    # The category of the event.
                    "cat": event["event_type"],
                    # The string displayed on the event.
                    "name": event["event_type"],
                    # The identifier for the group of rows that the event
                    # appears in.
                    "pid": node_id_to_address[key],
                    # The identifier for the row that the event appears in.
                    "tid": node_id_to_address[remote_node_id],
                    # The start time in microseconds.
                    "ts": self._seconds_to_microseconds(event["start_time"]),
                    # The duration in microseconds.
                    "dur": self._seconds_to_microseconds(
                        event["end_time"] - event["start_time"]
                    ),
                    # What is this?
                    "ph": "X",
                    # This is the name of the color to display the box in.
                    "cname": color,
                    # The extra user-defined data.
                    "args": event["extra_data"],
                }
                all_events.append(new_event)

                # Add another box with a color indicating whether it was a send
                # or a receive event.
                if event["event_type"] == "transfer_send":
                    additional_event = new_event.copy()
                    additional_event["cname"] = "black"
                    all_events.append(additional_event)
                elif event["event_type"] == "transfer_receive":
                    additional_event = new_event.copy()
                    additional_event["cname"] = "grey"
                    all_events.append(additional_event)
                else:
                    pass

        if filename is not None:
            with open(filename, "w") as outfile:
                json.dump(all_events, outfile)
        else:
            return all_events
Return a list of transfer events that can viewed as a timeline.

        To view this information as a timeline, simply dump it as a json file
        by passing in "filename" or using using json.dump, and then load go to
        chrome://tracing in the Chrome web browser and load the dumped file.
        Make sure to enable "Flow events" in the "View Options" menu.

        Args:
            filename: If a filename is provided, the timeline is dumped to that
                file.

        Returns:
            If filename is not provided, this returns a list of profiling
                events. Each profile event is a dictionary.
        
Return a list of transfer events that can viewed as a timeline.
To view this information as a timeline, simply dump it as a json file
by passing in "filename" or using using json.dump, and then load go to
chrome://tracing in the Chrome web browser and load the dumped file.
Make sure to enable "Flow events" in the "View Options" menu.
Return a list of transfer events that can viewed as a timeline . To view this information as a timeline simply dump it as a json file by passing in " filename " or using using json . dump and then load go to chrome : // tracing in the Chrome web browser and load the dumped file . Make sure to enable " Flow events " in the " View Options " menu .
def chrome_tracing_object_transfer_dump(self, filename=None):
        self._check_connected()
        node_id_to_address = {}
        for node_info in self.node_table():
            node_id_to_address[node_info["NodeID"]] = "{}:{}".format(
                node_info["NodeManagerAddress"], node_info["ObjectManagerPort"]
            )
        all_events = []
        for key, items in self.profile_table().items():
            if items[0]["component_type"] != "object_manager":
                continue
            for event in items:
                if event["event_type"] == "transfer_send":
                    object_ref, remote_node_id, _, _ = event["extra_data"]
                elif event["event_type"] == "transfer_receive":
                    object_ref, remote_node_id, _ = event["extra_data"]
                elif event["event_type"] == "receive_pull_request":
                    object_ref, remote_node_id = event["extra_data"]
                else:
                    assert False, "This should be unreachable."
                object_ref_int = int(object_ref[:2], 16)
                color = self._chrome_tracing_colors[
                    object_ref_int % len(self._chrome_tracing_colors)
                ]
                new_event = {
                    "cat": event["event_type"],
                    "name": event["event_type"],
                    "pid": node_id_to_address[key],
                    "tid": node_id_to_address[remote_node_id],
                    "ts": self._seconds_to_microseconds(event["start_time"]),
                    "dur": self._seconds_to_microseconds(
                        event["end_time"] - event["start_time"]
                    ),
                    "ph": "X",
                    "cname": color,
                    "args": event["extra_data"],
                }
                all_events.append(new_event)
                if event["event_type"] == "transfer_send":
                    additional_event = new_event.copy()
                    additional_event["cname"] = "black"
                    all_events.append(additional_event)
                elif event["event_type"] == "transfer_receive":
                    additional_event = new_event.copy()
                    additional_event["cname"] = "grey"
                    all_events.append(additional_event)
                else:
                    pass
        if filename is not None:
            with open(filename, "w") as outfile:
                json.dump(all_events, outfile)
        else:
            return all_events
def chrome_tracing_object_transfer_dump ( self , filename = None ) : self . _check_connected ( ) node_id_to_address = { } for node_info in self . node_table ( ) : node_id_to_address [ node_info [ "NodeID" ] ] = "{}:{}" . format ( node_info [ "NodeManagerAddress" ] , node_info [ "ObjectManagerPort" ] ) all_events = [ ] for key , items in self . profile_table ( ) . items ( ) : if items [ 0 ] [ "component_type" ] != "object_manager" : continue for event in items : if event [ "event_type" ] == "transfer_send" : object_ref , remote_node_id , _ , _ = event [ "extra_data" ] elif event [ "event_type" ] == "transfer_receive" : object_ref , remote_node_id , _ = event [ "extra_data" ] elif event [ "event_type" ] == "receive_pull_request" : object_ref , remote_node_id = event [ "extra_data" ] else : assert False , "This should be unreachable." object_ref_int = int ( object_ref [ : 2 ] , 16 ) color = self . _chrome_tracing_colors [ object_ref_int % len ( self . _chrome_tracing_colors ) ] new_event = { "cat" : event [ "event_type" ] , "name" : event [ "event_type" ] , "pid" : node_id_to_address [ key ] , "tid" : node_id_to_address [ remote_node_id ] , "ts" : self . _seconds_to_microseconds ( event [ "start_time" ] ) , "dur" : self . _seconds_to_microseconds ( event [ "end_time" ] - event [ "start_time" ] ) , "ph" : "X" , "cname" : color , "args" : event [ "extra_data" ] , } all_events . append ( new_event ) if event [ "event_type" ] == "transfer_send" : additional_event = new_event . copy ( ) additional_event [ "cname" ] = "black" all_events . append ( additional_event ) elif event [ "event_type" ] == "transfer_receive" : additional_event = new_event . copy ( ) additional_event [ "cname" ] = "grey" all_events . append ( additional_event ) else : pass if filename is not None : with open ( filename , "w" ) as outfile : json . dump ( all_events , outfile ) else : return all_events
Return a list of transfer events that can viewed as a timeline.
Return a list of transfer events that can viewed as a timeline .
"""Return a list of transfer events that can viewed as a timeline.

        To view this information as a timeline, simply dump it as a json file
        by passing in "filename" or using using json.dump, and then load go to
        chrome://tracing in the Chrome web browser and load the dumped file.
        Make sure to enable "Flow events" in the "View Options" menu.

        Args:
            filename: If a filename is provided, the timeline is dumped to that
                file.

        Returns:
            If filename is not provided, this returns a list of profiling
                events. Each profile event is a dictionary.
        """ # Only consider object manager events. # Choose a color by reading the first couple of hex digits of # the object ref as an integer and turning that into a color. # The category of the event. # The string displayed on the event. # The identifier for the group of rows that the event # appears in. # The identifier for the row that the event appears in. # The start time in microseconds. # The duration in microseconds. # What is this? # This is the name of the color to display the box in. # The extra user-defined data. # Add another box with a color indicating whether it was a send # or a receive event.
If filename is not provided, this returns a list of profiling
events. Each profile event is a dictionary.
If filename is not provided this returns a list of profiling events . Each profile event is a dictionary .
self
filename
If a filename is provided, the timeline is dumped to that
file.
If a filename is provided the timeline is dumped to that file .