001/* 002 * Copyright (c) 2007-2023 The Cascading Authors. All Rights Reserved. 003 * 004 * Project and contact information: https://cascading.wensel.net/ 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.tez.util; 022 023import java.io.IOException; 024import java.util.Iterator; 025import java.util.Set; 026import javax.annotation.Nullable; 027 028import org.apache.hadoop.yarn.api.records.ApplicationId; 029import org.apache.hadoop.yarn.api.records.ApplicationReport; 030import org.apache.tez.client.FrameworkClient; 031import org.apache.tez.dag.api.TezConfiguration; 032import org.apache.tez.dag.api.TezException; 033import org.apache.tez.dag.api.client.DAGClient; 034import org.apache.tez.dag.api.client.DAGStatus; 035import org.apache.tez.dag.api.client.StatusGetOpts; 036import org.apache.tez.dag.api.client.VertexStatus; 037 038/** 039 * TezTimelineClient is currently just a proxy around DAGClient that pretends to 040 * implement TimelineClient (throws errors on all methods). 041 * <p> 042 * When TEZ-3369 is implemented, TezTimelineClient can be replaced by a pure DAGClient usage. Until then, 043 * FlowStats is non-functional. 044 */ 045public class TezTimelineClient extends DAGClient implements TimelineClient 046 { 047 private final String dagId; 048 private final FrameworkClient frameworkClient; 049 private final DAGClient dagClient; 050 051 public TezTimelineClient( ApplicationId appId, String dagId, TezConfiguration conf, FrameworkClient frameworkClient, DAGClient dagClient ) throws TezException 052 { 053 this.dagId = dagId; 054 this.frameworkClient = frameworkClient; 055 this.dagClient = dagClient; 056 } 057 058 public DAGClient getDAGClient() 059 { 060 return dagClient; 061 } 062 063 public FrameworkClient getFrameworkClient() 064 { 065 return frameworkClient; 066 } 067 068 @Override 069 public DAGStatus getDAGStatus( @Nullable Set<StatusGetOpts> statusOptions ) throws IOException, TezException 070 { 071 return dagClient.getDAGStatus( statusOptions ); 072 } 073 074 @Override 075 public DAGStatus getDAGStatus( @Nullable Set<StatusGetOpts> statusOptions, long timeout ) throws IOException, TezException 076 { 077 return dagClient.getDAGStatus( statusOptions, timeout ); 078 } 079 080 @Override 081 public VertexStatus getVertexStatus( String vertexName, Set<StatusGetOpts> statusOptions ) throws IOException, TezException 082 { 083 return dagClient.getVertexStatus( vertexName, statusOptions ); 084 } 085 086 @Override 087 public void tryKillDAG() throws IOException, TezException 088 { 089 dagClient.tryKillDAG(); 090 } 091 092 @Override 093 public DAGStatus waitForCompletion() throws IOException, TezException, InterruptedException 094 { 095 return dagClient.waitForCompletion(); 096 } 097 098 @Override 099 public void close() throws IOException 100 { 101 dagClient.close(); 102 } 103 104 @Override 105 public DAGStatus waitForCompletionWithStatusUpdates( @Nullable Set<StatusGetOpts> statusOpts ) throws IOException, TezException, InterruptedException 106 { 107 return dagClient.waitForCompletionWithStatusUpdates( statusOpts ); 108 } 109 110 @Override 111 public String getWebUIAddress() throws IOException, TezException 112 { 113 return dagClient.getWebUIAddress(); 114 } 115 116 @Override 117 public String getSessionIdentifierString() 118 { 119 return dagClient.getSessionIdentifierString(); 120 } 121 122 @Override 123 public String getDagIdentifierString() 124 { 125 return dagClient.getDagIdentifierString(); 126 } 127 128 @Override 129 public String getExecutionContext() 130 { 131 return dagClient.getExecutionContext(); 132 } 133 134 @Override 135 public String getVertexID( String vertexName ) throws IOException, TezException 136 { 137 throw new TezException( "reporting API is temporarily disabled on TEZ-3369 implementation" ); 138 } 139 140 @Override 141 public Iterator<TaskStatus> getVertexChildren( String vertexID, int limit, String startTaskID ) throws IOException, TezException 142 { 143 throw new TezException( "reporting API is temporarily disabled on TEZ-3369 implementation" ); 144 } 145 146 @Override 147 public TaskStatus getVertexChild( String taskID ) throws TezException 148 { 149 throw new TezException( "reporting API is temporarily disabled on TEZ-3369 implementation" ); 150 } 151 152 @Override 153 protected ApplicationReport getApplicationReportInternal() 154 { 155 return null; // not implemented 156 } 157 158 }