Github user HeartSaVioR commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2199#discussion_r134085178
  
    --- Diff: 
storm-server/src/main/java/org/apache/storm/scheduler/utils/ArtifactoryConfigLoader.java
 ---
    @@ -0,0 +1,416 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.storm.scheduler.utils;
    +
    +import java.io.File;
    +import java.io.FileOutputStream;
    +import java.io.IOException;
    +import java.net.URI;
    +import java.util.Collections;
    +import java.util.Comparator;
    +import java.util.Map;
    +import org.apache.http.HttpEntity;
    +import org.apache.http.HttpResponse;
    +import org.apache.http.client.HttpClient;
    +import org.apache.http.client.ResponseHandler;
    +import org.apache.http.client.config.RequestConfig;
    +import org.apache.http.client.methods.HttpGet;
    +import org.apache.http.client.utils.URIBuilder;
    +import org.apache.http.impl.client.HttpClientBuilder;
    +import org.apache.http.util.EntityUtils;
    +import org.apache.storm.Config;
    +import org.apache.storm.utils.Time;
    +import org.json.simple.JSONArray;
    +import org.json.simple.JSONObject;
    +import org.json.simple.parser.JSONParser;
    +import org.json.simple.parser.ParseException;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +import org.yaml.snakeyaml.Yaml;
    +import org.yaml.snakeyaml.constructor.SafeConstructor;
    +
    +/**
    + * A dynamic loader for that can load scheduler configurations for user 
resource guarantees from Artifactory.
    + *
    + * <p>Configuration items for this config loader are passed in via config 
settings in
    + * each scheduler that has a configurable loader.
    + *
    + * <p>For example, the resource aware scheduler has configuration items 
defined in DaemonConfig.java
    + * that allow a user to configure which implementation of IConfigLoader to 
use to load
    + * specific scheduler configs as well as any parameters to pass into the 
prepare method of
    + * that configuration.
    + *
    + * <p>resource.aware.scheduler.user.pools.loader can be set to 
org.apache.storm.scheduler.utils.ArtifactoryConfigLoader
    + *
    + * <p>and then resource.aware.scheduler.user.pools.loader.params can be 
set to any of the following
    + *
    + * <p><code>
    + * {"artifactory.config.loader.uri": 
"http://artifactory.example.org:9989/artifactory/confs/my_cluster/mt_user_pool"}
    + *
    + * {"artifactory.config.loader.uri": 
"file:///confs/my_cluster/mt_user_pool"}
    + *
    + * {"artifactory.config.loader.uri": 
"file:///confs/my_cluster/mt_user_pool", 
"artifactory.config.loader.timeout.secs" : "60"}
    + * </code>
    + *
    + */
    +public class ArtifactoryConfigLoader implements IConfigLoader {
    +    protected static final String ARTIFACTORY_URI = 
"artifactory.config.loader.uri";
    +    protected static final String ARTIFACTORY_TIMEOUT_SECS = 
"artifactory.config.loader.timeout.secs";
    +    protected static final String ARTIFACTORY_POLL_TIME_SECS = 
"artifactory.config.loader.polltime.secs";
    +    protected static final String ARTIFACTORY_SCHEME = 
"artifactory.config.loader.scheme";
    +    protected static final String ARTIFACTORY_BASE_DIRECTORY = 
"artifactory.config.loader.base.directory";
    +    protected static final String LOCAL_ARTIFACT_DIR = 
"scheduler_artifacts";
    +    static final String cacheFilename = "latest.yaml";
    +
    +    private static final Logger LOG = 
LoggerFactory.getLogger(ArtifactoryConfigLoader.class);
    +
    +    @SuppressWarnings("rawtypes")
    +    private Map _conf;
    +    private int _artifactoryPollTimeSecs = 600;
    --- End diff --
    
    minor: Maybe better to have a constant (private static final) for `600`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to