Conversation
Codecov Report
@@ Coverage Diff @@
## master #464 +/- ##
==========================================
- Coverage 62.9% 62.44% -0.46%
==========================================
Files 182 185 +3
Lines 12169 11927 -242
==========================================
- Hits 7655 7448 -207
+ Misses 4514 4479 -35
Continue to review full report at Codecov.
|
|
@ryanjulian Any ideas what's going on? |
|
Could you give a brief on the design of new logger and also an example script to illustrate the basic usage? |
I have met the similar error here. But I met this error in local pre-commit. I updated the garage env then solved the problem. |
Can you elaborate on how to update garage env? Do you mean reinstall deps in environment.yml? |
conda env update -n garage |
krzentner
left a comment
There was a problem hiding this comment.
This is a pretty large change, but mostly not scary.
You added a bunch of noqa, which kinda defeats the point of using flake8. I was going to tell you to fix them, but then I found that they mostly don't appear to be necessary.
I have good tooling to fix this, so I just added a commit which fixes them. Please pull it before making more changes. I didn't fix the test/ directory, since that didn't really seem as important.
The rest of the comments are hopefully pretty minor? Let me know if you have questions, as always.
jonashen
left a comment
There was a problem hiding this comment.
Just a general question, is there a reason why we have logger under misc instead of it being standalone? i.e. garage.misc.logger instead of garage.logger?
@krzentner @ryanjulian What do you think about this? |
@krzentner |
Put it in garage.logger |
You have to make sure to use our configurations with automated tools. They live in setup.cfg |
I'm not sure if there's any fully automated tooling which works with our current linters. My workflow (which I've used across lots of environments / teams / companies) is basically:
Obviously, a fully automated tooling solution is preferred, but this workflow has served me well for making formatting fixes and refactorings. |
* Renames TensorBoard logging files and tests to follow convention * Changes Histogram* types in garage.logger.tensorboard_inputs to simpler names in garage.logger.distributions
* Move LogOutput base class to `garage.logger.logger`, so that the entire API is in one place * Rename `garage.logger.outputs` to `simple_outputs` to better reflect its purpose
* Moves tests for simple_outputs to test_simple_outputs * Makes proper use of temporary files
* Replace TensorBoardOutput with tensorboardX. * Add unittest for TensorBoardOutput. * Delete tensor log as it is too complex and not used anywhere right now. * Rebase with origin/HEAD.
* garage.experiment.run_experiment didn't add `StdOutput`. Fixed. * `TextOutput` doesn't support `TabularInput`. This would make `TextOutput` useless as it doesn't log algorithm information any more. Therefore I prefer we added `TabularInput` in `TextOutput`. * Sort tabular in alphabetical order. * Fix that `TabularInput.as_primitive_dict` doesn't log `np.float32`.
* snapshotter fails because `Snapshotter._snapshot_dir=None` and `snapshot_dir.setter` calls `mkdir_p` which doesn't support NoneType. Fixed this.
* Rewrites parts of TensorBoardLogger * Tests TensorBoardLogger with mocks * Makes proper use of the dump() API * Modifies LocalRunner to use dump() * Updates tests which no longer need the logger * Updates test fixtures to use NullOutput * Add TabularInput support to TextOutput * Detects and warns when TabularInput values are not logged * Move NullOutput to tests.fixtures
* Refactor Snapshotter unittests * Delete duplicate log line in tf/DDPG * Fix flake8 complaints * Fix CsvOutput bug. For some off policy algorithms that use replay buffer, there is usually a min buffer size. It means the algorithms won't start training until it has sampled min-buffer-size samples. But CsvOutput set `CsvOutput._fieldnames` from the beginning, which is empty in this case. Later when data is not empty, it will raise Inconsistent TabularInput keys warning. Fix this by only start to set `CsvOutput._writer` when `to_csv.keys()` is not None.
87dd21e to
cf21a5c
Compare
6531e46 to
1006a68
Compare
* Add more CsvOutput and Logger tests. The logger module now reaches 98% coverage. * Delete `with tf.Session()` in TensorboardOutput test as a session is created in setUp. * There is a bug in TfTestCase and TfGraphTestVase that leaves dangling tf.Session. tf.Session.close() releases all the resources associated within the session. However, the default session context manage still refers to the session. Thus, when setUp is called next time, it creates another session. As a result, the graph is nested. And when tests.garage.experiment.test_snapshit.reset_tf() is called, it only exits the most nestted session. Then it calls tf.reset_default_graph() and raises error because the graph is still nested. An easy fix would be adding `self.sess.__exit__()` to TfTestCase.tearDown(). However, it gets mixed up with LocalRunner. When we pass a `self.sess` to LocalTfRunner, LocalTfRunner will set the sess as the default session. And delete it when LocalTfRunner exits. Then we can't call `self.sess.__exit__()` anymore as it has already been deleted. To fix this, I assume that we always use LocalTfRunner along with the with statement, and I used an if check to decide whether call `self.sess.__exit__()` or not.
1006a68 to
4df26b8
Compare
| def __init__(self, file_name, with_timestamp=True): | ||
| super().__init__(file_name, 'a') | ||
| self._with_timestamp = with_timestamp | ||
| self._delimiter = " | " |
|
|
||
| def __init__(self, file_name, mode='w'): | ||
| mkdir_p(os.path.dirname(file_name)) | ||
| self._log_file = open(file_name, |
There was a problem hiding this comment.
probably less awkward for the comment to go above this line
Created new logger API & updated all references to use the new system.
Many commits were required to be squashed into 96afc22 for rebasing