# Formatting output file names & organizing saved episodes

**URL:** <https://discuss.ray.io/t/formatting-output-file-names-organizing-saved-episodes/81>\
**Category:** RLlib\
**Created:** [November 26, 2020, 11:21am UTC](https://discuss.ray.io/t/formatting-output-file-names-organizing-saved-episodes/81 "2020-11-26T11:21:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![abrandenb](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/abrandenb/32/6157_2.png) [@abrandenb](https://discuss.ray.io/u/abrandenb)\
**Post date:** [November 26, 2020, 11:21am UTC](https://discuss.ray.io/t/formatting-output-file-names-organizing-saved-episodes/81/1 "2020-11-26T11:21:14Z")

</div>

Hi!  
**TLDR: How do I format the file name of evaluation output files to include the current training step? Target format for _single_ episodes similar to: `output-{TRAINSTEP}_worker{ID}_{BATCH}.json`**

**Full story:**  
I’m rather new to the ray architecture and I’m surprised how easy it is to execute complex RL models. Thanks to everybody who is contributing! Still I am having trouble finding my way through the architecture.

I am training a Multi-Agent model using PPO in a custom environment. To assess the performance of my model during training time, I want to evaluate my model periodically. Fortunately, I can parameterize my Trainer as follows to save my evaluation episodes:

```python
...
 "evaluation_interval": int(5),
 "evaluation_num_episodes": 1,
 "evaluation_config": {
     "explore": False,
     "output_compress_columns": [],
     "output": "eval_results/",
 },
...

```

Now, every 5 iterations, the evaluation worker will gather a single episode and dump it into a json file, which gets split into parts if a size threshold is reached.

Since I would like to use these evaluation episodes to judge how the training process is progressing, I would like to match the episode to the training step. Until now, I am not sure how to retrieve the training step from the data inside the json file. Furthermore, I think it would be more elegant to split the episode files completely: Each worker gather its trajectories and creates files similar to the previous structure, maybe following a filename format like `output-{TRAINSTEP}-{WALLTIME}_worker{ID}_{BATCH}.json`. I assume the splitting can be achieved by setting `"output_max_file_size": 0`. The renaming, however, remains a mystery to me.

I hope there is someone who can help me with this. Thanks!

---

<div class="post-metadata">

**Author:** ![sven1977](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sven1977/32/53_2.png) [@sven1977](https://discuss.ray.io/u/sven1977)\
**Post date:** [November 27, 2020, 3:58pm UTC](https://discuss.ray.io/t/formatting-output-file-names-organizing-saved-episodes/81/2 "2020-11-27T15:58:46Z")

</div>

Hey Andre. Thanks for raising this issue. I don’t think formatting the file names is currently possible (could you file a github issue, requesting this as a new feature and assign me (sven1977) to this?).  
On the splitting by episode: Did you actually try setting the max\_file\_size to 0 and confirm this would work?

---

<div class="post-metadata">

**Author:** ![abrandenb](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/abrandenb/32/6157_2.png) [@abrandenb](https://discuss.ray.io/u/abrandenb)\
**Post date:** [November 29, 2020, 10:51am UTC](https://discuss.ray.io/t/formatting-output-file-names-organizing-saved-episodes/81/3 "2020-11-29T10:51:21Z")

</div>

Hey Sven! Thanks, I will file a github issue. I can confirm that setting max\_file\_size=0 does create new files for each recorded episode.

[Link to github issue](https://github.com/ray-project/ray/issues/12480)

---

<div class="post-metadata">

**Author:** ![sven1977](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sven1977/32/53_2.png) [@sven1977](https://discuss.ray.io/u/sven1977)\
**Post date:** [December 8, 2020, 12:08pm UTC](https://discuss.ray.io/t/formatting-output-file-names-organizing-saved-episodes/81/4 "2020-12-08T12:08:26Z")

</div>

Responded on the issue. Will do a PR on this and ping you.
