@@ -114,8 +114,7 @@ class EventAccumulator(object):
114114 `Accumulator.Scalars(tag)`) allow for the retrieval of all data
115115 associated with that tag.
116116
117- Before usage, the `EventAccumulator` must be activated via `Reload()`. This
118- method synchronosly loads all of the data written so far.
117+ The `Reload()` method synchronously loads all of the data written so far.
119118
120119 Histograms, audio, and images are very large, so storing all of them is not
121120 recommended.
@@ -175,7 +174,6 @@ def __init__(self,
175174 self ._compression_bps = compression_bps
176175 self .purge_orphaned_data = purge_orphaned_data
177176
178- self ._activated = False
179177 self .most_recent_step = - 1
180178 self .most_recent_wall_time = - 1
181179 self .file_version = None
@@ -188,12 +186,10 @@ def Reload(self):
188186 """Loads all events added since the last call to `Reload`.
189187
190188 If `Reload` was never called, loads all events in the file.
191- Calling `Reload` activates the `EventAccumulator`.
192189
193190 Returns:
194191 The `EventAccumulator`.
195192 """
196- self ._activated = True
197193 with self ._generator_mutex :
198194 for event in self ._generator .Load ():
199195 if event .HasField ('file_version' ):
@@ -232,13 +228,9 @@ def Reload(self):
232228 def Tags (self ):
233229 """Return all tags found in the value stream.
234230
235- Raises:
236- RuntimeError: If the `EventAccumulator` has not been activated.
237-
238231 Returns:
239232 A `{tagType: ['list', 'of', 'tags']}` dictionary.
240233 """
241- self ._VerifyActivated ()
242234 return {IMAGES : self ._images .Keys (),
243235 AUDIO : self ._audio .Keys (),
244236 HISTOGRAMS : self ._histograms .Keys (),
@@ -255,25 +247,21 @@ def Scalars(self, tag):
255247
256248 Raises:
257249 KeyError: If the tag is not found.
258- RuntimeError: If the `EventAccumulator` has not been activated.
259250
260251 Returns:
261252 An array of `ScalarEvent`s.
262253 """
263- self ._VerifyActivated ()
264254 return self ._scalars .Items (tag )
265255
266256 def Graph (self ):
267257 """Return the graph definition, if there is one.
268258
269259 Raises:
270260 ValueError: If there is no graph for this run.
271- RuntimeError: If the `EventAccumulator` has not been activated.
272261
273262 Returns:
274263 The `graph_def` proto.
275264 """
276- self ._VerifyActivated ()
277265 if self ._graph is None :
278266 raise ValueError ('There is no graph in this EventAccumulator' )
279267 graph = graph_pb2 .GraphDef ()
@@ -288,12 +276,10 @@ def RunMetadata(self, tag):
288276
289277 Raises:
290278 ValueError: If the tag is not found.
291- RuntimeError: If the `EventAccumulator` has not been activated.
292279
293280 Returns:
294281 The metadata in form of `RunMetadata` proto.
295282 """
296- self ._VerifyActivated ()
297283 if tag not in self ._tagged_metadata :
298284 raise ValueError ('There is no run metadata with this tag name' )
299285
@@ -309,12 +295,10 @@ def Histograms(self, tag):
309295
310296 Raises:
311297 KeyError: If the tag is not found.
312- RuntimeError: If the `EventAccumulator` has not been activated.
313298
314299 Returns:
315300 An array of `HistogramEvent`s.
316301 """
317- self ._VerifyActivated ()
318302 return self ._histograms .Items (tag )
319303
320304 def CompressedHistograms (self , tag ):
@@ -325,12 +309,10 @@ def CompressedHistograms(self, tag):
325309
326310 Raises:
327311 KeyError: If the tag is not found.
328- RuntimeError: If the `EventAccumulator` has not been activated.
329312
330313 Returns:
331314 An array of `CompressedHistogramEvent`s.
332315 """
333- self ._VerifyActivated ()
334316 return self ._compressed_histograms .Items (tag )
335317
336318 def Images (self , tag ):
@@ -341,12 +323,10 @@ def Images(self, tag):
341323
342324 Raises:
343325 KeyError: If the tag is not found.
344- RuntimeError: If the `EventAccumulator` has not been activated.
345326
346327 Returns:
347328 An array of `ImageEvent`s.
348329 """
349- self ._VerifyActivated ()
350330 return self ._images .Items (tag )
351331
352332 def Audio (self , tag ):
@@ -357,12 +337,10 @@ def Audio(self, tag):
357337
358338 Raises:
359339 KeyError: If the tag is not found.
360- RuntimeError: If the `EventAccumulator` has not been activated.
361340
362341 Returns:
363342 An array of `AudioEvent`s.
364343 """
365- self ._VerifyActivated ()
366344 return self ._audio .Items (tag )
367345
368346 def _MaybePurgeOrphanedData (self , event ):
@@ -599,10 +577,6 @@ def _ExpiredPerTag(value):
599577 event .wall_time , * expired_per_type )
600578 logging .warn (purge_msg )
601579
602- def _VerifyActivated (self ):
603- if not self ._activated :
604- raise RuntimeError ('Accumulator must be activated before it may be used.' )
605-
606580
607581def _GetPurgeMessage (most_recent_step , most_recent_wall_time , event_step ,
608582 event_wall_time , num_expired_scalars , num_expired_histos ,
0 commit comments