doctording edited a comment on issue #8735: com.sun.jersey.api.MessageException 
when set worker select strategy of javascript 
URL: 
https://github.com/apache/incubator-druid/issues/8735#issuecomment-546303340
 
 
   post data like this is not ok, also when function is not right
   ```java
   {
       "selectStrategy": {
           "type": "javascript"
       }
   }
   ```
   but like this is ok
   
   ```java
   {
       "selectStrategy": {
           "type": "javascript",
           "function": "function (config, zkWorkers, task) {\nvar batch_workers 
= new java.util.ArrayList();\nbatch_workers.add(\"localhost:8091\");\nworkers = 
zkWorkers.keySet().toArray();\nvar sortedWorkers = new Array()\n;for(var i = 0; 
i < workers.length; i++){\n sortedWorkers[i] = 
workers[i];\n}\nArray.prototype.sort.call(sortedWorkers,function(a, b){return 
zkWorkers.get(b).getCurrCapacityUsed() - 
zkWorkers.get(a).getCurrCapacityUsed();});\nvar minWorkerVer = 
config.getMinWorkerVersion();\nfor (var i = 0; i < sortedWorkers.length; i++) 
{\n var worker = sortedWorkers[i];\n  var zkWorker = zkWorkers.get(worker);\n  
if(zkWorker.canRunTask(task) && zkWorker.isValidVersion(minWorkerVer)){\n    
if(task.getType() == 'index_hadoop' && batch_workers.contains(worker)){\n      
return worker;\n    } else {\n      if(task.getType() != 'index_hadoop' && 
!batch_workers.contains(worker)){\n        return worker;\n      }\n    }\n  
}\n}\nreturn null;\n}"
       }
   }
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to