@@ -993,20 +993,23 @@ def get_directory_contents(results_dir: Path):
993993 continue
994994
995995 exp_description = dir .name
996- # get summary*.csv files and find the most recent
997- summary_files = list (dir .glob ("summary*.csv" ))
998- if len (summary_files ) != 0 :
999- most_recent_summary = max (summary_files , key = os .path .getctime )
1000- summary_df = pd .read_csv (most_recent_summary )
1001-
1002- # get row with max avg_reward
1003- max_reward_row = summary_df .loc [summary_df ["avg_reward" ].idxmax ()]
1004- reward = max_reward_row ["avg_reward" ] * 100
1005- completed = max_reward_row ["n_completed" ]
1006- n_err = max_reward_row ["n_err" ]
1007- exp_description += (
1008- f" - avg-reward: { reward :.1f} % - completed: { completed } - errors: { n_err } "
1009- )
996+ try :
997+ # get summary*.csv files and find the most recent
998+ summary_files = list (dir .glob ("summary*.csv" ))
999+ if len (summary_files ) != 0 :
1000+ most_recent_summary = max (summary_files , key = os .path .getctime )
1001+ summary_df = pd .read_csv (most_recent_summary )
1002+
1003+ # get row with max avg_reward
1004+ max_reward_row = summary_df .loc [summary_df ["avg_reward" ].idxmax ()]
1005+ reward = max_reward_row ["avg_reward" ] * 100
1006+ completed = max_reward_row ["n_completed" ]
1007+ n_err = max_reward_row ["n_err" ]
1008+ exp_description += (
1009+ f" - avg-reward: { reward :.1f} % - completed: { completed } - errors: { n_err } "
1010+ )
1011+ except Exception as e :
1012+ print (f"Error while reading summary file: { e } " )
10101013
10111014 exp_descriptions .append (exp_description )
10121015
0 commit comments