You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by dm...@apache.org on 2017/10/26 20:37:30 UTC

aurora git commit: Do not fetch neighbor tasks if no active task

Repository: aurora
Updated Branches:
  refs/heads/master 1d386a32e -> 875a3126b


Do not fetch neighbor tasks if no active task

Reviewed at https://reviews.apache.org/r/63333/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/875a3126
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/875a3126
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/875a3126

Branch: refs/heads/master
Commit: 875a3126b7350035a98ad227221b598786407ff2
Parents: 1d386a3
Author: David McLaughlin <da...@dmclaughlin.com>
Authored: Thu Oct 26 13:37:12 2017 -0700
Committer: David McLaughlin <da...@dmclaughlin.com>
Committed: Thu Oct 26 13:37:12 2017 -0700

----------------------------------------------------------------------
 ui/src/main/js/pages/Instance.js | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/875a3126/ui/src/main/js/pages/Instance.js
----------------------------------------------------------------------
diff --git a/ui/src/main/js/pages/Instance.js b/ui/src/main/js/pages/Instance.js
index 2979b3c..3c22dba 100644
--- a/ui/src/main/js/pages/Instance.js
+++ b/ui/src/main/js/pages/Instance.js
@@ -6,6 +6,7 @@ import InstanceHistory from 'components/InstanceHistory';
 import Loading from 'components/Loading';
 import TaskStatus from 'components/TaskStatus';
 
+import { isNully } from 'utils/Common';
 import { isActive } from 'utils/Task';
 
 export default class Instance extends React.Component {
@@ -44,19 +45,21 @@ export default class Instance extends React.Component {
     if (this.state.loading && !nextState.loading) {
       const activeTask = nextState.tasks.find(isActive);
 
-      const query = new TaskQuery();
-      query.statuses = [ScheduleStatus.RUNNING];
-      query.slaveHosts = [activeTask.assignedTask.slaveHost];
+      if (!isNully(activeTask)) {
+        const query = new TaskQuery();
+        query.statuses = [ScheduleStatus.RUNNING];
+        query.slaveHosts = [activeTask.assignedTask.slaveHost];
 
-      const that = this;
-      this.props.api.getTasksWithoutConfigs(query, (rsp) => {
-        const tasksOnAgent = rsp.result.scheduleStatusResult.tasks;
-        that.setState({
-          neighborTasks: tasksOnAgent.filter(function (el) {
-            return el.assignedTask.taskId !== activeTask.assignedTask.taskId;
-          })
+        const that = this;
+        this.props.api.getTasksWithoutConfigs(query, (rsp) => {
+          const tasksOnAgent = rsp.result.scheduleStatusResult.tasks;
+          that.setState({
+            neighborTasks: tasksOnAgent.filter(function (el) {
+              return el.assignedTask.taskId !== activeTask.assignedTask.taskId;
+            })
+          });
         });
-      });
+      }
     }
 
     if (!deepEqual(this.props.match.params, nextProps.match.params)) {