Uh oh!
There was an error while loading. Please reload this page.
[STORM-2201] Add dynamic scheduler configuration loading. - #1785
[STORM-2201] Add dynamic scheduler configuration loading.#1785ppoulosk wants to merge 4 commits into
Conversation
revans2
left a comment
There was a problem hiding this comment.
Overall it looks good, and it is nice to have the option to load data dynamically from a central location for resource management.
Needs documentation and possibly a bit of refactoring.
It would also be really nice (and can be in a follow on JIRA) to have a loader that can just point to a single URL on an HTTP server. In place update instead of needing to list the directory in artifactory.
| * A plugin that should load the user pools for the resource aware scheduler | ||
| */ | ||
| @isString | ||
| public static final String RESOURCE_AWARE_SCHEDULER_USER_POOLS_LOADER = "resource.aware.scheduler.user.pools.loader"; |
There was a problem hiding this comment.
If this is intended to be a subclass of something, it might be good to use @ isImplementationOfClass instead of @isString
There was a problem hiding this comment.
Specifically @isImplementationOfClass(implementsClass = org.apache.storm.scheduler.utils.IConfigLoader.class)
There was a problem hiding this comment.
Yup that is what @isImplementationOfClass is for. We should use it
| if (ret != null) { | ||
| return ret; | ||
| } else { | ||
| LOG.debug("Config loader returned null"); |
There was a problem hiding this comment.
Should this be a warn instead of a debug?
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
| public class ArtifactoryConfigLoader implements IConfigLoader { |
There was a problem hiding this comment.
Could you add some javadocs here? and add something to the docs to describe this new feature, how it works and how to use it?
| private int _timeoutSeconds = 10; | ||
| private Map _lastReturnedValue; | ||
| private static class OurResponseHandler implements ResponseHandler<String> { |
There was a problem hiding this comment.
Perhaps we can name this a bit better. It appears to validate that the response code was in the 2xx range and then convert the body to a string. Maybe GETStringResponseHandler would be better?
| if (api != null) { | ||
| builder.setPath(_baseDirectory + api + artifact); | ||
| } else { | ||
| builder.setPath(_baseDirectory + artifact); |
There was a problem hiding this comment.
Do we want to filter out double back slashes? "//". If I remember correctly I think I have had issues with artifactory and too many / characters, almost like it is running jetty behind the scenes.
There was a problem hiding this comment.
If we filter out double backslashes we can also add in extra ones to be sure we have a slash between api and artifact instead of just assuming there is one.
| */ | ||
| void prepare(Map conf); | ||
| Map load(); |
There was a problem hiding this comment.
Can we make this at least a little generic? Something like Map<?,?> instead of just Map
| * | ||
| * See implementing classes for configuration details. | ||
| */ | ||
| void prepare(Map conf); |
There was a problem hiding this comment.
For conf can be please add the generics? Map<String, Object>
| return null; | ||
| } | ||
| public static Map loadYamlFromFile(File file) { |
There was a problem hiding this comment.
Can we please add is some generics to the Map.
There was a problem hiding this comment.
Can we also add in some javadocs or possibly change the name? It is not obvious from the name or really anything else that it will eat exceptions and return null.
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
| public class SchedulerUtils { |
There was a problem hiding this comment.
Now that we are on java 8 it might be good to move these static methods into the IConfigLoader interface. in java 8 static methods can be part of an interface.
ppoulosk
commented
Dec 5, 2016
@revans2, Thanks for the review. I've merged in a commit to fix the issues you have pointed out. |
abellina
commented
Dec 14, 2016
ppoulosk
commented
Dec 16, 2016
Markdown added for interface and describing the configuration of implementations. |
abellina
commented
Dec 16, 2016
thanks @ppoulosk, will do another pass today. |
ppoulosk
commented
Jan 6, 2017
revans2
left a comment
There was a problem hiding this comment.
Overall it looks good, I have one minor comment about some wording in the documentation.
| ### Introduction | ||
| IConfigLoader is an interface designed to allow way to dynamically load scheduler resource constraints into scheduler implementations. Currently, the MultiTenant scheduler uses this interface to dynamically load the number of isolated nodes a given user has been guaranteed, and the ResoureAwareScheduler uses the interface to dynamically load per user resource guarantees. |
There was a problem hiding this comment.
Perhaps "designed to allow dynamic loading of scheduler resource constraints"
There was a problem hiding this comment.
Much better wording. Thanks.
| <java_jmx.version>0.3.1</java_jmx.version> | ||
| <compojure.version>1.1.9</compojure.version> | ||
| <hiccup.version>0.3.6</hiccup.version> | ||
| <commons-logging.version>1.2</commons-logging.version> |
There was a problem hiding this comment.
why are we adding commons-logging? I think I am missing something.
| if (raw != null) { | ||
| for (Map.Entry<String, Map<String, Number>> userPoolEntry : ((Map<String, Map<String, Number>>) raw).entrySet()) { | ||
| for (Map.Entry<String, Map<String, Number>> userPoolEntry : raw.entrySet()) { |
| String path = null; | ||
| if (api != null) { | ||
| path = _baseDirectory + "/" + api + "/" + artifact; |
There was a problem hiding this comment.
instead of "/" here I'd use the .path method in URIBuilder to build up the path.
There was a problem hiding this comment.
there is no .path method in URIbuilder. It's in javax.ws.rs.core.UriBuilder, which isn't pulled into storm anywhere. I'd prefer to leave it as it, but will change and pull in new UriBuilder class if there is a consensus to do so. @revans2?
| } | ||
| // Get rid of multiple '/' in url | ||
| path = path.replaceAll("/[/]+", "/"); |
There was a problem hiding this comment.
if you do above, you may not need this one.
HeartSaVioR
commented
Mar 8, 2017
ppoulosk
commented
Mar 8, 2017
Will get to this today or tomorrow. Sorry this slipped off of my radar. |
two implementations, one that will load from a local file, and another that will load a config from artifactory. Merge pull request apache#807 from ppoulosk/YSTORM-3095-redux [YSTORM-3095] [YSTORM-3779] Re-merge and fix Artifactory scheduler plugins Move to org.apache
HeartSaVioR
commented
Jul 10, 2017
@ppoulosk Any updates? |
Ethanlm
commented
Jul 10, 2017
@HeartSaVioR I am willing to do it but I will need to ask @revans2 for his opinion. Thanks |
Ethanlm
commented
Jul 10, 2017
@HeartSaVioR I asked @revans2 . I will start to do it. |
Ethanlm
commented
Jul 10, 2017
I copied the code and submitted a new pull request. Also fixed some checkstyle issues. #2199 |
We are closing stale Pull Requests to make the list more manageable. Please re-open any Pull Request that has been closed in error. Closesapache#608Closesapache#639Closesapache#640Closesapache#648Closesapache#662Closesapache#668Closesapache#692Closesapache#705Closesapache#724Closesapache#728Closesapache#730Closesapache#753Closesapache#803Closesapache#854Closesapache#922Closesapache#986Closesapache#992Closesapache#1019Closesapache#1040Closesapache#1041Closesapache#1043Closesapache#1046Closesapache#1051Closesapache#1078Closesapache#1146Closesapache#1164Closesapache#1165Closesapache#1178Closesapache#1213Closesapache#1225Closesapache#1258Closesapache#1259Closesapache#1268Closesapache#1272Closesapache#1277Closesapache#1278Closesapache#1288Closesapache#1296Closesapache#1328Closesapache#1342Closesapache#1353Closesapache#1370Closesapache#1376Closesapache#1391Closesapache#1395Closesapache#1399Closesapache#1406Closesapache#1410Closesapache#1422Closesapache#1427Closesapache#1443Closesapache#1462Closesapache#1468Closesapache#1483Closesapache#1506Closesapache#1509Closesapache#1515Closesapache#1520Closesapache#1521Closesapache#1525Closesapache#1527Closesapache#1544Closesapache#1550Closesapache#1566Closesapache#1569Closesapache#1570Closesapache#1575Closesapache#1580Closesapache#1584Closesapache#1591Closesapache#1600Closesapache#1611Closesapache#1613Closesapache#1639Closesapache#1703Closesapache#1711Closesapache#1719Closesapache#1737Closesapache#1760Closesapache#1767Closesapache#1768Closesapache#1785Closesapache#1799Closesapache#1822Closesapache#1824Closesapache#1844Closesapache#1874Closesapache#1918Closesapache#1928Closesapache#1937Closesapache#1942Closesapache#1951Closesapache#1957Closesapache#1963Closesapache#1964Closesapache#1965Closesapache#1967Closesapache#1968Closesapache#1971Closesapache#1985Closesapache#1986Closesapache#1998Closesapache#2031Closesapache#2032Closesapache#2071Closesapache#2076Closesapache#2108Closesapache#2119Closesapache#2128Closesapache#2142Closesapache#2174Closesapache#2206Closesapache#2297Closesapache#2322Closesapache#2332Closesapache#2341Closesapache#2377Closesapache#2414Closesapache#2469
We are closing stale Pull Requests to make the list more manageable. Please re-open any Pull Request that has been closed in error. Closesapache#608Closesapache#639Closesapache#640Closesapache#648Closesapache#662Closesapache#668Closesapache#692Closesapache#705Closesapache#724Closesapache#728Closesapache#730Closesapache#753Closesapache#803Closesapache#854Closesapache#922Closesapache#986Closesapache#992Closesapache#1019Closesapache#1040Closesapache#1041Closesapache#1043Closesapache#1046Closesapache#1051Closesapache#1078Closesapache#1146Closesapache#1164Closesapache#1165Closesapache#1178Closesapache#1213Closesapache#1225Closesapache#1258Closesapache#1259Closesapache#1268Closesapache#1272Closesapache#1277Closesapache#1278Closesapache#1288Closesapache#1296Closesapache#1328Closesapache#1342Closesapache#1353Closesapache#1370Closesapache#1376Closesapache#1391Closesapache#1395Closesapache#1399Closesapache#1406Closesapache#1410Closesapache#1422Closesapache#1427Closesapache#1443Closesapache#1462Closesapache#1468Closesapache#1483Closesapache#1506Closesapache#1509Closesapache#1515Closesapache#1520Closesapache#1521Closesapache#1525Closesapache#1527Closesapache#1544Closesapache#1550Closesapache#1566Closesapache#1569Closesapache#1570Closesapache#1575Closesapache#1580Closesapache#1584Closesapache#1591Closesapache#1600Closesapache#1611Closesapache#1613Closesapache#1639Closesapache#1703Closesapache#1711Closesapache#1719Closesapache#1737Closesapache#1760Closesapache#1767Closesapache#1768Closesapache#1785Closesapache#1799Closesapache#1822Closesapache#1824Closesapache#1844Closesapache#1874Closesapache#1918Closesapache#1928Closesapache#1937Closesapache#1942Closesapache#1951Closesapache#1957Closesapache#1963Closesapache#1964Closesapache#1965Closesapache#1967Closesapache#1968Closesapache#1971Closesapache#1985Closesapache#1986Closesapache#1998Closesapache#2031Closesapache#2032Closesapache#2071Closesapache#2076Closesapache#2108Closesapache#2119Closesapache#2128Closesapache#2142Closesapache#2174Closesapache#2206Closesapache#2297Closesapache#2322Closesapache#2332Closesapache#2341Closesapache#2377Closesapache#2414Closesapache#2469
This adds an interface and two implementations, one that will load from a local file, and another
that will load a config from artifactory.
It also modifies the ResourceAwareScheduler and Multitenant schedulers to have a plugin interface and configuration entries for the plugin.
Unit tests are also added for the implementations.