Exemplo n.º 1
0
def placement_groups(ctx, format: str):
    url = ctx.obj["api_server_url"]
    print(
        get_state_api_output_to_print(
            list_placement_groups(api_server_url=url),
            format=AvailableFormat(format),
        ))
Exemplo n.º 2
0
def placement_groups(ctx, format: str):
    url = ctx.obj["api_server_url"]
    format = AvailableFormat(format)
    print(
        get_state_api_output_to_print(
            list_placement_groups(api_server_url=url, _explain=_should_explain(format)),
            format=format,
        )
    )
Exemplo n.º 3
0
def test_list_pgs(shutdown_only):
    ray.init()
    pg = ray.util.placement_group(bundles=[{"CPU": 1}])  # noqa

    def verify():
        pg_data = list(list_placement_groups().values())[0]
        correct_state = pg_data["state"] == "CREATED"
        is_id_hex = is_hex(pg_data["placement_group_id"])
        correct_id = pg.id.hex() == pg_data["placement_group_id"]
        return correct_state and is_id_hex and correct_id

    wait_for_condition(verify)
    print(list_placement_groups())
Exemplo n.º 4
0
def placement_groups(ctx, format: str, filter: List[Tuple[str, str]]):
    url = ctx.obj["api_server_url"]
    format = AvailableFormat(format)
    print(
        get_state_api_output_to_print(
            list_placement_groups(
                api_server_url=url,
                filters=filter,
                _explain=_should_explain(format),
            ),
            format=format,
        )
    )
Exemplo n.º 5
0
def placement_groups(ctx):
    url = ctx.obj["api_server_url"]
    pprint(list_placement_groups(url))
Exemplo n.º 6
0
 def verify():
     pg_data = list(list_placement_groups().values())[0]
     correct_state = pg_data["state"] == "CREATED"
     is_id_hex = is_hex(pg_data["placement_group_id"])
     correct_id = pg.id.hex() == pg_data["placement_group_id"]
     return correct_state and is_id_hex and correct_id