mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 07:34:30 +08:00
[tune] Reduce the times for flushing json object to file (#4198)
<!-- Thank you for your contribution! Please review https://github.com/ray-project/ray/blob/master/CONTRIBUTING.rst before opening a pull request. --> ## What do these changes do? <!-- Please give a short brief about these changes. --> When we write one result using JsonLogger, it will call 'flush' many times, which may cost a lot of time when writing to a remote distributed filesystem. ## Related issue number #4197 <!-- Are there any issues opened that will be resolved by merging this change? -->
This commit is contained in:
@@ -90,10 +90,10 @@ class JsonLogger(Logger):
|
||||
def on_result(self, result):
|
||||
json.dump(result, self, cls=_SafeFallbackEncoder)
|
||||
self.write("\n")
|
||||
self.local_out.flush()
|
||||
|
||||
def write(self, b):
|
||||
self.local_out.write(b)
|
||||
self.local_out.flush()
|
||||
|
||||
def flush(self):
|
||||
self.local_out.flush()
|
||||
|
||||
Reference in New Issue
Block a user