001/** 002 * Autogenerated by Avro 003 * 004 * DO NOT EDIT DIRECTLY 005 */ 006package org.apache.reef.io.watcher.driver.task; 007@SuppressWarnings("all") 008@org.apache.avro.specific.AvroGenerated 009public class AvroFailedTask extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { 010 public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroFailedTask\",\"namespace\":\"org.apache.reef.io.watcher.driver.task\",\"fields\":[{\"name\":\"failure\",\"type\":{\"type\":\"record\",\"name\":\"AvroFailure\",\"namespace\":\"org.apache.reef.io.watcher.common\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"message\",\"type\":\"string\"},{\"name\":\"description\",\"type\":[\"string\",\"null\"]},{\"name\":\"reason\",\"type\":[\"string\",\"null\"]},{\"name\":\"data\",\"type\":[\"bytes\",\"null\"]},{\"name\":\"asError\",\"type\":\"string\"}]}},{\"name\":\"activeContext\",\"type\":[{\"type\":\"record\",\"name\":\"AvroActiveContext\",\"namespace\":\"org.apache.reef.io.watcher.driver.context\",\"fields\":[{\"name\":\"base\",\"type\":{\"type\":\"record\",\"name\":\"AvroContextBase\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"evaluatorId\",\"type\":\"string\"},{\"name\":\"parentId\",\"type\":[\"string\",\"null\"]},{\"name\":\"evaluatorDescriptor\",\"type\":[{\"type\":\"record\",\"name\":\"AvroEvaluatorDescriptor\",\"namespace\":\"org.apache.reef.io.watcher.driver.evaluator\",\"fields\":[{\"name\":\"nodeDescriptor\",\"type\":{\"type\":\"record\",\"name\":\"AvroNodeDescriptor\",\"namespace\":\"org.apache.reef.io.watcher.driver.catalog\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"inetSocketAddress\",\"type\":\"string\"},{\"name\":\"rackDescriptor\",\"type\":{\"type\":\"record\",\"name\":\"AvroRackDescriptor\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"nodes\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"AvroNodeDescriptorInRackDescriptor\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"inetSocketAddress\",\"type\":\"string\"}]}}}]}}]}},{\"name\":\"process\",\"type\":{\"type\":\"record\",\"name\":\"AvroEvaluatorProcess\",\"fields\":[{\"name\":\"commandLines\",\"type\":{\"type\":\"array\",\"items\":[\"string\",\"null\"]}},{\"name\":\"evaluatorType\",\"type\":{\"type\":\"enum\",\"name\":\"AvroEvaluatorType\",\"symbols\":[\"JVM\",\"CLR\",\"UNDECIDED\"]}},{\"name\":\"isOptionSet\",\"type\":\"boolean\"}]}},{\"name\":\"memory\",\"type\":\"int\"},{\"name\":\"numberOfCores\",\"type\":\"int\"}]},\"null\"]}]}}]},\"null\"]}]}"); 011 public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } 012 @Deprecated public org.apache.reef.io.watcher.common.AvroFailure failure; 013 @Deprecated public org.apache.reef.io.watcher.driver.context.AvroActiveContext activeContext; 014 015 /** 016 * Default constructor. Note that this does not initialize fields 017 * to their default values from the schema. If that is desired then 018 * one should use <code>newBuilder()</code>. 019 */ 020 public AvroFailedTask() {} 021 022 /** 023 * All-args constructor. 024 */ 025 public AvroFailedTask(org.apache.reef.io.watcher.common.AvroFailure failure, org.apache.reef.io.watcher.driver.context.AvroActiveContext activeContext) { 026 this.failure = failure; 027 this.activeContext = activeContext; 028 } 029 030 public org.apache.avro.Schema getSchema() { return SCHEMA$; } 031 // Used by DatumWriter. Applications should not call. 032 public java.lang.Object get(int field$) { 033 switch (field$) { 034 case 0: return failure; 035 case 1: return activeContext; 036 default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 037 } 038 } 039 // Used by DatumReader. Applications should not call. 040 @SuppressWarnings(value="unchecked") 041 public void put(int field$, java.lang.Object value$) { 042 switch (field$) { 043 case 0: failure = (org.apache.reef.io.watcher.common.AvroFailure)value$; break; 044 case 1: activeContext = (org.apache.reef.io.watcher.driver.context.AvroActiveContext)value$; break; 045 default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 046 } 047 } 048 049 /** 050 * Gets the value of the 'failure' field. 051 */ 052 public org.apache.reef.io.watcher.common.AvroFailure getFailure() { 053 return failure; 054 } 055 056 /** 057 * Sets the value of the 'failure' field. 058 * @param value the value to set. 059 */ 060 public void setFailure(org.apache.reef.io.watcher.common.AvroFailure value) { 061 this.failure = value; 062 } 063 064 /** 065 * Gets the value of the 'activeContext' field. 066 */ 067 public org.apache.reef.io.watcher.driver.context.AvroActiveContext getActiveContext() { 068 return activeContext; 069 } 070 071 /** 072 * Sets the value of the 'activeContext' field. 073 * @param value the value to set. 074 */ 075 public void setActiveContext(org.apache.reef.io.watcher.driver.context.AvroActiveContext value) { 076 this.activeContext = value; 077 } 078 079 /** Creates a new AvroFailedTask RecordBuilder */ 080 public static org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder newBuilder() { 081 return new org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder(); 082 } 083 084 /** Creates a new AvroFailedTask RecordBuilder by copying an existing Builder */ 085 public static org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder newBuilder(org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder other) { 086 return new org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder(other); 087 } 088 089 /** Creates a new AvroFailedTask RecordBuilder by copying an existing AvroFailedTask instance */ 090 public static org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder newBuilder(org.apache.reef.io.watcher.driver.task.AvroFailedTask other) { 091 return new org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder(other); 092 } 093 094 /** 095 * RecordBuilder for AvroFailedTask instances. 096 */ 097 public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroFailedTask> 098 implements org.apache.avro.data.RecordBuilder<AvroFailedTask> { 099 100 private org.apache.reef.io.watcher.common.AvroFailure failure; 101 private org.apache.reef.io.watcher.driver.context.AvroActiveContext activeContext; 102 103 /** Creates a new Builder */ 104 private Builder() { 105 super(org.apache.reef.io.watcher.driver.task.AvroFailedTask.SCHEMA$); 106 } 107 108 /** Creates a Builder by copying an existing Builder */ 109 private Builder(org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder other) { 110 super(other); 111 if (isValidValue(fields()[0], other.failure)) { 112 this.failure = data().deepCopy(fields()[0].schema(), other.failure); 113 fieldSetFlags()[0] = true; 114 } 115 if (isValidValue(fields()[1], other.activeContext)) { 116 this.activeContext = data().deepCopy(fields()[1].schema(), other.activeContext); 117 fieldSetFlags()[1] = true; 118 } 119 } 120 121 /** Creates a Builder by copying an existing AvroFailedTask instance */ 122 private Builder(org.apache.reef.io.watcher.driver.task.AvroFailedTask other) { 123 super(org.apache.reef.io.watcher.driver.task.AvroFailedTask.SCHEMA$); 124 if (isValidValue(fields()[0], other.failure)) { 125 this.failure = data().deepCopy(fields()[0].schema(), other.failure); 126 fieldSetFlags()[0] = true; 127 } 128 if (isValidValue(fields()[1], other.activeContext)) { 129 this.activeContext = data().deepCopy(fields()[1].schema(), other.activeContext); 130 fieldSetFlags()[1] = true; 131 } 132 } 133 134 /** Gets the value of the 'failure' field */ 135 public org.apache.reef.io.watcher.common.AvroFailure getFailure() { 136 return failure; 137 } 138 139 /** Sets the value of the 'failure' field */ 140 public org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder setFailure(org.apache.reef.io.watcher.common.AvroFailure value) { 141 validate(fields()[0], value); 142 this.failure = value; 143 fieldSetFlags()[0] = true; 144 return this; 145 } 146 147 /** Checks whether the 'failure' field has been set */ 148 public boolean hasFailure() { 149 return fieldSetFlags()[0]; 150 } 151 152 /** Clears the value of the 'failure' field */ 153 public org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder clearFailure() { 154 failure = null; 155 fieldSetFlags()[0] = false; 156 return this; 157 } 158 159 /** Gets the value of the 'activeContext' field */ 160 public org.apache.reef.io.watcher.driver.context.AvroActiveContext getActiveContext() { 161 return activeContext; 162 } 163 164 /** Sets the value of the 'activeContext' field */ 165 public org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder setActiveContext(org.apache.reef.io.watcher.driver.context.AvroActiveContext value) { 166 validate(fields()[1], value); 167 this.activeContext = value; 168 fieldSetFlags()[1] = true; 169 return this; 170 } 171 172 /** Checks whether the 'activeContext' field has been set */ 173 public boolean hasActiveContext() { 174 return fieldSetFlags()[1]; 175 } 176 177 /** Clears the value of the 'activeContext' field */ 178 public org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder clearActiveContext() { 179 activeContext = null; 180 fieldSetFlags()[1] = false; 181 return this; 182 } 183 184 @Override 185 public AvroFailedTask build() { 186 try { 187 AvroFailedTask record = new AvroFailedTask(); 188 record.failure = fieldSetFlags()[0] ? this.failure : (org.apache.reef.io.watcher.common.AvroFailure) defaultValue(fields()[0]); 189 record.activeContext = fieldSetFlags()[1] ? this.activeContext : (org.apache.reef.io.watcher.driver.context.AvroActiveContext) defaultValue(fields()[1]); 190 return record; 191 } catch (Exception e) { 192 throw new org.apache.avro.AvroRuntimeException(e); 193 } 194 } 195 } 196}