Github user mmiklavc commented on the issue:

    https://github.com/apache/metron/pull/1138
  
    @merrimanr - That's not quite what I suggested - it's still not using the 
common config we pass in
    > Can we add a param for the CLI like 
PcapOptions.PRINT_JOB_STATUS.put(commonConfig, true)
    
    If that monitorAndPrintJob() is a blocking call, it probably belongs in the 
`get()` itself. Rather than creating a one-off custom method invoked by the 
client, we already have configuration facilities for providing these options 
that we use for all other options. e.g. this section 
https://github.com/apache/metron/blob/f17d50fbfed4fd14e5cdd5a718cc973f51d2c4bc/metron-platform/metron-pcap/src/main/java/org/apache/metron/pcap/mr/PcapJob.java#L215
    And then it's just using that property like we use the others.
    
    
https://github.com/apache/metron/blob/f17d50fbfed4fd14e5cdd5a718cc973f51d2c4bc/metron-platform/metron-pcap/src/main/java/org/apache/metron/pcap/mr/PcapJob.java#L464
    ```
    public Pageable<Path> get() throws JobException, InterruptedException {
        if (PcapOptions.PRINT_JOB_STATUS.get(configuration, Boolean.class)) {
            mrJob.monitorAndPrintJob();
        }
        for (; ; ) {
          JobStatus status = getStatus();
          if (status.getState() == State.SUCCEEDED
              || status.getState() == State.KILLED
              || status.getState() == State.FAILED) {
            return getFinalResults();
          }
          Thread.sleep(completeCheckInterval);
        }
      }
    ```
    
    The only reservation I have about the monitorAndPrintJob (versus using the 
pcapjob's TimerTask method) is that users cannot print status in a non-blocking 
way. Honestly I don't see a circumstance where you would do that with stdout 
anyhow. It's through pcapcli, where we want the process to return only after 
fully completing, so I think this is fine.


---

Reply via email to