001/* 002 * Copyright (c) 2007-2015 Concurrent, Inc. All Rights Reserved. 003 * 004 * Project and contact information: http://www.cascading.org/ 005 * 006 * This file is part of the Cascading project. 007 * 008 * Licensed under the Apache License, Version 2.0 (the "License"); 009 * you may not use this file except in compliance with the License. 010 * You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, software 015 * distributed under the License is distributed on an "AS IS" BASIS, 016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 017 * See the License for the specific language governing permissions and 018 * limitations under the License. 019 */ 020 021package cascading.stats; 022 023import java.util.Map; 024 025/** 026 * Typically CascadingStats objects have an internal state model with timings, the FlowSliceStats is a simplified 027 * Stats object and only reports what the underlying platform reports, not the client side observations. 028 * <p/> 029 * Implementations may optionally implement the {@link cascading.stats.ProvidesCounters} interface. 030 * <p/> 031 * Provided as an abstract class so that implementations will be resilient to API additions. 032 * <p/> 033 * <p/> 034 * <ul> 035 * <li>pendingTime - when the slice is created</li> 036 * <li>startTime - when the slice was told to begin work</li> 037 * <li>submitTime - when the slice was submitted to a work queue</li> 038 * <li>runTime - when work began</li> 039 * <li>finishedTime - when work ended</li> 040 * </ul> 041 * <p/> 042 * pending is mostly irrelevant and unavailable, start, submit, and runtime are by default synonymous at the slice level 043 */ 044public abstract class FlowSliceStats<K extends Enum> 045 { 046 public abstract static class FlowSliceAttempt 047 { 048 public abstract String getProcessAttemptID(); 049 050 public abstract int getEventId(); 051 052 public abstract int getProcessDuration(); 053 054 public abstract String getProcessStatus(); 055 056 public abstract String getStatusURL(); 057 058 public abstract CascadingStats.Status getStatus(); 059 } 060 061 public abstract String getID(); 062 063 public long getProcessPendingTime() 064 { 065 return -1; 066 } 067 068 public abstract long getProcessStartTime(); 069 070 public long getProcessSubmitTime() 071 { 072 return getProcessStartTime(); 073 } 074 075 public long getProcessRunTime() 076 { 077 return getProcessStartTime(); 078 } 079 080 public abstract long getProcessFinishTime(); 081 082 public abstract CascadingStats.Status getStatus(); 083 084 public abstract K getKind(); 085 086 public abstract String getProcessSliceID(); 087 088 public abstract String getProcessStepID(); 089 090 public abstract String getProcessStatus(); 091 092 public abstract float getProcessProgress(); 093 094 public abstract String[] getDiagnostics(); 095 096 public abstract Map<String, Map<String, Long>> getCounters(); 097 098 public abstract Map<Integer, FlowSliceAttempt> getAttempts(); 099 }