liuml07 commented on a change in pull request #2223:
URL: https://github.com/apache/hadoop/pull/2223#discussion_r487368189
##########
File path:
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/Job.java
##########
@@ -1450,26 +1450,33 @@ public static void
setArchiveSharedCacheUploadPolicies(Configuration conf,
*/
private static void setSharedCacheUploadPolicies(Configuration conf,
Map<String, Boolean> policies, boolean areFiles) {
- if (policies != null) {
- StringBuilder sb = new StringBuilder();
- Iterator<Map.Entry<String, Boolean>> it = policies.entrySet().iterator();
- Map.Entry<String, Boolean> e;
- if (it.hasNext()) {
- e = it.next();
- sb.append(e.getKey() + DELIM + e.getValue());
- } else {
- // policies is an empty map, just skip setting the parameter
- return;
- }
- while (it.hasNext()) {
- e = it.next();
- sb.append("," + e.getKey() + DELIM + e.getValue());
- }
- String confParam =
- areFiles ? MRJobConfig.CACHE_FILES_SHARED_CACHE_UPLOAD_POLICIES
- : MRJobConfig.CACHE_ARCHIVES_SHARED_CACHE_UPLOAD_POLICIES;
- conf.set(confParam, sb.toString());
+ String confParam = areFiles ?
+ MRJobConfig.CACHE_FILES_SHARED_CACHE_UPLOAD_POLICIES :
+ MRJobConfig.CACHE_ARCHIVES_SHARED_CACHE_UPLOAD_POLICIES;
+ conf.set(confParam, populateSharedCacheUploadPolicies(policies));
+ }
+
+ private static String populateSharedCacheUploadPolicies(
+ Map<String, Boolean> policies) {
+ // If policies are an empty map or null, we will set EMPTY_STRING.
Review comment:
nit: this sentence can be:
```
// If no policy is provided, we will reset the config by setting an empty
string value.
```
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]