code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class V1VerticalPodAutoscalerSpecRecommenders {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append("}"); return sb.toString(); }
Name of the recommender responsible for generating recommendation for this object. @return name
toString
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecRecommenders.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecRecommenders.java
Apache-2.0
private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); }
Convert the given object to string with each line indented by 4 spaces (except the first line).
toIndentedString
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecRecommenders.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecRecommenders.java
Apache-2.0
public V1VerticalPodAutoscalerSpecResourcePolicy containerPolicies(List<V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies> containerPolicies) { this.containerPolicies = containerPolicies; return this; }
Controls how the autoscaler computes recommended resources. The resource policy may be used to set constraints on the recommendations for individual containers. If not specified, the autoscaler computes recommended resources for all containers in the pod, without additional constraints.
containerPolicies
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicy.java
Apache-2.0
public V1VerticalPodAutoscalerSpecResourcePolicy addContainerPoliciesItem(V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies containerPoliciesItem) { if (this.containerPolicies == null) { this.containerPolicies = new ArrayList<>(); } this.containerPolicies.add(containerPoliciesItem); return this; }
Controls how the autoscaler computes recommended resources. The resource policy may be used to set constraints on the recommendations for individual containers. If not specified, the autoscaler computes recommended resources for all containers in the pod, without additional constraints.
addContainerPoliciesItem
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicy.java
Apache-2.0
@javax.annotation.Nullable @ApiModelProperty(value = "Per-container resource policies.") public List<V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies> getContainerPolicies() { return containerPolicies; }
Per-container resource policies. @return containerPolicies
getContainerPolicies
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicy.java
Apache-2.0
public void setContainerPolicies(List<V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies> containerPolicies) { this.containerPolicies = containerPolicies; }
Per-container resource policies. @return containerPolicies
setContainerPolicies
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicy.java
Apache-2.0
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } V1VerticalPodAutoscalerSpecResourcePolicy v1VerticalPodAutoscalerSpecResourcePolicy = (V1VerticalPodAutoscalerSpecResourcePolicy) o; return Objects.equals(this.containerPolicies, v1VerticalPodAutoscalerSpecResourcePolicy.containerPolicies); }
Per-container resource policies. @return containerPolicies
equals
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicy.java
Apache-2.0
@Override public int hashCode() { return Objects.hash(containerPolicies); }
Per-container resource policies. @return containerPolicies
hashCode
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicy.java
Apache-2.0
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class V1VerticalPodAutoscalerSpecResourcePolicy {\n"); sb.append(" containerPolicies: ").append(toIndentedString(containerPolicies)).append("\n"); sb.append("}"); return sb.toString(); }
Per-container resource policies. @return containerPolicies
toString
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicy.java
Apache-2.0
private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); }
Convert the given object to string with each line indented by 4 spaces (except the first line).
toIndentedString
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicy.java
Apache-2.0
public String getValue() { return value; }
Whether autoscaler is enabled for the container. The default is \&quot;Auto\&quot;.
getValue
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
@Override public String toString() { return String.valueOf(value); }
Whether autoscaler is enabled for the container. The default is \&quot;Auto\&quot;.
toString
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
public static ModeEnum fromValue(String value) { for (ModeEnum b : ModeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); }
Whether autoscaler is enabled for the container. The default is \&quot;Auto\&quot;.
fromValue
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
@Override public void write(final JsonWriter jsonWriter, final ModeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); }
Whether autoscaler is enabled for the container. The default is \&quot;Auto\&quot;.
write
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
@Override public ModeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return ModeEnum.fromValue(value); }
Whether autoscaler is enabled for the container. The default is \&quot;Auto\&quot;.
read
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
public V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies containerName(String containerName) { this.containerName = containerName; return this; }
Whether autoscaler is enabled for the container. The default is \&quot;Auto\&quot;.
containerName
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
@javax.annotation.Nullable @ApiModelProperty(value = "Name of the container or DefaultContainerResourcePolicy, in which case the policy is used by the containers that don't have their own policy specified.") public String getContainerName() { return containerName; }
Name of the container or DefaultContainerResourcePolicy, in which case the policy is used by the containers that don&#39;t have their own policy specified. @return containerName
getContainerName
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
public void setContainerName(String containerName) { this.containerName = containerName; }
Name of the container or DefaultContainerResourcePolicy, in which case the policy is used by the containers that don&#39;t have their own policy specified. @return containerName
setContainerName
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
public V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies controlledResources(List<String> controlledResources) { this.controlledResources = controlledResources; return this; }
Name of the container or DefaultContainerResourcePolicy, in which case the policy is used by the containers that don&#39;t have their own policy specified. @return containerName
controlledResources
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
public V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies addControlledResourcesItem(String controlledResourcesItem) { if (this.controlledResources == null) { this.controlledResources = new ArrayList<>(); } this.controlledResources.add(controlledResourcesItem); return this; }
Name of the container or DefaultContainerResourcePolicy, in which case the policy is used by the containers that don&#39;t have their own policy specified. @return containerName
addControlledResourcesItem
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
@javax.annotation.Nullable @ApiModelProperty(value = "Specifies the type of recommendations that will be computed (and possibly applied) by VPA. If not specified, the default of [ResourceCPU, ResourceMemory] will be used.") public List<String> getControlledResources() { return controlledResources; }
Specifies the type of recommendations that will be computed (and possibly applied) by VPA. If not specified, the default of [ResourceCPU, ResourceMemory] will be used. @return controlledResources
getControlledResources
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
public void setControlledResources(List<String> controlledResources) { this.controlledResources = controlledResources; }
Specifies the type of recommendations that will be computed (and possibly applied) by VPA. If not specified, the default of [ResourceCPU, ResourceMemory] will be used. @return controlledResources
setControlledResources
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
public V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies controlledValues(ControlledValuesEnum controlledValues) { this.controlledValues = controlledValues; return this; }
Specifies the type of recommendations that will be computed (and possibly applied) by VPA. If not specified, the default of [ResourceCPU, ResourceMemory] will be used. @return controlledResources
controlledValues
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
@javax.annotation.Nullable @ApiModelProperty(value = "Specifies the maximum amount of resources that will be recommended for the container. The default is no maximum.") public Map<String, Object> getMaxAllowed() { return maxAllowed; }
Specifies the maximum amount of resources that will be recommended for the container. The default is no maximum. @return maxAllowed
getMaxAllowed
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
public void setMaxAllowed(Map<String, Object> maxAllowed) { this.maxAllowed = maxAllowed; }
Specifies the maximum amount of resources that will be recommended for the container. The default is no maximum. @return maxAllowed
setMaxAllowed
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
public V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies minAllowed(Map<String, Object> minAllowed) { this.minAllowed = minAllowed; return this; }
Specifies the maximum amount of resources that will be recommended for the container. The default is no maximum. @return maxAllowed
minAllowed
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
public V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies putMinAllowedItem(String key, Object minAllowedItem) { if (this.minAllowed == null) { this.minAllowed = new HashMap<>(); } this.minAllowed.put(key, minAllowedItem); return this; }
Specifies the maximum amount of resources that will be recommended for the container. The default is no maximum. @return maxAllowed
putMinAllowedItem
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
@javax.annotation.Nullable @ApiModelProperty(value = "Specifies the minimal amount of resources that will be recommended for the container. The default is no minimum.") public Map<String, Object> getMinAllowed() { return minAllowed; }
Specifies the minimal amount of resources that will be recommended for the container. The default is no minimum. @return minAllowed
getMinAllowed
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
public void setMinAllowed(Map<String, Object> minAllowed) { this.minAllowed = minAllowed; }
Specifies the minimal amount of resources that will be recommended for the container. The default is no minimum. @return minAllowed
setMinAllowed
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
public V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies mode(ModeEnum mode) { this.mode = mode; return this; }
Specifies the minimal amount of resources that will be recommended for the container. The default is no minimum. @return minAllowed
mode
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
@javax.annotation.Nullable @ApiModelProperty(value = "Whether autoscaler is enabled for the container. The default is \"Auto\".") public ModeEnum getMode() { return mode; }
Whether autoscaler is enabled for the container. The default is \&quot;Auto\&quot;. @return mode
getMode
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
public void setMode(ModeEnum mode) { this.mode = mode; }
Whether autoscaler is enabled for the container. The default is \&quot;Auto\&quot;. @return mode
setMode
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies v1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies = (V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies) o; return Objects.equals(this.containerName, v1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.containerName) && Objects.equals(this.controlledResources, v1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.controlledResources) && Objects.equals(this.controlledValues, v1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.controlledValues) && Objects.equals(this.maxAllowed, v1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.maxAllowed) && Objects.equals(this.minAllowed, v1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.minAllowed) && Objects.equals(this.mode, v1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.mode); }
Whether autoscaler is enabled for the container. The default is \&quot;Auto\&quot;. @return mode
equals
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
@Override public int hashCode() { return Objects.hash(containerName, controlledResources, controlledValues, maxAllowed, minAllowed, mode); }
Whether autoscaler is enabled for the container. The default is \&quot;Auto\&quot;. @return mode
hashCode
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies {\n"); sb.append(" containerName: ").append(toIndentedString(containerName)).append("\n"); sb.append(" controlledResources: ").append(toIndentedString(controlledResources)).append("\n"); sb.append(" controlledValues: ").append(toIndentedString(controlledValues)).append("\n"); sb.append(" maxAllowed: ").append(toIndentedString(maxAllowed)).append("\n"); sb.append(" minAllowed: ").append(toIndentedString(minAllowed)).append("\n"); sb.append(" mode: ").append(toIndentedString(mode)).append("\n"); sb.append("}"); return sb.toString(); }
Whether autoscaler is enabled for the container. The default is \&quot;Auto\&quot;. @return mode
toString
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); }
Convert the given object to string with each line indented by 4 spaces (except the first line).
toIndentedString
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecResourcePolicyContainerPolicies.java
Apache-2.0
public String getValue() { return value; }
Controls when autoscaler applies changes to the pod resources. The default is &#39;Auto&#39;.
getValue
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
Apache-2.0
@Override public String toString() { return String.valueOf(value); }
Controls when autoscaler applies changes to the pod resources. The default is &#39;Auto&#39;.
toString
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
Apache-2.0
public static UpdateModeEnum fromValue(String value) { for (UpdateModeEnum b : UpdateModeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); }
Controls when autoscaler applies changes to the pod resources. The default is &#39;Auto&#39;.
fromValue
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
Apache-2.0
@Override public void write(final JsonWriter jsonWriter, final UpdateModeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); }
Controls when autoscaler applies changes to the pod resources. The default is &#39;Auto&#39;.
write
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
Apache-2.0
@Override public UpdateModeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return UpdateModeEnum.fromValue(value); }
Controls when autoscaler applies changes to the pod resources. The default is &#39;Auto&#39;.
read
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
Apache-2.0
public V1VerticalPodAutoscalerSpecUpdatePolicy minReplicas(Integer minReplicas) { this.minReplicas = minReplicas; return this; }
Controls when autoscaler applies changes to the pod resources. The default is &#39;Auto&#39;.
minReplicas
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
Apache-2.0
@javax.annotation.Nullable @ApiModelProperty(value = "Minimal number of replicas which need to be alive for Updater to attempt pod eviction (pending other checks like PDB). Only positive values are allowed. Overrides global '--min-replicas' flag.") public Integer getMinReplicas() { return minReplicas; }
Minimal number of replicas which need to be alive for Updater to attempt pod eviction (pending other checks like PDB). Only positive values are allowed. Overrides global &#39;--min-replicas&#39; flag. @return minReplicas
getMinReplicas
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
Apache-2.0
public void setMinReplicas(Integer minReplicas) { this.minReplicas = minReplicas; }
Minimal number of replicas which need to be alive for Updater to attempt pod eviction (pending other checks like PDB). Only positive values are allowed. Overrides global &#39;--min-replicas&#39; flag. @return minReplicas
setMinReplicas
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
Apache-2.0
public V1VerticalPodAutoscalerSpecUpdatePolicy updateMode(UpdateModeEnum updateMode) { this.updateMode = updateMode; return this; }
Minimal number of replicas which need to be alive for Updater to attempt pod eviction (pending other checks like PDB). Only positive values are allowed. Overrides global &#39;--min-replicas&#39; flag. @return minReplicas
updateMode
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
Apache-2.0
@javax.annotation.Nullable @ApiModelProperty(value = "Controls when autoscaler applies changes to the pod resources. The default is 'Auto'.") public UpdateModeEnum getUpdateMode() { return updateMode; }
Controls when autoscaler applies changes to the pod resources. The default is &#39;Auto&#39;. @return updateMode
getUpdateMode
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
Apache-2.0
public void setUpdateMode(UpdateModeEnum updateMode) { this.updateMode = updateMode; }
Controls when autoscaler applies changes to the pod resources. The default is &#39;Auto&#39;. @return updateMode
setUpdateMode
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
Apache-2.0
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } V1VerticalPodAutoscalerSpecUpdatePolicy v1VerticalPodAutoscalerSpecUpdatePolicy = (V1VerticalPodAutoscalerSpecUpdatePolicy) o; return Objects.equals(this.minReplicas, v1VerticalPodAutoscalerSpecUpdatePolicy.minReplicas) && Objects.equals(this.updateMode, v1VerticalPodAutoscalerSpecUpdatePolicy.updateMode); }
Controls when autoscaler applies changes to the pod resources. The default is &#39;Auto&#39;. @return updateMode
equals
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
Apache-2.0
@Override public int hashCode() { return Objects.hash(minReplicas, updateMode); }
Controls when autoscaler applies changes to the pod resources. The default is &#39;Auto&#39;. @return updateMode
hashCode
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
Apache-2.0
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class V1VerticalPodAutoscalerSpecUpdatePolicy {\n"); sb.append(" minReplicas: ").append(toIndentedString(minReplicas)).append("\n"); sb.append(" updateMode: ").append(toIndentedString(updateMode)).append("\n"); sb.append("}"); return sb.toString(); }
Controls when autoscaler applies changes to the pod resources. The default is &#39;Auto&#39;. @return updateMode
toString
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
Apache-2.0
private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); }
Convert the given object to string with each line indented by 4 spaces (except the first line).
toIndentedString
java
azkaban/azkaban
azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/main/java/io/kubernetes/autoscaling/models/V1VerticalPodAutoscalerSpecUpdatePolicy.java
Apache-2.0
@Test public void testCreateAzkabanEventReporter() { final Props props = new Props(); props.put(AZKABAN_EVENT_REPORTING_ENABLED, "true"); props.put(AZKABAN_EVENT_REPORTING_CLASS_PARAM, "azkaban.AzkabanEventReporterTest1"); final AzkabanCommonModule azkabanCommonModule = new AzkabanCommonModule(props); final AzkabanEventReporter azkabanEventReporter = azkabanCommonModule .createAzkabanEventReporter(); assertThat(azkabanEventReporter).isNotNull(); assertThat(azkabanEventReporter).isInstanceOf(AzkabanEventReporterTest1.class); }
Verify that alternate implementation of the <code>AzkabanEventReporter</code> is initialized.
testCreateAzkabanEventReporter
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/AzkabanCommonModuleTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/AzkabanCommonModuleTest.java
Apache-2.0
@Test public void testAzkabanEventReporterInvalidProperties() { final Props props = new Props(); props.put(AZKABAN_EVENT_REPORTING_ENABLED, "true"); props.put(AZKABAN_EVENT_REPORTING_CLASS_PARAM, "azkaban.execapp.reporter.AzkabanKafkaAvroEventReporter"); final AzkabanCommonModule azkabanCommonModule = new AzkabanCommonModule(props); assertThatIllegalArgumentException() .isThrownBy(() -> azkabanCommonModule.createAzkabanEventReporter()); }
Verify that <code>IllegalArgumentException</code> is thrown when required properties are missing.
testAzkabanEventReporterInvalidProperties
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/AzkabanCommonModuleTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/AzkabanCommonModuleTest.java
Apache-2.0
@Test public void testAzkabanEventReporterInvalidConstructor() { final Props props = new Props(); props.put(AZKABAN_EVENT_REPORTING_ENABLED, "true"); props.put(AZKABAN_EVENT_REPORTING_CLASS_PARAM, "azkaban.execapp.AzkabanEventReporterTest3"); AzkabanCommonModule azkabanCommonModule = new AzkabanCommonModule(props); assertThatExceptionOfType(RuntimeException.class) .isThrownBy(() -> azkabanCommonModule.createAzkabanEventReporter()); }
Verify that a <code>RuntimeException</code> is thrown when valid constructor is not found in the event reporter implementation.
testAzkabanEventReporterInvalidConstructor
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/AzkabanCommonModuleTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/AzkabanCommonModuleTest.java
Apache-2.0
@Test public void testEventReporterDisabled() { final Props props = new Props(); AzkabanCommonModule AzkabanCommonModule = new AzkabanCommonModule(props); final AzkabanEventReporter azkabanEventReporter = AzkabanCommonModule .createAzkabanEventReporter(); assertThat(azkabanEventReporter).isNull(); }
Ensures that the event reporter is not initialized when the property 'event.reporter.enabled' is not set.
testEventReporterDisabled
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/AzkabanCommonModuleTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/AzkabanCommonModuleTest.java
Apache-2.0
@Override public boolean report(final EventType eventType, final Map<String, String> metadata) { return false; }
Ensures that the event reporter is not initialized when the property 'event.reporter.enabled' is not set.
report
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/AzkabanCommonModuleTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/AzkabanCommonModuleTest.java
Apache-2.0
@Override public boolean report(final EventType eventType, final Map<String, String> metadata) { return false; }
Ensures that the event reporter is not initialized when the property 'event.reporter.enabled' is not set.
report
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/AzkabanCommonModuleTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/AzkabanCommonModuleTest.java
Apache-2.0
@Override public boolean report(final EventType eventType, final Map<String, String> metadata) { return false; }
Ensures that the event reporter is not initialized when the property 'event.reporter.enabled' is not set.
report
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/AzkabanCommonModuleTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/AzkabanCommonModuleTest.java
Apache-2.0
@Test public void testLoadingSingleCluster() throws IOException { final File clusterDir = this.testDir.newFolder("single-cluster"); final File clusterConfig = new File(clusterDir, ClusterLoader.CLUSTER_CONF_FILE); try (final Writer fileWriter = new OutputStreamWriter( new FileOutputStream(clusterConfig), StandardCharsets.UTF_8)) { fileWriter .write("hadoop.security.manager.class=azkaban.security.HadoopSecurityManager_H_2_0\n"); fileWriter.write("A=a\n"); fileWriter.write("B=b\n"); } final ClusterRegistry clusterRegistry = new ClusterRegistry(); ClusterLoader.loadCluster(clusterDir, clusterRegistry); final Cluster cluster = clusterRegistry.getCluster(clusterDir.getName()); Assert.assertEquals(clusterDir.getName(), cluster.clusterId); }
Sanity check when a single cluster is configured.
testLoadingSingleCluster
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/cluster/ClusterLoaderTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/cluster/ClusterLoaderTest.java
Apache-2.0
@Test (expected = FileNotFoundException.class) public void testLoadingSingleClusterWithMissingClusterConfig() throws IOException { final File clusterDir = this.testDir.newFolder("single-cluster-no-config"); final ClusterRegistry clusterRegistry = new ClusterRegistry(); ClusterLoader.loadCluster(clusterDir, clusterRegistry); }
Verify an exception is thrown properly when a single cluster is configured but with its cluster.properties file missing.
testLoadingSingleClusterWithMissingClusterConfig
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/cluster/ClusterLoaderTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/cluster/ClusterLoaderTest.java
Apache-2.0
@Test public void testLoadingMultipleClusters() throws IOException { final File clustersDir = new File( getClass().getClassLoader().getResource("clusters").getFile()); final ClusterRegistry clusterRegistry = new ClusterRegistry(); final ClusterLoader clusterLoader = new ClusterLoader(clustersDir, clusterRegistry); final Cluster defaultCluster = clusterRegistry.getCluster("default"); Assert.assertEquals("default", defaultCluster.clusterId); final Cluster another = clusterRegistry.getCluster("another"); Assert.assertEquals("another", another.clusterId); }
Sanity check when multiple clusters are configured.
testLoadingMultipleClusters
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/cluster/ClusterLoaderTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/cluster/ClusterLoaderTest.java
Apache-2.0
@Test public void testGetClusterSecurityManager() throws ClassNotFoundException { final String fakeHadoopSecurityManagerClassName = "org.hello.world.HelloWorld"; final Props clusterProps = new Props(); final File hadoopSecurityManagerJar = new File(getClass().getClassLoader().getResource("helloworld.jar").getFile()); clusterProps.put(Cluster.LIBRARY_PATH_PREFIX + "hadoopsecuritymanager", hadoopSecurityManagerJar.getParentFile().getPath()); clusterProps.put(Cluster.HADOOP_SECURITY_MANAGER_DEPENDENCY_COMPONENTS, "hadoopsecuritymanager"); clusterProps.put(Cluster.HADOOP_SECURITY_MANAGER_CLASS_PROP, fakeHadoopSecurityManagerClassName); final Cluster cluster = new Cluster("default", clusterProps); final HadoopSecurityManagerClassLoader classLoader = cluster.getSecurityManagerClassLoader(); classLoader.loadClass(fakeHadoopSecurityManagerClassName); }
Test loading of the HadoopSecurityManager class figured for a given cluster from its dedicated HadoopSecurityManagerClassLoader instance.
testGetClusterSecurityManager
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/cluster/ClusterTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/cluster/ClusterTest.java
Apache-2.0
@Test public void testGetResource() throws IOException { final URL testJar = makeTestJar().toURI().toURL(); final ClassLoader currentClassLoader = getClass().getClassLoader(); final ClassLoader hadoopSecurityManagerClassLoader = new HadoopSecurityManagerClassLoader( new URL[]{testJar}, currentClassLoader, "testCluster"); Assert.assertNull("Resource should not be found in the parent classloader", currentClassLoader.getResource(RESOURCE_FILE)); Assert.assertNotNull("Resource should be found in HadoopSecurityManagerClassLoader", hadoopSecurityManagerClassLoader.getResource(RESOURCE_FILE)); }
Test the case where a resource file exists in the HadoopSecurityManager classloader.
testGetResource
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/cluster/HadoopSecurityManagerClassLoaderTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/cluster/HadoopSecurityManagerClassLoaderTest.java
Apache-2.0
private File makeTestJar() throws IOException { final File jarFile = this.testDir.newFile("test.jar"); try (final JarOutputStream out = new JarOutputStream(new FileOutputStream(jarFile))) { final ZipEntry entry = new ZipEntry(RESOURCE_FILE); out.putNextEntry(entry); out.write("hello".getBytes(UTF_8)); out.closeEntry(); } return jarFile; }
Test the case where a resource file exists in the HadoopSecurityManager classloader.
makeTestJar
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/cluster/HadoopSecurityManagerClassLoaderTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/cluster/HadoopSecurityManagerClassLoaderTest.java
Apache-2.0
@Test(expected = ClassNotFoundException.class) public void testNonExistClass() throws ClassNotFoundException { final ClassLoader currentClassLoader = getClass().getClassLoader(); final ClassLoader hadoopSecurityManagerClassLoader = new HadoopSecurityManagerClassLoader( new URL[]{}, currentClassLoader, "testCluster"); Assert.assertNull("This class does not exist", hadoopSecurityManagerClassLoader.loadClass("nonexistent.class.name")); }
Test the case where the define job class does not exist.
testNonExistClass
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/cluster/HadoopSecurityManagerClassLoaderTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/cluster/HadoopSecurityManagerClassLoaderTest.java
Apache-2.0
@Test public void testClassAvailableInParentClassLoader() throws ClassNotFoundException { final ClassLoader currentClassLoader = getClass().getClassLoader(); final ClassLoader hadoopSecurityManagerClassLoader = new HadoopSecurityManagerClassLoader( new URL[]{}, currentClassLoader, "testCluster"); final Class clazz = hadoopSecurityManagerClassLoader.loadClass( HadoopSecurityManagerClassLoaderTest.class.getName()); Assert.assertEquals(currentClassLoader, clazz.getClassLoader()); }
Test class loading of a class that is available only in the parent classloader.
testClassAvailableInParentClassLoader
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/cluster/HadoopSecurityManagerClassLoaderTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/cluster/HadoopSecurityManagerClassLoaderTest.java
Apache-2.0
@Test public void testClassAvailableInHadoopSecurityManagerClassLoader() throws MalformedURLException, ClassNotFoundException { final ClassLoader currentClassLoader = getClass().getClassLoader(); final File helloworldJar = new File(currentClassLoader.getResource(SAMPLE_JAR).getFile()); final URL helloworlURL = helloworldJar.toURI().toURL(); final ClassLoader hadoopSecurityManagerClassLoader = new HadoopSecurityManagerClassLoader( new URL[]{helloworlURL}, currentClassLoader, "testCluster"); final Class clazz = hadoopSecurityManagerClassLoader.loadClass( "org.hello.world.HelloWorld"); Assert.assertEquals(hadoopSecurityManagerClassLoader, clazz.getClassLoader()); }
Test class loading of a class that is available only in the HadoopSecurityManagerClassLoader. The class is provided in 'helloworld.jar'.
testClassAvailableInHadoopSecurityManagerClassLoader
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/cluster/HadoopSecurityManagerClassLoaderTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/cluster/HadoopSecurityManagerClassLoaderTest.java
Apache-2.0
@Test public void testPropsClass() throws ClassNotFoundException { ClassLoader currentClassLoader = getClass().getClassLoader(); HadoopSecurityManagerClassLoader hadoopSecurityManagerClassLoader = new HadoopSecurityManagerClassLoader( new URL[] {}, currentClassLoader, "testCluster"); // make azkaban.utils.Props class available to the HadoopSecurityManagerClassLoader hadoopSecurityManagerClassLoader.addURL(Props.class); Class clazz = hadoopSecurityManagerClassLoader.loadClass(Props.class.getName()); Assert.assertEquals(currentClassLoader, clazz.getClassLoader()); }
Check {@link azkaban.utils.Props} is always loaded by its parent classloader.
testPropsClass
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/cluster/HadoopSecurityManagerClassLoaderTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/cluster/HadoopSecurityManagerClassLoaderTest.java
Apache-2.0
@Test public void testGetNewConnectionAfterClose() throws Exception { this.connection.setAutoCommit(false); /** * See {@link org.apache.commons.dbcp2.PoolableConnectionFactory#passivateObject}. * If the connection disables auto commit, when we close it, connection will be reset enabling auto commit, * and returned to connection pool. */ DbUtils.closeQuietly(this.connection); final Connection newConnection = this.h2DataSource.getConnection(); Assert.assertEquals(newConnection.getAutoCommit(), true); DbUtils.closeQuietly(newConnection); }
{@link AzkabanDataSource#getConnection} fetches a new connection object other than one in the above, if we don't close.
testGetNewConnectionAfterClose
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/database/AzkabanConnectionPoolTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/database/AzkabanConnectionPoolTest.java
Apache-2.0
@Test public void testFlowParamForDispatchMethod() throws Exception { initializeContainerizedDispatchImpl(); this.containerizedDispatchManager.getContainerRampUpCriteria().setRampUp(0); this.containerizedDispatchManager.getContainerJobTypeCriteria().updateAllowList(ImmutableSet.of("ALL")); DispatchMethod dispatchMethod = this.containerizedDispatchManager.getDispatchMethod(this.flow6); Assert.assertEquals(DispatchMethod.CONTAINERIZED, dispatchMethod); DispatchMethod dispatchMethodFor7 = this.containerizedDispatchManager.getDispatchMethod(this.flow7); Assert.assertEquals(DispatchMethod.POLL, dispatchMethodFor7); }
This test case is verifying that if dispatch method is marked for containerization in flow parameter then it should be respected first. If not then it should follow rest of the criteria. @throws Exception
testFlowParamForDispatchMethod
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testFlowParamForUseExecutor() throws Exception { initializeContainerizedDispatchImpl(); this.containerizedDispatchManager.getContainerRampUpCriteria().setRampUp(0); this.containerizedDispatchManager.getContainerJobTypeCriteria().updateAllowList(ImmutableSet.of("ALL")); DispatchMethod dispatchMethod = this.containerizedDispatchManager.getDispatchMethod(this.flow8); Assert.assertEquals(DispatchMethod.POLL, dispatchMethod); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testFlowParamForUseExecutor
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testAllowAndDenyList() throws Exception { // Flow 5 comprises of "command" and "noop" jobtypes initializeContainerizedDispatchImpl(); this.containerizedDispatchManager.getContainerRampUpCriteria().setRampUp(10); this.containerizedDispatchManager.getContainerJobTypeCriteria().updateAllowList(ImmutableSet.of("ALL")); DispatchMethod dispatchMethod = this.containerizedDispatchManager.getDispatchMethod(this.flow5); this.flow5.setDispatchMethod(dispatchMethod); Status startStatus = this.containerizedDispatchManager.getStartStatus(this.flow5); Assert.assertEquals(DispatchMethod.CONTAINERIZED, dispatchMethod); Assert.assertEquals(Status.READY, startStatus); this.containerizedDispatchManager.getContainerRampUpCriteria().setRampUp(0); dispatchMethod = this.containerizedDispatchManager.getDispatchMethod(this.flow5); this.flow5.setDispatchMethod(dispatchMethod); startStatus = this.containerizedDispatchManager.getStartStatus(this.flow5); Assert.assertEquals(DispatchMethod.POLL, dispatchMethod); Assert.assertEquals(Status.PREPARING, startStatus); this.containerizedDispatchManager.getContainerRampUpCriteria().setRampUp(100); this.containerizedDispatchManager.getContainerJobTypeCriteria().updateAllowList(ImmutableSet.of("java", "command", "noop")); dispatchMethod = this.containerizedDispatchManager.getDispatchMethod(this.flow5); Assert.assertEquals(DispatchMethod.CONTAINERIZED, dispatchMethod); this.containerizedDispatchManager.getContainerJobTypeCriteria().updateAllowList(ImmutableSet.of("java", "command")); dispatchMethod = this.containerizedDispatchManager.getDispatchMethod(this.flow5); Assert.assertEquals(DispatchMethod.POLL, dispatchMethod); this.containerizedDispatchManager.getContainerJobTypeCriteria().updateAllowList(ImmutableSet.of()); dispatchMethod = this.containerizedDispatchManager.getDispatchMethod(this.flow5); Assert.assertEquals(DispatchMethod.POLL, dispatchMethod); this.containerizedDispatchManager.getContainerJobTypeCriteria().updateAllowList(ImmutableSet.of("ALL")); this.containerizedDispatchManager.getContainerProxyUserCriteria().appendDenyList(ImmutableSet.of( "azktest", "azkdata")); dispatchMethod = this.containerizedDispatchManager.getDispatchMethod(this.flow5); Assert.assertEquals(DispatchMethod.CONTAINERIZED, dispatchMethod); this.flow5.addAllProxyUsers(ImmutableSet.of("azktest")); dispatchMethod = this.containerizedDispatchManager.getDispatchMethod(this.flow5); Assert.assertEquals(DispatchMethod.POLL, dispatchMethod); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testAllowAndDenyList
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testFetchAllActiveFlowIds() throws Exception { initializeContainerizedDispatchImpl(); initializeUnfinishedFlows(); assertThat(this.containerizedDispatchManager.getRunningFlowIds()) .isEqualTo(new ArrayList<>(this.unfinishedFlows.keySet())); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testFetchAllActiveFlowIds
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testFetchAllQueuedFlowIds() throws Exception { initializeContainerizedDispatchImpl(); assertThat(this.containerizedDispatchManager.getQueuedFlowIds()) .isEqualTo(ImmutableList.of(this.flow1.getExecutionId())); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testFetchAllQueuedFlowIds
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testFetchQueuedFlowSize() throws Exception { initializeContainerizedDispatchImpl(); assertThat(this.containerizedDispatchManager.getQueuedFlowSize()) .isEqualTo(this.queuedFlows.size()); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testFetchQueuedFlowSize
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testFetchActiveFlowByProject() throws Exception { initializeContainerizedDispatchImpl(); initializeUnfinishedFlows(); final List<Integer> executions = this.containerizedDispatchManager .getRunningFlowIds(this.flow2.getProjectId(), this.flow2.getFlowId()); assertThat(executions.contains(this.flow2.getExecutionId())).isTrue(); assertThat(executions.contains(this.flow3.getExecutionId())).isTrue(); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testFetchActiveFlowByProject
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testSubmitFlows() throws Exception { initializeContainerizedDispatchImpl(); this.containerizedDispatchManager.submitExecutableFlow(this.flow1, this.user.getUserId()); Assert.assertEquals(this.containerizedDispatchManager.eventListener, this.eventListener); this.containerizedDispatchManager.fireEventListeners(Event.create(flow1, EventType.FLOW_STATUS_CHANGED, new EventData(this.flow1))); verify(this.executorLoader).uploadExecutableFlow(this.flow1); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testSubmitFlows
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testSubmitFlowsExceedingMaxConcurrentRuns() throws Exception { initializeContainerizedDispatchImpl(); this.props.put(ConfigurationKeys.CONCURRENT_RUNS_ONEFLOW_WHITELIST, "exectest1," + "exec2,3"); submitFlow(this.flow2, this.ref2); submitFlow(this.flow3, this.ref3); assertThatThrownBy(() -> this.containerizedDispatchManager .submitExecutableFlow(this.flow4, this.user.getUserId ())).isInstanceOf(ExecutorManagerException.class).hasMessageContaining("Flow " + this .flow4.getId() + " has more than 1 concurrent runs. Skipping"); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testSubmitFlowsExceedingMaxConcurrentRuns
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testSubmitFlowsConcurrentWhitelist() throws Exception { initializeContainerizedDispatchImpl(); this.props.put(Constants.ConfigurationKeys.MAX_CONCURRENT_RUNS_ONEFLOW, 1); submitFlow(this.flow2, this.ref2); submitFlow(this.flow3, this.ref3); assertThatThrownBy(() -> this.containerizedDispatchManager .submitExecutableFlow(this.flow4, this.user.getUserId ())).isInstanceOf(ExecutorManagerException.class).hasMessageContaining("Flow " + this .flow4.getId() + " has more than 1 concurrent runs. Skipping"); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testSubmitFlowsConcurrentWhitelist
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testSubmitFlowsWithSkipOption() throws Exception { initializeContainerizedDispatchImpl(); submitFlow(this.flow2, this.ref2); this.flow3.getExecutionOptions().setConcurrentOption(ExecutionOptions.CONCURRENT_OPTION_SKIP); assertThatThrownBy( () -> this.containerizedDispatchManager .submitExecutableFlow(this.flow3, this.user.getUserId())) .isInstanceOf(ExecutorManagerException.class).hasMessageContaining( "Flow " + this.flow3.getId() + " is already running. Skipping execution."); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testSubmitFlowsWithSkipOption
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testSetFlowLock() throws Exception { initializeContainerizedDispatchImpl(); // trying to execute a locked flow should raise an error this.flow1.setLocked(true); final String msg = this.containerizedDispatchManager .submitExecutableFlow(this.flow1, this.user.getUserId()); assertThat(msg).isEqualTo("Flow derived-member-data for project flow is locked."); // should succeed after unlocking the flow this.flow1.setLocked(false); this.containerizedDispatchManager.submitExecutableFlow(this.flow1, this.user.getUserId()); verify(this.executorLoader).uploadExecutableFlow(this.flow1); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testSetFlowLock
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testDisablingQueueProcessThread() throws Exception { initializeContainerizedDispatchImpl(); this.containerizedDispatchManager.start(); Assert.assertEquals(this.containerizedDispatchManager.isQueueProcessorThreadActive(), true); this.containerizedDispatchManager.disableQueueProcessorThread(); Assert.assertEquals(this.containerizedDispatchManager.isQueueProcessorThreadActive(), false); this.containerizedDispatchManager.enableQueueProcessorThread(); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testDisablingQueueProcessThread
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testEnablingQueueProcessThread() throws Exception { initializeContainerizedDispatchImpl(); this.containerizedDispatchManager.start(); this.containerizedDispatchManager.disableQueueProcessorThread(); Assert.assertEquals(this.containerizedDispatchManager.isQueueProcessorThreadActive(), false); this.containerizedDispatchManager.enableQueueProcessorThread(); Assert.assertEquals(this.containerizedDispatchManager.isQueueProcessorThreadActive(), true); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testEnablingQueueProcessThread
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
private void submitFlow(final ExecutableFlow flow, final ExecutionReference ref) throws Exception { when(this.executorLoader.fetchExecutableFlow(flow.getExecutionId())).thenReturn(flow); this.containerizedDispatchManager.submitExecutableFlow(flow, this.user.getUserId()); this.unfinishedFlows.put(flow.getExecutionId(), new Pair<>(ref, flow)); initializeUnfinishedFlowMock(); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
submitFlow
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
private void initializeUnfinishedFlows() throws Exception { this.unfinishedFlows = ImmutableMap .of(this.flow1.getExecutionId(), new Pair<>(this.ref1, this.flow1), this.flow2.getExecutionId(), new Pair<>(this.ref2, this.flow2), this.flow3.getExecutionId(), new Pair<>(this.ref3, this.flow3)); initializeUnfinishedFlowMock(); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
initializeUnfinishedFlows
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
private void initializeUnfinishedFlowMock() throws Exception { when(this.executorLoader.fetchUnfinishedFlows()).thenReturn(this.unfinishedFlows); when(this.executorLoader.fetchUnfinishedFlow(anyInt())).thenAnswer( (Answer<Pair<ExecutionReference, ExecutableFlow>>) invocation -> { Object[] arguments = invocation.getArguments(); int executionId = (Integer) arguments[0]; List<Pair<ExecutionReference, ExecutableFlow>> list = unfinishedFlows.values().stream() .filter(entry -> entry.getSecond().getExecutionId() == executionId) .collect(Collectors.toList()); return (list.isEmpty()) ? null : list.get(0); }); when(this.executorLoader.selectUnfinishedFlows(anyInt(), anyString())).thenAnswer( (Answer<List<Integer>>) invocation -> { Object[] arguments = invocation.getArguments(); int projectId = (Integer) arguments[0]; String flowId = (String) arguments[1]; return unfinishedFlows.values().stream() .filter(entry -> entry.getSecond().getProjectId() == projectId && entry.getSecond().getFlowId().equals(flowId)) .map(entry -> entry.getSecond().getExecutionId()) .collect(Collectors.toList()); }); when(this.executorLoader.selectUnfinishedFlows()).thenReturn( new ArrayList<>(this.unfinishedFlows.keySet())); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
initializeUnfinishedFlowMock
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
private void initializeContainerizedDispatchImpl() throws Exception{ this.containerizedDispatchManager = new ContainerizedDispatchManager(this.props, null, this.executorLoader, this.nearlineExecutionLogsLoader, this.offlineExecutionLogsLoader, this.commonMetrics, this.apiGateway, this.containerizedImpl, null, null, this.eventListener, this.containerizationMetrics, null); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
initializeContainerizedDispatchImpl
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testGetFlowLogs() throws Exception { WrappedExecutorApiClient apiClient = new WrappedExecutorApiClient(createContainerDispatchEnabledProps(this.props)); ContainerizedDispatchManager dispatchManager = createDefaultDispatchWithGateway(apiClient); apiClient.setNextHttpPostResponse(WrappedExecutorApiClient.DEFAULT_LOG_JSON); LogData logResponse = dispatchManager.getExecutableFlowLog(this.flow1, 0, 1024); Assert.assertEquals(WrappedExecutorApiClient.DEFAULT_LOG_TEXT, logResponse.getData()); Assert.assertEquals(apiClient.getExpectedReverseProxyContainerizedURI(), apiClient.getLastBuildExecutorUriRespone()); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testGetFlowLogs
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testGetJobLogs() throws Exception { WrappedExecutorApiClient apiClient = new WrappedExecutorApiClient(createContainerDispatchEnabledProps(this.props)); ContainerizedDispatchManager dispatchManager = createDefaultDispatchWithGateway(apiClient); apiClient.setNextHttpPostResponse(WrappedExecutorApiClient.DEFAULT_LOG_JSON); LogData logResponse = dispatchManager.getExecutionJobLog(this.flow1, "job1",0, 1, 1024); Assert.assertEquals(WrappedExecutorApiClient.DEFAULT_LOG_TEXT, logResponse.getData()); Assert.assertEquals(apiClient.getExpectedReverseProxyContainerizedURI(), apiClient.getLastBuildExecutorUriRespone()); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testGetJobLogs
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testCancelPreparingFlow() throws Exception { initializeContainerizedDispatchImpl(); testCancelUnreachableFlowHelper(Status.PREPARING); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testCancelPreparingFlow
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testCancelDispatchingFlow() throws Exception { initializeContainerizedDispatchImpl(); testCancelUnreachableFlowHelper(Status.DISPATCHING); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testCancelDispatchingFlow
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testCancelRunningFlow() throws Exception { initializeContainerizedDispatchImpl(); testCancelUnreachableFlowHelper(Status.RUNNING); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testCancelRunningFlow
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
private void testCancelUnreachableFlowHelper(Status initialStatus) throws Exception { submitFlow(this.flow1, this.ref1); this.flow1.setStatus(initialStatus); try { WrappedExecutorApiClient apiClient = new WrappedExecutorApiClient(createContainerDispatchEnabledProps(this.props)); ContainerizedDispatchManager dispatchManager = createDefaultDispatchWithGateway(apiClient); apiClient.setNextHttpPostResponse(WrappedExecutorApiClient.STATUS_ERROR_JSON); dispatchManager.cancelFlow(this.flow1, this.user.getUserId()); } catch (ExecutorManagerException e) { // Ignore if there is an exception. } // Verify that the status of flow1 is finalized. assertThat(this.flow1.getStatus()).isEqualTo(Status.KILLED); Mockito.verify(this.containerizedImpl, Mockito.times(1)).deleteContainer(flow1.getExecutionId()); this.flow1.getExecutableNodes().forEach(node -> { assertThat(node.getStatus()).isEqualTo(Status.KILLED); }); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testCancelUnreachableFlowHelper
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testCancelFlow() throws Exception { initializeUnfinishedFlows(); WrappedExecutorApiClient apiClient = new WrappedExecutorApiClient(createContainerDispatchEnabledProps(this.props)); ContainerizedDispatchManager dispatchManager = createDefaultDispatchWithGateway(apiClient); apiClient.setNextHttpPostResponse(WrappedExecutorApiClient.STATUS_SUCCESS_JSON); // Verify FLOW_FINISHED event is emitted dispatchManager.addListener((event) -> { Event flowEvent = (Event) event; Assert.assertEquals(EventType.FLOW_FINISHED, flowEvent.getType()); try { Mockito.verify(this.containerizedImpl, Mockito.times(1)).deleteContainer(flow1.getExecutionId()); } catch (ExecutorManagerException ignored) {} }); dispatchManager.cancelFlow(flow1, this.user.getUserId()); Assert.assertEquals(apiClient.getExpectedReverseProxyContainerizedURI(), apiClient.getLastBuildExecutorUriRespone()); //Verify that httpPost was requested with the 'cancel' param. Pair cancelAction = new Pair<String, String> ("action", "cancel"); Assert.assertTrue(apiClient.getLastHttpPostParams().stream().anyMatch(pair -> cancelAction.equals(pair))); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testCancelFlow
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testCancelFlowWithMissingExecutor() throws Exception { initializeUnfinishedFlows(); WrappedExecutorApiClient apiClient = new WrappedExecutorApiClient(createContainerDispatchEnabledProps(this.props)); ContainerizedDispatchManager dispatchManager = createDefaultDispatchWithGateway(apiClient); apiClient.setNextHttpPostResponse(WrappedExecutorApiClient.STATUS_SUCCESS_JSON); dispatchManager.cancelFlow(flow1, this.user.getUserId()); Assert.assertEquals(apiClient.getExpectedReverseProxyContainerizedURI(), apiClient.getLastBuildExecutorUriRespone()); //Verify that httpPost was requested with the 'cancel' param. Pair cancelAction = new Pair<String, String> ("action", "cancel"); Assert.assertTrue(apiClient.getLastHttpPostParams().stream().anyMatch(pair -> cancelAction.equals(pair))); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testCancelFlowWithMissingExecutor
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Test public void testFlowFilter() throws Exception { initializeContainerizedDispatchImpl(); // Flow names contained in flow_filter.txt must be loaded. assertTrue(containerizedDispatchManager.getContainerFlowCriteria().flowExists("proj1", "flow1")); assertTrue(containerizedDispatchManager.getContainerFlowCriteria().flowExists("proj2", "flow2")); assertTrue(containerizedDispatchManager.getContainerFlowCriteria().flowExists("proj1", "flow3")); assertFalse(containerizedDispatchManager.getContainerFlowCriteria().flowExists("proj2", "flow4")); // Reload the flow list from another file, it must contain proj2 and flow4 containerizedDispatchManager.getContainerFlowCriteria().reloadFlowFilter("src/test/resources/flow_filter2.txt"); // Flow names contained in flow_filter2.txt must be loaded. assertTrue(containerizedDispatchManager.getContainerFlowCriteria().flowExists("proj1", "flow1")); assertTrue(containerizedDispatchManager.getContainerFlowCriteria().flowExists("proj2", "flow2")); assertTrue(containerizedDispatchManager.getContainerFlowCriteria().flowExists("proj1", "flow3")); assertTrue(containerizedDispatchManager.getContainerFlowCriteria().flowExists("proj2", "flow4")); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
testFlowFilter
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
private Props createContainerDispatchEnabledProps(Props parentProps) { Props containerProps = new Props(parentProps); containerProps.put(ConfigurationKeys.AZKABAN_EXECUTOR_REVERSE_PROXY_ENABLED, "true"); containerProps.put(AZKABAN_EXECUTOR_REVERSE_PROXY_HOSTNAME, REVERSE_PROXY_HOST); containerProps.put(AZKABAN_EXECUTOR_REVERSE_PROXY_PORT, REVERSE_PROXY_PORT); containerProps.put(ConfigurationKeys.AZKABAN_EXECUTION_DISPATCH_METHOD, DispatchMethod.CONTAINERIZED.name()); return containerProps; }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
createContainerDispatchEnabledProps
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
private ContainerizedDispatchManager createDefaultDispatchWithGateway(ExecutorApiClient apiClient) throws Exception { Props containerEnabledProps = createContainerDispatchEnabledProps(this.props); ExecutorApiGateway executorApiGateway = new ExecutorApiGateway(apiClient, containerEnabledProps); return createDispatchWithGateway(executorApiGateway, containerEnabledProps); }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
createDefaultDispatchWithGateway
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
private ContainerizedDispatchManager createDispatchWithGateway(ExecutorApiGateway apiGateway, Props containerEnabledProps) throws Exception { ContainerizedDispatchManager dispatchManager = new ContainerizedDispatchManager(containerEnabledProps, null, this.executorLoader, this.nearlineExecutionLogsLoader, this.offlineExecutionLogsLoader, this.commonMetrics, apiGateway, this.containerizedImpl, null, null, this.eventListener, this.containerizationMetrics, null); dispatchManager.start(); return dispatchManager; }
This test case is verifying that if useExecutor flow param is set then dispatch method should be POLL. @throws Exception
createDispatchWithGateway
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0
@Ignore @Test public void testRestartFlow() throws Exception { initializeContainerizedDispatchImpl(); doAnswer(e -> { throw new ExecutorManagerException("Unable to create container"); }).when(this.containerizedImpl).createContainer(this.flow1.getExecutionId()); when(this.executorLoader.fetchExecutableFlow(this.flow1.getExecutionId())).thenReturn(this.flow1); OnContainerizedExecutionEventListener onExecutionEventListener = mock( OnContainerizedExecutionEventListener.class); ExecutionControllerUtils.onExecutionEventListener = onExecutionEventListener; Thread thread = new Thread( this.containerizedDispatchManager.getExecutionDispatcher(this.flow1.getExecutionId())); thread.start(); synchronized (thread) { thread.join(); } assertThat(flow1.getStatus()).isEqualTo(Status.FAILED); verify(onExecutionEventListener).onExecutionEvent(this.flow1, Constants.RESTART_FLOW); }
This test tries to verify the the flow is finalized and restarted if the dispatch fails. @throws Exception
testRestartFlow
java
azkaban/azkaban
azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
https://github.com/azkaban/azkaban/blob/master/azkaban-common/src/test/java/azkaban/executor/ContainerizedDispatchManagerTest.java
Apache-2.0