Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventFailRequest.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventFailRequest.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventFailRequest.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventFailRequest.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tez.dag.app.dag.event;
+
+import org.apache.tez.engine.records.TezTaskAttemptID;
+
+public class TaskAttemptEventFailRequest extends TaskAttemptEvent {
+
+ private final String message;
+
+ public TaskAttemptEventFailRequest(TezTaskAttemptID id, String message) {
+ super(id, TaskAttemptEventType.TA_FAIL_REQUEST);
+ this.message = message;
+ }
+
+ public String getMessage() {
+ return this.message;
+ }
+}
\ No newline at end of file
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventFailRequest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventKillRequest.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventKillRequest.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventKillRequest.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventKillRequest.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,35 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.tez.dag.app.dag.event;
+
+import org.apache.tez.engine.records.TezTaskAttemptID;
+
+public class TaskAttemptEventKillRequest extends TaskAttemptEvent {
+
+ private final String message;
+
+ public TaskAttemptEventKillRequest(TezTaskAttemptID id, String message) {
+ super(id, TaskAttemptEventType.TA_KILL_REQUEST);
+ this.message = message;
+ }
+
+ public String getMessage() {
+ return this.message;
+ }
+
+}
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventKillRequest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventNodeFailed.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventNodeFailed.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventNodeFailed.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventNodeFailed.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
under
+ * the License.
+ */
+
+package org.apache.tez.dag.app.dag.event;
+
+import org.apache.tez.engine.records.TezTaskAttemptID;
+
+public class TaskAttemptEventNodeFailed extends TaskAttemptEvent {
+
+ private final String message;
+
+ public TaskAttemptEventNodeFailed(TezTaskAttemptID id,
+ String diagMessage) {
+ super(id, TaskAttemptEventType.TA_NODE_FAILED);
+ this.message = diagMessage;
+ }
+
+ public String getDiagnosticInfo() {
+ return this.message;
+ }
+
+}
\ No newline at end of file
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventNodeFailed.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventOutputConsumable.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventOutputConsumable.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventOutputConsumable.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventOutputConsumable.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
under
+ * the License.
+ */
+
+package org.apache.tez.dag.app.dag.event;
+
+import org.apache.tez.engine.records.OutputContext;
+import org.apache.tez.engine.records.TezTaskAttemptID;
+
+public class TaskAttemptEventOutputConsumable extends TaskAttemptEvent {
+
+ private final OutputContext outputContext;
+
+ public TaskAttemptEventOutputConsumable(TezTaskAttemptID id,
+ OutputContext outputContext) {
+ super(id, TaskAttemptEventType.TA_OUTPUT_CONSUMABLE);
+ this.outputContext = outputContext;
+ }
+
+ public OutputContext getOutputContext() {
+ return this.outputContext;
+ }
+}
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventOutputConsumable.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventSchedule.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventSchedule.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventSchedule.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventSchedule.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
under
+ * the License.
+ */
+
+package org.apache.tez.dag.app.dag.event;
+
+import org.apache.hadoop.yarn.api.records.Priority;
+import org.apache.tez.engine.records.TezTaskAttemptID;
+
+
+
+public class TaskAttemptEventSchedule extends TaskAttemptEvent {
+
+ private final Priority priority;
+
+ public TaskAttemptEventSchedule(TezTaskAttemptID id, Priority priority) {
+ super(id, TaskAttemptEventType.TA_SCHEDULE);
+ this.priority = priority;
+ }
+
+ public Priority getPriority() {
+ return this.priority;
+ }
+
+}
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventSchedule.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventStartedRemotely.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventStartedRemotely.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventStartedRemotely.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventStartedRemotely.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,53 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.tez.dag.app.dag.event;
+
+import java.util.Map;
+
+import org.apache.hadoop.yarn.api.records.ApplicationAccessType;
+import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.tez.engine.records.TezTaskAttemptID;
+
+public class TaskAttemptEventStartedRemotely extends TaskAttemptEvent {
+
+ private final ContainerId containerId;
+ // TODO Can appAcls be handled elsewhere ?
+ private final Map<ApplicationAccessType, String> applicationACLs;
+ private final int shufflePort;
+
+ public TaskAttemptEventStartedRemotely(TezTaskAttemptID id, ContainerId
containerId,
+ Map<ApplicationAccessType, String> appAcls, int shufflePort) {
+ super(id, TaskAttemptEventType.TA_STARTED_REMOTELY);
+ this.containerId = containerId;
+ this.applicationACLs = appAcls;
+ this.shufflePort = shufflePort;
+ }
+
+ public ContainerId getContainerId() {
+ return containerId;
+ }
+
+ public Map<ApplicationAccessType, String> getApplicationACLs() {
+ return applicationACLs;
+ }
+
+ public int getShufflePort() {
+ return shufflePort;
+ }
+}
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventStartedRemotely.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventStatusUpdate.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventStatusUpdate.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventStatusUpdate.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventStatusUpdate.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,58 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.tez.dag.app.dag.event;
+
+import java.util.List;
+
+import org.apache.tez.common.counters.TezCounters;
+import org.apache.tez.dag.api.records.TaskAttemptState;
+import org.apache.tez.engine.records.TezTaskAttemptID;
+
+public class TaskAttemptEventStatusUpdate extends TaskAttemptEvent {
+
+ private TaskAttemptStatus reportedTaskAttemptStatus;
+
+ public TaskAttemptEventStatusUpdate(TezTaskAttemptID id,
+ TaskAttemptStatus taskAttemptStatus) {
+ super(id, TaskAttemptEventType.TA_STATUS_UPDATE);
+ this.reportedTaskAttemptStatus = taskAttemptStatus;
+ }
+
+ public TaskAttemptStatus getReportedTaskAttemptStatus() {
+ return reportedTaskAttemptStatus;
+ }
+
+ /**
+ * The internal TaskAttemptStatus object corresponding to remote Task status.
+ *
+ */
+ public static class TaskAttemptStatus {
+ public TezTaskAttemptID id;
+ public float progress;
+ public TezCounters counters;
+ public String stateString;
+ //public Phase phase;
+ public long outputSize;
+ public List<TezTaskAttemptID> fetchFailedMaps;
+ public long mapFinishTime;
+ public long shuffleFinishTime;
+ public long sortFinishTime;
+ public TaskAttemptState taskState;
+ }
+}
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventStatusUpdate.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventType.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventType.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventType.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventType.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,60 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.tez.dag.app.dag.event;
+
+/**
+ * Event types handled by TaskAttempt.
+ */
+public enum TaskAttemptEventType {
+
+//Producer:Task, Speculator
+ TA_SCHEDULE,
+
+//Producer: TaskAttemptListener
+ TA_STARTED_REMOTELY,
+ TA_STATUS_UPDATE,
+ TA_DIAGNOSTICS_UPDATE,
+ TA_OUTPUT_CONSUMABLE, // TODO History event to indicate this ?
+ TA_COMMIT_PENDING,
+ TA_DONE,
+ TA_FAILED,
+ TA_TIMED_OUT,
+
+//Producer: Client
+ TA_FAIL_REQUEST,
+
+//Producer: Client, Scheduler, On speculation.
+ TA_KILL_REQUEST,
+
+//Producer: Container / Scheduler.
+ // Container may be running and is in the process of shutting down.
+ TA_CONTAINER_TERMINATING,
+
+ // Container has shut down.
+ // In reality, the RM considers the container to be complete. Container has
+ // shutdown except for once case - likely when the RM decides to kill the
+ // container. TODO: Document the case.
+ TA_CONTAINER_TERMINATED,
+
+ // The node running the task attempt failed.
+ TA_NODE_FAILED,
+
+//Producer: Job
+ TA_TOO_MANY_FETCH_FAILURES,
+}
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskAttemptEventType.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskEvent.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskEvent.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskEvent.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskEvent.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,40 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.tez.dag.app.dag.event;
+
+import org.apache.hadoop.yarn.event.AbstractEvent;
+import org.apache.tez.engine.records.TezTaskID;
+
+/**
+ * this class encapsulates task related events.
+ *
+ */
+public class TaskEvent extends AbstractEvent<TaskEventType> {
+
+ private TezTaskID taskId;
+
+ public TaskEvent(TezTaskID taskId, TaskEventType type) {
+ super(type);
+ this.taskId = taskId;
+ }
+
+ public TezTaskID getTaskID() {
+ return taskId;
+ }
+}
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskEventTAUpdate.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskEventTAUpdate.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskEventTAUpdate.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskEventTAUpdate.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,36 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.tez.dag.app.dag.event;
+
+import org.apache.tez.engine.records.TezTaskAttemptID;
+
+public class TaskEventTAUpdate extends TaskEvent {
+
+ private TezTaskAttemptID attemptID;
+
+ public TaskEventTAUpdate(TezTaskAttemptID id, TaskEventType type) {
+ super(id.getTaskID(), type);
+ this.attemptID = id;
+ }
+
+ public TezTaskAttemptID getTaskAttemptID() {
+ return attemptID;
+ }
+
+}
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskEventTAUpdate.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskEventType.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskEventType.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskEventType.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskEventType.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,42 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.tez.dag.app.dag.event;
+
+/**
+ * Event types handled by Task.
+ */
+public enum TaskEventType {
+
+ //Producer:Client, Job
+ T_KILL,
+
+ //Producer:Job
+ T_SCHEDULE,
+
+ //Producer:Speculator
+ T_ADD_SPEC_ATTEMPT,
+
+ //Producer:TaskAttempt
+ T_ATTEMPT_LAUNCHED,
+ T_ATTEMPT_OUTPUT_CONSUMABLE,
+ T_ATTEMPT_COMMIT_PENDING,
+ T_ATTEMPT_FAILED,
+ T_ATTEMPT_SUCCEEDED,
+ T_ATTEMPT_KILLED
+}
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/TaskEventType.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEvent.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEvent.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEvent.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEvent.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,40 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.tez.dag.app.dag.event;
+
+import org.apache.hadoop.yarn.event.AbstractEvent;
+import org.apache.tez.engine.records.TezVertexID;
+
+/**
+ * this class encapsulates vertex related events.
+ *
+ */
+public class VertexEvent extends AbstractEvent<VertexEventType> {
+
+ private TezVertexID vertexId;
+
+ public VertexEvent(TezVertexID vertexId, VertexEventType type) {
+ super(type);
+ this.vertexId = vertexId;
+ }
+
+ public TezVertexID getVertexId() {
+ return vertexId;
+ }
+}
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventSourceTaskAttemptCompleted.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventSourceTaskAttemptCompleted.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventSourceTaskAttemptCompleted.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventSourceTaskAttemptCompleted.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,39 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.tez.dag.app.dag.event;
+
+import org.apache.tez.engine.records.TezDependentTaskCompletionEvent;
+import org.apache.tez.engine.records.TezVertexID;
+
+public class VertexEventSourceTaskAttemptCompleted extends VertexEvent {
+
+ private TezDependentTaskCompletionEvent completionEvent;
+
+ public VertexEventSourceTaskAttemptCompleted(
+ TezVertexID targetVertexId,
+ TezDependentTaskCompletionEvent completionEvent) {
+ super(targetVertexId,
+ VertexEventType.V_SOURCE_TASK_ATTEMPT_COMPLETED);
+ this.completionEvent = completionEvent;
+ }
+
+ public TezDependentTaskCompletionEvent getCompletionEvent() {
+ return completionEvent;
+ }
+}
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventSourceTaskAttemptCompleted.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventSourceVertexStarted.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventSourceVertexStarted.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventSourceVertexStarted.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventSourceVertexStarted.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,36 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.tez.dag.app.dag.event;
+
+import org.apache.tez.engine.records.TezVertexID;
+
+public class VertexEventSourceVertexStarted extends VertexEvent {
+
+ int sourceDistanceFromRoot;
+
+ public VertexEventSourceVertexStarted(TezVertexID vertexId,
+ int distanceFromRoot) {
+ super(vertexId, VertexEventType.V_SOURCE_VERTEX_STARTED);
+ this.sourceDistanceFromRoot = distanceFromRoot;
+ }
+
+ public int getSourceDistanceFromRoot() {
+ return sourceDistanceFromRoot;
+ }
+}
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventSourceVertexStarted.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskAttemptCompleted.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskAttemptCompleted.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskAttemptCompleted.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskAttemptCompleted.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,37 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.tez.dag.app.dag.event;
+
+import org.apache.tez.engine.records.TezDependentTaskCompletionEvent;
+
+public class VertexEventTaskAttemptCompleted extends VertexEvent {
+
+ private TezDependentTaskCompletionEvent completionEvent;
+
+ public VertexEventTaskAttemptCompleted(
+ TezDependentTaskCompletionEvent completionEvent) {
+ super(completionEvent.getTaskAttemptID().getTaskID().getVertexID(),
+ VertexEventType.V_TASK_ATTEMPT_COMPLETED);
+ this.completionEvent = completionEvent;
+ }
+
+ public TezDependentTaskCompletionEvent getCompletionEvent() {
+ return completionEvent;
+ }
+}
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskAttemptCompleted.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskAttemptFetchFailure.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskAttemptFetchFailure.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskAttemptFetchFailure.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskAttemptFetchFailure.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,46 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.tez.dag.app.dag.event;
+
+import java.util.List;
+
+import org.apache.tez.engine.records.TezTaskAttemptID;
+
+public class VertexEventTaskAttemptFetchFailure extends VertexEvent {
+
+ private final TezTaskAttemptID target;
+ private final List<TezTaskAttemptID> sources;
+
+ public VertexEventTaskAttemptFetchFailure(TezTaskAttemptID reduce,
+ List<TezTaskAttemptID> maps) {
+ super(
+ reduce.getTaskID().getVertexID(),
+ VertexEventType.V_TASK_ATTEMPT_FETCH_FAILURE);
+ this.target = reduce;
+ this.sources = maps;
+ }
+
+ public List<TezTaskAttemptID> getSources() {
+ return sources;
+ }
+
+ public TezTaskAttemptID getTarget() {
+ return target;
+ }
+
+}
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskAttemptFetchFailure.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskCompleted.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskCompleted.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskCompleted.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskCompleted.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,43 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.tez.dag.app.dag.event;
+
+import org.apache.tez.dag.api.records.TaskState;
+import org.apache.tez.engine.records.TezTaskID;
+
+
+public class VertexEventTaskCompleted extends VertexEvent {
+
+ private TezTaskID taskID;
+ private TaskState taskState;
+
+ public VertexEventTaskCompleted(TezTaskID taskID, TaskState taskState) {
+ super(taskID.getVertexID(), VertexEventType.V_TASK_COMPLETED);
+ this.taskID = taskID;
+ this.taskState = taskState;
+ }
+
+ public TezTaskID getTaskID() {
+ return taskID;
+ }
+
+ public TaskState getState() {
+ return taskState;
+ }
+}
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskCompleted.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskReschedule.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskReschedule.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskReschedule.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskReschedule.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,34 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.tez.dag.app.dag.event;
+
+import org.apache.tez.engine.records.TezTaskID;
+
+public class VertexEventTaskReschedule extends VertexEvent {
+ private TezTaskID taskID;
+
+ public VertexEventTaskReschedule(TezTaskID taskID) {
+ super(taskID.getVertexID(), VertexEventType.V_TASK_RESCHEDULED);
+ this.taskID = taskID;
+ }
+
+ public TezTaskID getTaskID() {
+ return taskID;
+ }
+
+}
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventTaskReschedule.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventType.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventType.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventType.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventType.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,59 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.tez.dag.app.dag.event;
+
+/**
+ * Event types handled by Task.
+ */
+public enum VertexEventType {
+
+ //Producer:Client, Job
+ V_KILL,
+
+ //Producer:Job
+ V_INIT,
+
+ //Producer:Vertex
+ V_COMPLETED,
+ V_START,
+ V_SOURCE_TASK_ATTEMPT_COMPLETED,
+ V_SOURCE_VERTEX_STARTED,
+
+ //Producer:Speculator
+ V_ADD_SPEC_ATTEMPT,
+
+ //Producer:Task
+ V_TASK_COMPLETED,
+ V_TASK_RESCHEDULED,
+ V_TASK_ATTEMPT_COMPLETED,
+
+ V_TASK_LAUNCHED,
+ V_TASK_OUTPUT_CONSUMABLE,
+ V_TASK_FAILED,
+ V_TASK_SUCCEEDED,
+ V_ATTEMPT_KILLED,
+
+ //Producer:TaskAttemptListener
+ V_TASK_ATTEMPT_FETCH_FAILURE,
+
+ //Producer:Any component
+ V_DIAGNOSTIC_UPDATE,
+ INTERNAL_ERROR,
+ V_COUNTER_UPDATE,
+}
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/VertexEventType.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/package-info.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/package-info.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/package-info.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/package-info.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
[email protected]
+package org.apache.tez.dag.app.dag.event;
+import org.apache.hadoop.classification.InterfaceAudience;
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/event/package-info.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/BipartiteSlowStartVertexScheduler.java
URL:
http://svn.apache.org/viewvc/incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/BipartiteSlowStartVertexScheduler.java?rev=1469642&view=auto
==============================================================================
---
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/BipartiteSlowStartVertexScheduler.java
(added)
+++
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/BipartiteSlowStartVertexScheduler.java
Thu Apr 18 23:54:18 2013
@@ -0,0 +1,188 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+package org.apache.tez.dag.app.dag.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tez.dag.api.EdgeProperty;
+import org.apache.tez.dag.api.TezException;
+import org.apache.tez.dag.api.EdgeProperty.ConnectionPattern;
+import org.apache.tez.dag.app.dag.Vertex;
+import org.apache.tez.dag.app.dag.VertexScheduler;
+import org.apache.tez.engine.records.TezTaskAttemptID;
+import org.apache.tez.engine.records.TezTaskID;
+import org.apache.tez.engine.records.TezVertexID;
+
+/**
+ * Starts scheduling tasks when number of completed source tasks crosses
+ * <code>slowStartMinSrcCompletionFraction</code> and schedules all tasks
+ * when <code>slowStartMaxSrcCompletionFraction</code> is reached
+ */
+public class BipartiteSlowStartVertexScheduler implements VertexScheduler {
+
+ private static final Log LOG =
+ LogFactory.getLog(BipartiteSlowStartVertexScheduler.class);
+
+ final Vertex managedVertex;
+ final float slowStartMinSrcCompletionFraction;
+ final float slowStartMaxSrcCompletionFraction;
+
+ int numSourceTasks = 0;
+ int numSourceTasksCompleted = 0;
+ boolean slowStartThresholdReached = false;
+ ArrayList<TezTaskID> pendingTasks;
+ int totalTasksToSchedule = 0;
+ HashMap<TezVertexID, Vertex> bipartiteSources =
+ new HashMap<TezVertexID, Vertex>();
+
+ public BipartiteSlowStartVertexScheduler(Vertex managedVertex,
+ float
slowStartMinSrcCompletionFraction,
+ float
slowStartMaxSrcCompletionFraction) {
+ this.managedVertex = managedVertex;
+ this.slowStartMinSrcCompletionFraction = slowStartMinSrcCompletionFraction;
+ this.slowStartMaxSrcCompletionFraction = slowStartMaxSrcCompletionFraction;
+
+ if(slowStartMinSrcCompletionFraction < 0 ||
+ slowStartMaxSrcCompletionFraction < slowStartMinSrcCompletionFraction) {
+ throw new IllegalArgumentException(
+ "Invalid values for slowStartMinSrcCompletionFraction" +
+ "/slowStartMaxSrcCompletionFraction. Min cannot be < 0 and " +
+ "max cannot be < min.");
+ }
+
+ Map<Vertex, EdgeProperty> inputs = managedVertex.getInputVertices();
+ for(Map.Entry<Vertex, EdgeProperty> entry : inputs.entrySet()) {
+ if(entry.getValue().getConnectionPattern() ==
ConnectionPattern.BIPARTITE) {
+ Vertex vertex = entry.getKey();
+ bipartiteSources.put(vertex.getVertexId(), vertex);
+ }
+ }
+ if(bipartiteSources.isEmpty()) {
+ throw new TezException("Atleast 1 bipartite source should exist");
+ }
+ }
+
+ @Override
+ public void onVertexStarted() {
+ //targetVertex.scheduleTasks(targetVertex.getTasks().keySet());
+ pendingTasks = new ArrayList<TezTaskID>(managedVertex.getTotalTasks());
+ // track the tasks in this vertex
+ pendingTasks.addAll(managedVertex.getTasks().keySet());
+ totalTasksToSchedule = pendingTasks.size();
+
+ // track source vertices
+ for(Vertex vertex : bipartiteSources.values()) {
+ numSourceTasks += vertex.getTotalTasks();
+ }
+
+ LOG.info("OnVertexStarted vertex: " + managedVertex.getVertexId() +
+ " with " + numSourceTasks + " source tasks and " +
+ totalTasksToSchedule + " pending tasks");
+
+ schedulePendingTasks();
+ }
+
+ @Override
+ public void onVertexCompleted() {
+ }
+
+ @Override
+ public void onSourceTaskCompleted(TezTaskAttemptID attemptId) {
+ TezVertexID vertexId = attemptId.getTaskID().getVertexID();
+ if(bipartiteSources.containsKey(vertexId)) {
+ ++numSourceTasksCompleted;
+ schedulePendingTasks();
+ }
+ }
+
+ void schedulePendingTasks(int numTasksToSchedule) {
+ ArrayList<TezTaskID> scheduledTasks = new
ArrayList<TezTaskID>(numTasksToSchedule);
+ while(!pendingTasks.isEmpty() && numTasksToSchedule > 0) {
+ numTasksToSchedule--;
+ scheduledTasks.add(pendingTasks.get(0));
+ pendingTasks.remove(0);
+ }
+ managedVertex.scheduleTasks(scheduledTasks);
+ }
+
+ void schedulePendingTasks() {
+ int numPendingTasks = pendingTasks.size();
+ if (numPendingTasks == 0) {
+ return;
+ }
+
+ if (numSourceTasksCompleted == numSourceTasks && numPendingTasks > 0) {
+ LOG.info("All source tasks assigned. " +
+ "Ramping up " + numPendingTasks +
+ " remaining tasks for vertex: " + managedVertex.getName());
+ schedulePendingTasks(numPendingTasks);
+ return;
+ }
+
+ float completedSourceTaskFraction = 0f;
+ if (numSourceTasks != 0) {//support for 0 source tasks
+ completedSourceTaskFraction =
(float)numSourceTasksCompleted/numSourceTasks;
+ } else {
+ completedSourceTaskFraction = 1;
+ }
+
+ // start scheduling when source tasks completed fraction is more than min.
+ // linearly increase the number of scheduled tasks such that all tasks are
+ // scheduled when source tasks completed fraction reaches max
+ float tasksFractionToSchedule = 1;
+ float percentRange = slowStartMaxSrcCompletionFraction -
+ slowStartMinSrcCompletionFraction;
+ if (percentRange > 0) {
+ tasksFractionToSchedule =
+ (completedSourceTaskFraction - slowStartMinSrcCompletionFraction)/
+ percentRange;
+ } else {
+ // min and max are equal. schedule 100% on reaching min
+ if(completedSourceTaskFraction < slowStartMinSrcCompletionFraction) {
+ tasksFractionToSchedule = 0;
+ }
+ }
+
+ if (tasksFractionToSchedule > 1) {
+ tasksFractionToSchedule = 1;
+ } else if (tasksFractionToSchedule < 0) {
+ tasksFractionToSchedule = 0;
+ }
+
+ int numTasksToSchedule =
+ ((int)(tasksFractionToSchedule * totalTasksToSchedule) -
+ (totalTasksToSchedule - numPendingTasks));
+
+ if (numTasksToSchedule > 0) {
+ // numTasksToSchedule can be -ve if numSourceTasksCompleted does not
+ // does not increase monotonically
+ LOG.info("Scheduling " + numTasksToSchedule + " tasks for vertex: " +
+ managedVertex.getVertexId() + " with totalTasks: " +
+ totalTasksToSchedule + ". " + numSourceTasksCompleted +
+ " source tasks completed out of " + numSourceTasks +
+ ". SourceTaskCompletedFraction: " +
completedSourceTaskFraction);
+ schedulePendingTasks(numTasksToSchedule);
+ }
+ }
+
+}
Propchange:
incubator/tez/branches/TEZ-1/tez-dag/src/main/java/org/apache/tez/dag/app/dag/impl/BipartiteSlowStartVertexScheduler.java
------------------------------------------------------------------------------
svn:eol-style = native