Skip to content

Commit

Permalink
[RLlib] Fix release test JSON summary problem (if e.g. numpy data in …
Browse files Browse the repository at this point in the history
…result dict). (ray-project#45753)

Signed-off-by: Richard Liu <[email protected]>
  • Loading branch information
sven1977 authored and richardsliu committed Jun 12, 2024
1 parent f2a610b commit d132e1d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion rllib/utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,17 @@ def run_rllib_example_script_experiment(
os.environ.get("TEST_OUTPUT_JSON", "/tmp/learning_test.json"),
"wt",
) as f:
json.dump(json_summary, f)
try:
json.dump(json_summary, f)
# Something went wrong writing json. Try again w/ simplified stats.
except Exception:
from ray.rllib.algorithms.algorithm import Algorithm

simplified_stats = {
k: stats[k] for k in Algorithm._progress_metrics if k in stats
}
json_summary["stats"] = simplified_stats
json.dump(json_summary, f)

if not test_passed:
raise ValueError(
Expand Down

0 comments on commit d132e1d

Please sign in to comment.