srdo commented on a change in pull request #2957: STORM-3335 allow timing out 
when scheduling a topology
URL: https://github.com/apache/storm/pull/2957#discussion_r255294994
 
 

 ##########
 File path: 
storm-server/src/main/java/org/apache/storm/scheduler/resource/ResourceAwareScheduler.java
 ##########
 @@ -136,10 +146,24 @@ private void scheduleTopology(TopologyDetails td, 
Cluster cluster, final User to
             return;
         }
 
+        final IStrategy finalRasStrategy = rasStrategy;
         for (int i = 0; i < maxSchedulingAttempts; i++) {
             SingleTopologyCluster toSchedule = new 
SingleTopologyCluster(workingState, td.getId());
             try {
-                SchedulingResult result = rasStrategy.schedule(toSchedule, td);
+                SchedulingResult result = null;
+                Future<SchedulingResult> schedulingFuture = 
backgroundScheduling.submit(
+                    () -> finalRasStrategy.schedule(toSchedule, td)
+                );
+                try {
+                    result = schedulingFuture.get(schedulingTimeoutSeconds, 
TimeUnit.SECONDS);
+                } catch (TimeoutException te) {
+                    markFailedTopology(topologySubmitter, cluster, td, 
"Scheduling took too long for "
 
 Review comment:
   Nit: Consider referencing the config parameter users should change if they 
want to raise the timeout, so it is obvious what users can do when they get 
this message.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to