python/ray/experimental/state/api.py
def _list(resource_name: str, options: ListApiOptions, api_server_url: str = None):
    """Query the API server in address to list "resource_name" states.

    Args:
        resource_name: The name of the resource. E.g., actor, task.
        options: The options for the REST API that are translated to query strings.
        address: The address of API server. If it is not give, it assumes the ray
            is already connected and obtains the API server address using
            Ray API.
    """
    if api_server_url is None:
        assert ray.is_initialized()
        api_server_url = (
            f"http://{ray.worker.global_worker.node.address_info['webui_url']}"
        )

    query_strings = []
    for field in fields(options):
        query_strings.append(f"{field.name}={getattr(options, field.name)}")
    r = requests.request(
        "GET",
        f"{api_server_url}/api/v0/{resource_name}?{'&'.join(query_strings)}",
        headers={"Content-Type": "application/json"},
        json=None,
        timeout=options.timeout,
    )
    r.raise_for_status()

    response = r.json()
    if not response["result"]:
        raise ValueError(
            "API server internal error. See dashboard.log file for more details."
        )
    return r.json()["data"]["result"]
Query the API server in address to list "resource_name" states.

    Args:
        resource_name: The name of the resource. E.g., actor, task.
        options: The options for the REST API that are translated to query strings.
        address: The address of API server. If it is not give, it assumes the ray
            is already connected and obtains the API server address using
            Ray API.
    
Query the API server in address to list "resource_name" states.
Query the API server in address to list " resource_name " states .
def _list(resource_name: str, options: ListApiOptions, api_server_url: str = None):
    if api_server_url is None:
        assert ray.is_initialized()
        api_server_url = (
            f"http://{ray.worker.global_worker.node.address_info['webui_url']}"
        )
    query_strings = []
    for field in fields(options):
        query_strings.append(f"{field.name}={getattr(options, field.name)}")
    r = requests.request(
        "GET",
        f"{api_server_url}/api/v0/{resource_name}?{'&'.join(query_strings)}",
        headers={"Content-Type": "application/json"},
        json=None,
        timeout=options.timeout,
    )
    r.raise_for_status()
    response = r.json()
    if not response["result"]:
        raise ValueError(
            "API server internal error. See dashboard.log file for more details."
        )
    return r.json()["data"]["result"]
def _list ( resource_name : str , options : ListApiOptions , api_server_url : str = None ) : if api_server_url is None : assert ray . is_initialized ( ) api_server_url = ( f"http://{ray.worker.global_worker.node.address_info['webui_url']}" ) query_strings = [ ] for field in fields ( options ) : query_strings . append ( f"{field.name}={getattr(options, field.name)}" ) r = requests . request ( "GET" , f"{api_server_url}/api/v0/{resource_name}?{'&'.join(query_strings)}" , headers = { "Content-Type" : "application/json" } , json = None , timeout = options . timeout , ) r . raise_for_status ( ) response = r . json ( ) if not response [ "result" ] : raise ValueError ( "API server internal error. See dashboard.log file for more details." ) return r . json ( ) [ "data" ] [ "result" ]
Query the API server in address to list "resource_name" states.
Query the API server in address to list " resource_name " states .
"""Query the API server in address to list "resource_name" states.

    Args:
        resource_name: The name of the resource. E.g., actor, task.
        options: The options for the REST API that are translated to query strings.
        address: The address of API server. If it is not give, it assumes the ray
            is already connected and obtains the API server address using
            Ray API.
    """
resource_name
str
The name of the resource. E.g., actor, task.
The name of the resource . E . g . actor task .
options
ListApiOptions
The options for the REST API that are translated to query strings.
The options for the REST API that are translated to query strings .
api_server_url
str
address
The address of API server. If it is not give, it assumes the ray
is already connected and obtains the API server address using
Ray API.
The address of API server . If it is not give it assumes the ray is already connected and obtains the API server address using Ray API .