Skip to content

Commit dcb1ad2

Browse files
committed
Merge pull request Netflix#530 from claymccoy/showSwfTasksOnClusterPage
Cluster screen should show cached SWF tasks too.
2 parents fb7fad7 + 26c59f9 commit dcb1ad2

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

grails-app/services/com/netflix/asgard/TaskService.groovy

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,22 @@ class TaskService {
206206
}.flatten() as List<Task>
207207
}
208208

209+
/**
210+
* @return a single concatenated list of all locally cached running tasks (without tasks on other Asgard servers)
211+
*/
212+
List<Task> getAllRunningInCache() {
213+
localRunningInMemory + allRunningInSwf
214+
}
215+
216+
/**
217+
* @return a list of all running tasks from the AWS Simple Workflow Service
218+
*/
219+
List<Task> getAllRunningInSwf() {
220+
awsSimpleWorkflowService.openWorkflowExecutions.collect {
221+
new WorkflowExecutionBeanOptions(it).asTask()
222+
}
223+
}
224+
209225
/**
210226
* @return a single concatenated list of all in-memory running tasks from the local and all the remote servers
211227
*/
@@ -214,12 +230,10 @@ class TaskService {
214230
}
215231

216232
/**
217-
* @return all running tasks including local and remote in-memory tasks, and SWF workflow executions
233+
* @return all running tasks including local and remote in-memory tasks, and cached SWF workflow executions
218234
*/
219235
Collection<Task> getAllRunning() {
220-
allRunningInMemory + awsSimpleWorkflowService.openWorkflowExecutions.collect {
221-
new WorkflowExecutionBeanOptions(it).asTask()
222-
}
236+
allRunningInMemory + allRunningInSwf
223237
}
224238

225239
/**
@@ -298,13 +312,12 @@ class TaskService {
298312

299313
Collection<Task> getRunningTasksByObject(Link link, Region region) {
300314
Closure matcher = { it.objectType == link.type && it.objectId == link.id && it.userContext.region == region }
301-
302-
// This is incomplete because it should include SWF tasks, as well as tasks running on other Asgard instances.
315+
// This is incomplete because it should include tasks running on other Asgard instances.
303316
// The cluster screen uses this, so changing it to call remote Asgard instances would impact performance of the
304-
// cluster screen. Calling SWF would probably still be a good idea here. To solve the performance problem of
305-
// the remote Asgard instances, either cache the running tasks of remote Asgards, or refactor all long-running
306-
// tasks into SWF workflows so the need to call remote Asgards for in-memory task lists goes away.
307-
running.findAll(matcher).sort { it.startTime }
317+
// cluster screen. To solve the performance problem of the remote Asgard instances, either cache the running
318+
// tasks of remote Asgards, or refactor all long-running tasks into SWF workflows so the need to call remote
319+
// Asgards for in-memory task lists goes away.
320+
allRunningInCache.findAll(matcher).sort { it.startTime }
308321
}
309322

310323
/**

0 commit comments

Comments
 (0)