flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From StephanEwen <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-2292][FLINK-1573] add live per-task acc...
Date Thu, 09 Jul 2015 16:44:24 GMT
Github user StephanEwen commented on the pull request:

    https://github.com/apache/flink/pull/896#issuecomment-120065197
  
    This pattern seems to repeat in many places:
    ```java
    AccumulatorRegistry accumulatorRegistry = getEnvironment().getAccumulatorRegistry();
    AccumulatorRegistry.Internal internalRegistry = accumulatorRegistry.getInternal();
    this.recordsOutCounter = internalRegistry.createLongCounter(AccumulatorRegistry.Internal.NUM_RECORDS_OUT);
    this.bytesOutCounter = internalRegistry.createLongCounter(AccumulatorRegistry.Internal.NUM_BYTES_OUT);
    
    AccumulatorRegistry.External externalRegistry = accumulatorRegistry.getExternal();
    this.accumulatorMap = new HashMap<String, Accumulator<?, ?>>();
    externalRegistry.setMap(this.accumulatorMap);
    ```
    
    I think the code would be simpler is the registry simply always had a created map for
internal and external accumulators. Also, a "reporter" object would help. The code would then
look like:
    ```java
    AccumulatorRegistry accumulatos = getEnvironment().getAccumulatorRegistry();
    ReadWriteReporter reporter = accumulatos.getReadWriteReporter();
    writer.setStatsReporter(reporter);
    this.accumulatorMap = accumulatos.getUserMap();
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message