-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
HadoopJobProperty.java
155 lines (134 loc) · 5.27 KB
/
HadoopJobProperty.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/*
* 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.ignite.internal.processors.hadoop;
import org.jetbrains.annotations.Nullable;
/**
* Enumeration of optional properties supported by Apache Ignite Hadoop Accelerator.
*/
public enum HadoopJobProperty {
/**
* Initial size for hashmap which stores output of mapper and will be used as input of combiner.
* <p>
* Setting it right allows to avoid rehashing.
*/
COMBINER_HASHMAP_SIZE("ignite.combiner.hashmap.size"),
/**
* Initial size for hashmap which stores output of mapper or combiner and will be used as input of reducer.
* <p>
* Setting it right allows to avoid rehashing.
*/
PARTITION_HASHMAP_SIZE("ignite.partition.hashmap.size"),
/**
* Specifies number of concurrently running mappers for external execution mode.
* <p>
* If not specified, defaults to {@code Runtime.getRuntime().availableProcessors()}.
*/
EXTERNAL_CONCURRENT_MAPPERS("ignite.external.concurrent.mappers"),
/**
* Specifies number of concurrently running reducers for external execution mode.
* <p>
* If not specified, defaults to {@code Runtime.getRuntime().availableProcessors()}.
*/
EXTERNAL_CONCURRENT_REDUCERS("ignite.external.concurrent.reducers"),
/**
* Delay in milliseconds after which Ignite server will reply job status.
*/
JOB_STATUS_POLL_DELAY("ignite.job.status.poll.delay"),
/**
* Size in bytes of single memory page which will be allocated for data structures in shuffle.
* <p>
* By default is {@code 32 * 1024}.
*/
SHUFFLE_OFFHEAP_PAGE_SIZE("ignite.shuffle.offheap.page.size"),
/**
* If set to {@code true} then input for combiner will not be sorted by key.
* Internally hash-map will be used instead of sorted one, so {@link Object#equals(Object)}
* and {@link Object#hashCode()} methods of key must be implemented consistently with
* comparator for that type. Grouping comparator is not supported if this setting is {@code true}.
* <p>
* By default is {@code false}.
*/
SHUFFLE_COMBINER_NO_SORTING("ignite.shuffle.combiner.no.sorting"),
/**
* If set to {@code true} then input for reducer will not be sorted by key.
* Internally hash-map will be used instead of sorted one, so {@link Object#equals(Object)}
* and {@link Object#hashCode()} methods of key must be implemented consistently with
* comparator for that type. Grouping comparator is not supported if this setting is {@code true}.
* <p>
* By default is {@code false}.
*/
SHUFFLE_REDUCER_NO_SORTING("ignite.shuffle.reducer.no.sorting"),
/**
* Defines approximate size in bytes of shuffle message which will be passed over wire from mapper to reducer.
* <p>
* Defaults to 128Kb.
*/
SHUFFLE_MSG_SIZE("ignite.shuffle.message.size"),
/**
* Shuffle job throttle in milliseconds. When job is executed with separate shuffle thread, this parameter
* controls sleep duration between iterations through intermediate reducer maps.
* <p>
* Defaults to {@code 0}.
*/
SHUFFLE_JOB_THROTTLE("ignite.shuffle.job.throttle");
/** Property name. */
private final String propName;
/**
* Constrcutor.
*
* @param propName Property name.
*/
HadoopJobProperty(String propName) {
this.propName = propName;
}
/**
* @return Property name.
*/
public String propertyName() {
return propName;
}
/**
* @param jobInfo Job info.
* @param pty Property.
* @param dflt Default value.
* @return Property value.
*/
public static String get(HadoopJobInfo jobInfo, HadoopJobProperty pty, @Nullable String dflt) {
String res = jobInfo.property(pty.propertyName());
return res == null ? dflt : res;
}
/**
* @param jobInfo Job info.
* @param pty Property.
* @param dflt Default value.
* @return Property value.
*/
public static int get(HadoopJobInfo jobInfo, HadoopJobProperty pty, int dflt) {
String res = jobInfo.property(pty.propertyName());
return res == null ? dflt : Integer.parseInt(res);
}
/**
* @param jobInfo Job info.
* @param pty Property.
* @param dflt Default value.
* @return Property value.
*/
public static boolean get(HadoopJobInfo jobInfo, HadoopJobProperty pty, boolean dflt) {
String res = jobInfo.property(pty.propertyName());
return res == null ? dflt : Boolean.parseBoolean(res);
}
}