Point72 / raydar

A perspective powered, user editable ray dashboard via ray serve.
https://github.com/Point72/raydar/wiki
Apache License 2.0
30 stars 1 forks source link

Adding option to create/update arbitrary perspective tables #31

Closed gauglertodd closed 2 months ago

gauglertodd commented 2 months ago

previously, the guidance has been this:

task_tracker = RayTaskTracker(enable_perspective_dashboard=True)
proxy_server = task_tracker.proxy_server()
proxy_server.remote(
    "new",
    "metrics_table",
    {
        "node_id": "str",
        "metric_name": "str",
        "value": "float",
        "timestamp": "datetime",
    },
)

then somewhere in your code, do this:

def my_model_training_loop()

    for epoch in range(num_epochs):

    # ... my training code here ...

        data = dict(
            node_id=ray.get_runtime_context().get_node_id(),
            metric_name="loss",
            value=loss.item(),
            timestamp=time.time(),
        )
        proxy_server.remote("update", "metrics_table", [data])

but this is a little clunky, and probably could be obfuscated behind some cleaner wrappers. So the proposal here is to instead:

task_tracker = RayTaskTracker(enable_perspective_dashboard=True)
task_tracker.create_table(
    "metrics_table",
    {
        "node_id": "str",
        "metric_name": "str",
        "value": "float",
        "timestamp": "datetime",
    },
)

and then

def my_model_training_loop()

    for epoch in range(num_epochs):

    # ... my training code here ...

        data = dict(
            node_id=ray.get_runtime_context().get_node_id(),
            metric_name="loss",
            value=loss.item(),
            timestamp=time.time(),
        )
        task_tracker.update_table("metrics_table", [data])
github-actions[bot] commented 2 months ago

Test Results

1 tests  ±0   1 :white_check_mark: ±0   35s :stopwatch: ±0s 1 suites ±0   0 :zzz: ±0  1 files   ±0   0 :x: ±0 

Results for commit c95b0b71. ± Comparison against base commit a987f53d.

github-actions[bot] commented 2 months ago

Test Results

1 tests  ±0   1 :white_check_mark: ±0   35s :stopwatch: ±0s 1 suites ±0   0 :zzz: ±0  1 files   ±0   0 :x: ±0 

Results for commit c95b0b71. ± Comparison against base commit a987f53d.