id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
27,800 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/common/pathelement/TransposePathElement.java | TransposePathElement.innerParse | private static TransposePathElement innerParse( String originalKey, String meat ) {
char first = meat.charAt( 0 );
if ( Character.isDigit( first ) ) {
// loop until we find a comma or end of string
StringBuilder sb = new StringBuilder().append( first );
for ( int ind... | java | private static TransposePathElement innerParse( String originalKey, String meat ) {
char first = meat.charAt( 0 );
if ( Character.isDigit( first ) ) {
// loop until we find a comma or end of string
StringBuilder sb = new StringBuilder().append( first );
for ( int ind... | [
"private",
"static",
"TransposePathElement",
"innerParse",
"(",
"String",
"originalKey",
",",
"String",
"meat",
")",
"{",
"char",
"first",
"=",
"meat",
".",
"charAt",
"(",
"0",
")",
";",
"if",
"(",
"Character",
".",
"isDigit",
"(",
"first",
")",
")",
"{"... | Parse the core of the TransposePathElement key, once basic errors have been checked and
syntax has been handled.
@param originalKey The original text for reference.
@param meat The string to actually parse into a TransposePathElement
@return TransposePathElement | [
"Parse",
"the",
"core",
"of",
"the",
"TransposePathElement",
"key",
"once",
"basic",
"errors",
"have",
"been",
"checked",
"and",
"syntax",
"has",
"been",
"handled",
"."
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/common/pathelement/TransposePathElement.java#L120-L157 |
27,801 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/common/pathelement/TransposePathElement.java | TransposePathElement.objectEvaluate | public Optional<Object> objectEvaluate( WalkedPath walkedPath ) {
// Grap the data we need from however far up the tree we are supposed to go
PathStep pathStep = walkedPath.elementFromEnd( upLevel );
if ( pathStep == null ) {
return Optional.empty();
}
Object treeRe... | java | public Optional<Object> objectEvaluate( WalkedPath walkedPath ) {
// Grap the data we need from however far up the tree we are supposed to go
PathStep pathStep = walkedPath.elementFromEnd( upLevel );
if ( pathStep == null ) {
return Optional.empty();
}
Object treeRe... | [
"public",
"Optional",
"<",
"Object",
">",
"objectEvaluate",
"(",
"WalkedPath",
"walkedPath",
")",
"{",
"// Grap the data we need from however far up the tree we are supposed to go",
"PathStep",
"pathStep",
"=",
"walkedPath",
".",
"elementFromEnd",
"(",
"upLevel",
")",
";",
... | This method is used when the TransposePathElement is used on the LFH as data.
Aka, normal "evaluate" returns either a Number or a String.
@param walkedPath WalkedPath to evaluate against
@return The data specified by this TransposePathElement. | [
"This",
"method",
"is",
"used",
"when",
"the",
"TransposePathElement",
"is",
"used",
"on",
"the",
"LFH",
"as",
"data",
"."
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/common/pathelement/TransposePathElement.java#L187-L204 |
27,802 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/shiftr/spec/ShiftrLeafSpec.java | ShiftrLeafSpec.apply | @Override
public boolean apply( String inputKey, Optional<Object> inputOptional, WalkedPath walkedPath, Map<String,Object> output, Map<String, Object> context){
Object input = inputOptional.get();
MatchedElement thisLevel = pathElement.match( inputKey, walkedPath );
if ( thisLevel == null )... | java | @Override
public boolean apply( String inputKey, Optional<Object> inputOptional, WalkedPath walkedPath, Map<String,Object> output, Map<String, Object> context){
Object input = inputOptional.get();
MatchedElement thisLevel = pathElement.match( inputKey, walkedPath );
if ( thisLevel == null )... | [
"@",
"Override",
"public",
"boolean",
"apply",
"(",
"String",
"inputKey",
",",
"Optional",
"<",
"Object",
">",
"inputOptional",
",",
"WalkedPath",
"walkedPath",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"output",
",",
"Map",
"<",
"String",
",",
"Objec... | If this Spec matches the inputkey, then do the work of outputting data and return true.
@return true if this this spec "handles" the inputkey such that no sibling specs need to see it | [
"If",
"this",
"Spec",
"matches",
"the",
"inputkey",
"then",
"do",
"the",
"work",
"of",
"outputting",
"data",
"and",
"return",
"true",
"."
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/shiftr/spec/ShiftrLeafSpec.java#L90-L150 |
27,803 | bazaarvoice/jolt | cli/src/main/java/com/bazaarvoice/jolt/JoltCli.java | JoltCli.runJolt | protected static boolean runJolt( String[] args ) {
ArgumentParser parser = ArgumentParsers.newArgumentParser( "jolt" );
Subparsers subparsers = parser.addSubparsers().help( "transform: given a Jolt transform spec, runs the specified transforms on the input data.\n" +
"diffy: diff two JS... | java | protected static boolean runJolt( String[] args ) {
ArgumentParser parser = ArgumentParsers.newArgumentParser( "jolt" );
Subparsers subparsers = parser.addSubparsers().help( "transform: given a Jolt transform spec, runs the specified transforms on the input data.\n" +
"diffy: diff two JS... | [
"protected",
"static",
"boolean",
"runJolt",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"ArgumentParser",
"parser",
"=",
"ArgumentParsers",
".",
"newArgumentParser",
"(",
"\"jolt\"",
")",
";",
"Subparsers",
"subparsers",
"=",
"parser",
".",
"addSubparsers",
"(",... | The logic for running DiffyTool has been captured in a helper method that returns a boolean to facilitate unit testing.
Since System.exit terminates the JVM it would not be practical to test the main method.
@param args the arguments from the command line input
@return true if two inputs were read with no differences,... | [
"The",
"logic",
"for",
"running",
"DiffyTool",
"has",
"been",
"captured",
"in",
"a",
"helper",
"method",
"that",
"returns",
"a",
"boolean",
"to",
"facilitate",
"unit",
"testing",
".",
"Since",
"System",
".",
"exit",
"terminates",
"the",
"JVM",
"it",
"would",... | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/cli/src/main/java/com/bazaarvoice/jolt/JoltCli.java#L52-L77 |
27,804 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/common/PathEvaluatingTraversal.java | PathEvaluatingTraversal.write | public void write( Object data, Map<String, Object> output, WalkedPath walkedPath ) {
List<String> evaledPaths = evaluate( walkedPath );
if ( evaledPaths != null ) {
traversr.set( output, evaledPaths, data );
}
} | java | public void write( Object data, Map<String, Object> output, WalkedPath walkedPath ) {
List<String> evaledPaths = evaluate( walkedPath );
if ( evaledPaths != null ) {
traversr.set( output, evaledPaths, data );
}
} | [
"public",
"void",
"write",
"(",
"Object",
"data",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"output",
",",
"WalkedPath",
"walkedPath",
")",
"{",
"List",
"<",
"String",
">",
"evaledPaths",
"=",
"evaluate",
"(",
"walkedPath",
")",
";",
"if",
"(",
"e... | Use the supplied WalkedPath, in the evaluation of each of our PathElements to
build a concrete output path. Then use that output path to write the given
data to the output.
@param data data to write
@param output data structure we are going to write the data to
@param walkedPath reference used to lookup reference val... | [
"Use",
"the",
"supplied",
"WalkedPath",
"in",
"the",
"evaluation",
"of",
"each",
"of",
"our",
"PathElements",
"to",
"build",
"a",
"concrete",
"output",
"path",
".",
"Then",
"use",
"that",
"output",
"path",
"to",
"write",
"the",
"given",
"data",
"to",
"the"... | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/common/PathEvaluatingTraversal.java#L98-L103 |
27,805 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/common/PathEvaluatingTraversal.java | PathEvaluatingTraversal.getCanonicalForm | public String getCanonicalForm() {
StringBuilder buf = new StringBuilder();
for ( PathElement pe : elements ) {
buf.append( "." ).append( pe.getCanonicalForm() );
}
return buf.substring( 1 ); // strip the leading "."
} | java | public String getCanonicalForm() {
StringBuilder buf = new StringBuilder();
for ( PathElement pe : elements ) {
buf.append( "." ).append( pe.getCanonicalForm() );
}
return buf.substring( 1 ); // strip the leading "."
} | [
"public",
"String",
"getCanonicalForm",
"(",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"PathElement",
"pe",
":",
"elements",
")",
"{",
"buf",
".",
"append",
"(",
"\".\"",
")",
".",
"append",
"(",
"pe",
".... | Testing method. | [
"Testing",
"method",
"."
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/common/PathEvaluatingTraversal.java#L151-L159 |
27,806 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/utils/JoltUtils.java | JoltUtils.navigateSafe | @Deprecated
public static <T> T navigateSafe(final T defaultValue, final Object source, final Object... paths) {
return navigateOrDefault( defaultValue, source, paths );
} | java | @Deprecated
public static <T> T navigateSafe(final T defaultValue, final Object source, final Object... paths) {
return navigateOrDefault( defaultValue, source, paths );
} | [
"@",
"Deprecated",
"public",
"static",
"<",
"T",
">",
"T",
"navigateSafe",
"(",
"final",
"T",
"defaultValue",
",",
"final",
"Object",
"source",
",",
"final",
"Object",
"...",
"paths",
")",
"{",
"return",
"navigateOrDefault",
"(",
"defaultValue",
",",
"source... | Use navigateOrDefault which is a much better name. | [
"Use",
"navigateOrDefault",
"which",
"is",
"a",
"much",
"better",
"name",
"."
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/utils/JoltUtils.java#L236-L239 |
27,807 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/utils/JoltUtils.java | JoltUtils.isVacantJson | public static boolean isVacantJson(final Object obj) {
Collection values = null;
if(obj instanceof Collection) {
if(((Collection) obj).size() == 0) {
return true;
}
values = (Collection) obj;
}
if(obj instanceof Map) {
if(((... | java | public static boolean isVacantJson(final Object obj) {
Collection values = null;
if(obj instanceof Collection) {
if(((Collection) obj).size() == 0) {
return true;
}
values = (Collection) obj;
}
if(obj instanceof Map) {
if(((... | [
"public",
"static",
"boolean",
"isVacantJson",
"(",
"final",
"Object",
"obj",
")",
"{",
"Collection",
"values",
"=",
"null",
";",
"if",
"(",
"obj",
"instanceof",
"Collection",
")",
"{",
"if",
"(",
"(",
"(",
"Collection",
")",
"obj",
")",
".",
"size",
"... | Vacant implies there are empty placeholders, i.e. a vacant hotel
Given a json document, checks if it has any "leaf" values, can handle deep nesting of lists and maps
i.e. { "a": [ "x": {}, "y": [] ], "b": { "p": [], "q": {} }} ==> is empty
@param obj source
@return true if its an empty json, can have deep nesting, fa... | [
"Vacant",
"implies",
"there",
"are",
"empty",
"placeholders",
"i",
".",
"e",
".",
"a",
"vacant",
"hotel",
"Given",
"a",
"json",
"document",
"checks",
"if",
"it",
"has",
"any",
"leaf",
"values",
"can",
"handle",
"deep",
"nesting",
"of",
"lists",
"and",
"m... | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/utils/JoltUtils.java#L252-L279 |
27,808 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/utils/JoltUtils.java | JoltUtils.listKeyChains | public static List<Object[]> listKeyChains(final Object source) {
List<Object[]> keyChainList = new LinkedList<>();
if(source instanceof Map) {
Map sourceMap = (Map) source;
for (Object key: sourceMap.keySet()) {
keyChainList.addAll(listKeyChains(key, sourceMap.... | java | public static List<Object[]> listKeyChains(final Object source) {
List<Object[]> keyChainList = new LinkedList<>();
if(source instanceof Map) {
Map sourceMap = (Map) source;
for (Object key: sourceMap.keySet()) {
keyChainList.addAll(listKeyChains(key, sourceMap.... | [
"public",
"static",
"List",
"<",
"Object",
"[",
"]",
">",
"listKeyChains",
"(",
"final",
"Object",
"source",
")",
"{",
"List",
"<",
"Object",
"[",
"]",
">",
"keyChainList",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"if",
"(",
"source",
"instanceof... | Given a json document, finds out absolute path to every leaf element
i.e. { "a": [ "x": { "y": "alpha" }], "b": { "p": [ "beta", "gamma" ], "q": {} }} will yield
1) "a",0,"x","y" -> to "alpha"
2) "b","p", 0 -> to "beta"
3) "b", "p", 1 -> to "gamma"
4) "b","q" -> to {} (empty Map)
@param source json
@return list of O... | [
"Given",
"a",
"json",
"document",
"finds",
"out",
"absolute",
"path",
"to",
"every",
"leaf",
"element"
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/utils/JoltUtils.java#L314-L335 |
27,809 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/utils/JoltUtils.java | JoltUtils.toSimpleTraversrPath | public static String toSimpleTraversrPath(Object[] paths) {
StringBuilder pathBuilder = new StringBuilder();
for(int i=0; i<paths.length; i++) {
Object path = paths[i];
if(path instanceof Integer) {
pathBuilder.append("[").append(((Integer) path).intValue()).appen... | java | public static String toSimpleTraversrPath(Object[] paths) {
StringBuilder pathBuilder = new StringBuilder();
for(int i=0; i<paths.length; i++) {
Object path = paths[i];
if(path instanceof Integer) {
pathBuilder.append("[").append(((Integer) path).intValue()).appen... | [
"public",
"static",
"String",
"toSimpleTraversrPath",
"(",
"Object",
"[",
"]",
"paths",
")",
"{",
"StringBuilder",
"pathBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"paths",
".",
"length",
";",
... | Converts a standard json path to human readable SimpleTraversr compatible path
@param paths the path array of objects
@return string representation of the path, human readable and SimpleTraversr friendly | [
"Converts",
"a",
"standard",
"json",
"path",
"to",
"human",
"readable",
"SimpleTraversr",
"compatible",
"path"
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/utils/JoltUtils.java#L369-L387 |
27,810 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/utils/JoltUtils.java | JoltUtils.compactJson | @SuppressWarnings("unchecked")
public static Object compactJson(Object source) {
if (source == null) return null;
if (source instanceof List) {
for (Object item : (List) source) {
if (item instanceof List) {
compactJson(item);
}
... | java | @SuppressWarnings("unchecked")
public static Object compactJson(Object source) {
if (source == null) return null;
if (source instanceof List) {
for (Object item : (List) source) {
if (item instanceof List) {
compactJson(item);
}
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"Object",
"compactJson",
"(",
"Object",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"source",
"instanceof",
"List",
")",
"{",
"for",
... | Given a 'fluffy' json document, it recursively removes all null elements
to compact the json document
Warning: mutates the doc, destroys array order
@param source
@return mutated source where all null elements are nuked | [
"Given",
"a",
"fluffy",
"json",
"document",
"it",
"recursively",
"removes",
"all",
"null",
"elements",
"to",
"compact",
"the",
"json",
"document"
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/utils/JoltUtils.java#L420-L464 |
27,811 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/removr/spec/RemovrCompositeSpec.java | RemovrCompositeSpec.processChildren | private void processChildren( List<RemovrSpec> children, Object subInput ) {
if (subInput != null ) {
if( subInput instanceof List ) {
List<Object> subList = (List<Object>) subInput;
Set<Integer> indiciesToRemove = new HashSet<>();
// build a list ... | java | private void processChildren( List<RemovrSpec> children, Object subInput ) {
if (subInput != null ) {
if( subInput instanceof List ) {
List<Object> subList = (List<Object>) subInput;
Set<Integer> indiciesToRemove = new HashSet<>();
// build a list ... | [
"private",
"void",
"processChildren",
"(",
"List",
"<",
"RemovrSpec",
">",
"children",
",",
"Object",
"subInput",
")",
"{",
"if",
"(",
"subInput",
"!=",
"null",
")",
"{",
"if",
"(",
"subInput",
"instanceof",
"List",
")",
"{",
"List",
"<",
"Object",
">",
... | Call our child nodes, build up the set of keys or indices to actually remove, and then
remove them. | [
"Call",
"our",
"child",
"nodes",
"build",
"up",
"the",
"set",
"of",
"keys",
"or",
"indices",
"to",
"actually",
"remove",
"and",
"then",
"remove",
"them",
"."
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/removr/spec/RemovrCompositeSpec.java#L134-L177 |
27,812 | bazaarvoice/jolt | json-utils/src/main/java/com/bazaarvoice/jolt/JsonUtils.java | JsonUtils.jsonTo | @Deprecated
public static <T> T jsonTo( String json, TypeReference<T> typeRef ) {
return util.stringToType( json, typeRef );
} | java | @Deprecated
public static <T> T jsonTo( String json, TypeReference<T> typeRef ) {
return util.stringToType( json, typeRef );
} | [
"@",
"Deprecated",
"public",
"static",
"<",
"T",
">",
"T",
"jsonTo",
"(",
"String",
"json",
",",
"TypeReference",
"<",
"T",
">",
"typeRef",
")",
"{",
"return",
"util",
".",
"stringToType",
"(",
"json",
",",
"typeRef",
")",
";",
"}"
] | Use the stringToType method instead. | [
"Use",
"the",
"stringToType",
"method",
"instead",
"."
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/json-utils/src/main/java/com/bazaarvoice/jolt/JsonUtils.java#L201-L204 |
27,813 | bazaarvoice/jolt | json-utils/src/main/java/com/bazaarvoice/jolt/JsonUtils.java | JsonUtils.navigate | @SuppressWarnings("unchecked")
@Deprecated
public static <T> T navigate(Object source, Object... paths) throws NullPointerException, UnsupportedOperationException {
Object destination = source;
for (Object path : paths) {
if(destination == null) throw new NullPointerException("Naviga... | java | @SuppressWarnings("unchecked")
@Deprecated
public static <T> T navigate(Object source, Object... paths) throws NullPointerException, UnsupportedOperationException {
Object destination = source;
for (Object path : paths) {
if(destination == null) throw new NullPointerException("Naviga... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Deprecated",
"public",
"static",
"<",
"T",
">",
"T",
"navigate",
"(",
"Object",
"source",
",",
"Object",
"...",
"paths",
")",
"throws",
"NullPointerException",
",",
"UnsupportedOperationException",
"{",
"... | Navigate inside a json object in quick and dirty way.
Deprecated: use JoltUtils instead
@param source the source json object
@param paths the paths array to travel
@return the object of Type <T> at final destination
@throws NullPointerException if the source is null
@throws UnsupportedOperationException if the source... | [
"Navigate",
"inside",
"a",
"json",
"object",
"in",
"quick",
"and",
"dirty",
"way",
"."
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/json-utils/src/main/java/com/bazaarvoice/jolt/JsonUtils.java#L246-L257 |
27,814 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/utils/StringTools.java | StringTools.isBlank | public static boolean isBlank(CharSequence sourceSequence) {
int sequenceLength;
if (sourceSequence == null || (sequenceLength = sourceSequence.length()) == 0) {
return true;
}
for (int i = 0; i < sequenceLength; i++) {
if ((Character.isWhitespace(sourceSequence.c... | java | public static boolean isBlank(CharSequence sourceSequence) {
int sequenceLength;
if (sourceSequence == null || (sequenceLength = sourceSequence.length()) == 0) {
return true;
}
for (int i = 0; i < sequenceLength; i++) {
if ((Character.isWhitespace(sourceSequence.c... | [
"public",
"static",
"boolean",
"isBlank",
"(",
"CharSequence",
"sourceSequence",
")",
"{",
"int",
"sequenceLength",
";",
"if",
"(",
"sourceSequence",
"==",
"null",
"||",
"(",
"sequenceLength",
"=",
"sourceSequence",
".",
"length",
"(",
")",
")",
"==",
"0",
"... | Check if a sequence is blank
@param sourceSequence to check
@return true is sourceSequence is blank | [
"Check",
"if",
"a",
"sequence",
"is",
"blank"
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/utils/StringTools.java#L82-L93 |
27,815 | bazaarvoice/jolt | cli/src/main/java/com/bazaarvoice/jolt/SortCliProcessor.java | SortCliProcessor.intializeSubCommand | @Override
public void intializeSubCommand( Subparsers subparsers ) {
Subparser sortParser = subparsers.addParser( "sort" )
.description( "Jolt CLI Sort Tool. This tool will ingest one JSON input (from a file or standard input) and " +
"perform the Jolt sort operation ... | java | @Override
public void intializeSubCommand( Subparsers subparsers ) {
Subparser sortParser = subparsers.addParser( "sort" )
.description( "Jolt CLI Sort Tool. This tool will ingest one JSON input (from a file or standard input) and " +
"perform the Jolt sort operation ... | [
"@",
"Override",
"public",
"void",
"intializeSubCommand",
"(",
"Subparsers",
"subparsers",
")",
"{",
"Subparser",
"sortParser",
"=",
"subparsers",
".",
"addParser",
"(",
"\"sort\"",
")",
".",
"description",
"(",
"\"Jolt CLI Sort Tool. This tool will ingest one JSON input ... | Initialize the arg parser for the Sort sub command
@param subparsers The Subparsers object to attach the new Subparser to | [
"Initialize",
"the",
"arg",
"parser",
"for",
"the",
"Sort",
"sub",
"command"
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/cli/src/main/java/com/bazaarvoice/jolt/SortCliProcessor.java#L38-L55 |
27,816 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/removr/spec/RemovrSpec.java | RemovrSpec.getNonNegativeIntegerFromLiteralPathElement | protected Integer getNonNegativeIntegerFromLiteralPathElement() {
Integer pathElementInt = null;
try {
pathElementInt = Integer.parseInt( pathElement.getRawKey() );
if ( pathElementInt < 0 ) {
return null;
}
}
catch( NumberFormatExce... | java | protected Integer getNonNegativeIntegerFromLiteralPathElement() {
Integer pathElementInt = null;
try {
pathElementInt = Integer.parseInt( pathElement.getRawKey() );
if ( pathElementInt < 0 ) {
return null;
}
}
catch( NumberFormatExce... | [
"protected",
"Integer",
"getNonNegativeIntegerFromLiteralPathElement",
"(",
")",
"{",
"Integer",
"pathElementInt",
"=",
"null",
";",
"try",
"{",
"pathElementInt",
"=",
"Integer",
".",
"parseInt",
"(",
"pathElement",
".",
"getRawKey",
"(",
")",
")",
";",
"if",
"(... | Try to "interpret" the spec String value as a non-negative integer.
@return non-negative integer, otherwise null | [
"Try",
"to",
"interpret",
"the",
"spec",
"String",
"value",
"as",
"a",
"non",
"-",
"negative",
"integer",
"."
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/removr/spec/RemovrSpec.java#L68-L86 |
27,817 | bazaarvoice/jolt | cli/src/main/java/com/bazaarvoice/jolt/TransformCliProcessor.java | TransformCliProcessor.intializeSubCommand | @Override
public void intializeSubCommand( Subparsers subparsers ) {
Subparser transformParser = subparsers.addParser( "transform" )
.description( "Jolt CLI Transform Tool. This tool will ingest a JSON spec file and an JSON input (from a file or " +
"standard input) a... | java | @Override
public void intializeSubCommand( Subparsers subparsers ) {
Subparser transformParser = subparsers.addParser( "transform" )
.description( "Jolt CLI Transform Tool. This tool will ingest a JSON spec file and an JSON input (from a file or " +
"standard input) a... | [
"@",
"Override",
"public",
"void",
"intializeSubCommand",
"(",
"Subparsers",
"subparsers",
")",
"{",
"Subparser",
"transformParser",
"=",
"subparsers",
".",
"addParser",
"(",
"\"transform\"",
")",
".",
"description",
"(",
"\"Jolt CLI Transform Tool. This tool will ingest ... | Initialize the arg parser for the Transform sub command
@param subparsers The Subparsers object to attach the new Subparser to | [
"Initialize",
"the",
"arg",
"parser",
"for",
"the",
"Transform",
"sub",
"command"
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/cli/src/main/java/com/bazaarvoice/jolt/TransformCliProcessor.java#L38-L58 |
27,818 | bazaarvoice/jolt | cli/src/main/java/com/bazaarvoice/jolt/TransformCliProcessor.java | TransformCliProcessor.process | @Override
public boolean process( Namespace ns ) {
Chainr chainr;
try {
chainr = ChainrFactory.fromFile((File) ns.get("spec"));
} catch ( Exception e ) {
JoltCliUtilities.printToStandardOut( "Chainr failed to load spec file.", SUPPRESS_OUTPUT );
e.printSt... | java | @Override
public boolean process( Namespace ns ) {
Chainr chainr;
try {
chainr = ChainrFactory.fromFile((File) ns.get("spec"));
} catch ( Exception e ) {
JoltCliUtilities.printToStandardOut( "Chainr failed to load spec file.", SUPPRESS_OUTPUT );
e.printSt... | [
"@",
"Override",
"public",
"boolean",
"process",
"(",
"Namespace",
"ns",
")",
"{",
"Chainr",
"chainr",
";",
"try",
"{",
"chainr",
"=",
"ChainrFactory",
".",
"fromFile",
"(",
"(",
"File",
")",
"ns",
".",
"get",
"(",
"\"spec\"",
")",
")",
";",
"}",
"ca... | Process the transform sub command
@param ns Namespace which contains parsed commandline arguments
@return true if the transform is successful, false if an error occured | [
"Process",
"the",
"transform",
"sub",
"command"
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/cli/src/main/java/com/bazaarvoice/jolt/TransformCliProcessor.java#L66-L91 |
27,819 | bazaarvoice/jolt | complete/src/main/java/com/bazaarvoice/jolt/ChainrFactory.java | ChainrFactory.fromClassPath | public static Chainr fromClassPath( String chainrSpecClassPath, ChainrInstantiator chainrInstantiator ) {
Object chainrSpec = JsonUtils.classpathToObject( chainrSpecClassPath );
return getChainr( chainrInstantiator, chainrSpec );
} | java | public static Chainr fromClassPath( String chainrSpecClassPath, ChainrInstantiator chainrInstantiator ) {
Object chainrSpec = JsonUtils.classpathToObject( chainrSpecClassPath );
return getChainr( chainrInstantiator, chainrSpec );
} | [
"public",
"static",
"Chainr",
"fromClassPath",
"(",
"String",
"chainrSpecClassPath",
",",
"ChainrInstantiator",
"chainrInstantiator",
")",
"{",
"Object",
"chainrSpec",
"=",
"JsonUtils",
".",
"classpathToObject",
"(",
"chainrSpecClassPath",
")",
";",
"return",
"getChainr... | Builds a Chainr instance using the spec described in the data via the class path that is passed in.
@param chainrSpecClassPath The class path that points to the chainr spec.
@param chainrInstantiator the ChainrInstantiator to use to initialze the Chainr instance
@return a Chainr instance | [
"Builds",
"a",
"Chainr",
"instance",
"using",
"the",
"spec",
"described",
"in",
"the",
"data",
"via",
"the",
"class",
"path",
"that",
"is",
"passed",
"in",
"."
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/complete/src/main/java/com/bazaarvoice/jolt/ChainrFactory.java#L45-L48 |
27,820 | bazaarvoice/jolt | complete/src/main/java/com/bazaarvoice/jolt/ChainrFactory.java | ChainrFactory.fromFileSystem | public static Chainr fromFileSystem( String chainrSpecFilePath, ChainrInstantiator chainrInstantiator ) {
Object chainrSpec = JsonUtils.filepathToObject( chainrSpecFilePath );
return getChainr( chainrInstantiator, chainrSpec );
} | java | public static Chainr fromFileSystem( String chainrSpecFilePath, ChainrInstantiator chainrInstantiator ) {
Object chainrSpec = JsonUtils.filepathToObject( chainrSpecFilePath );
return getChainr( chainrInstantiator, chainrSpec );
} | [
"public",
"static",
"Chainr",
"fromFileSystem",
"(",
"String",
"chainrSpecFilePath",
",",
"ChainrInstantiator",
"chainrInstantiator",
")",
"{",
"Object",
"chainrSpec",
"=",
"JsonUtils",
".",
"filepathToObject",
"(",
"chainrSpecFilePath",
")",
";",
"return",
"getChainr",... | Builds a Chainr instance using the spec described in the data via the file path that is passed in.
@param chainrSpecFilePath The file path that points to the chainr spec.
@param chainrInstantiator the ChainrInstantiator to use to initialze the Chainr instance
@return a Chainr instance | [
"Builds",
"a",
"Chainr",
"instance",
"using",
"the",
"spec",
"described",
"in",
"the",
"data",
"via",
"the",
"file",
"path",
"that",
"is",
"passed",
"in",
"."
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/complete/src/main/java/com/bazaarvoice/jolt/ChainrFactory.java#L67-L70 |
27,821 | bazaarvoice/jolt | complete/src/main/java/com/bazaarvoice/jolt/ChainrFactory.java | ChainrFactory.fromFile | public static Chainr fromFile( File chainrSpecFile, ChainrInstantiator chainrInstantiator ) {
Object chainrSpec;
try {
FileInputStream fileInputStream = new FileInputStream( chainrSpecFile );
chainrSpec = JsonUtils.jsonToObject( fileInputStream );
} catch ( Exception e ) ... | java | public static Chainr fromFile( File chainrSpecFile, ChainrInstantiator chainrInstantiator ) {
Object chainrSpec;
try {
FileInputStream fileInputStream = new FileInputStream( chainrSpecFile );
chainrSpec = JsonUtils.jsonToObject( fileInputStream );
} catch ( Exception e ) ... | [
"public",
"static",
"Chainr",
"fromFile",
"(",
"File",
"chainrSpecFile",
",",
"ChainrInstantiator",
"chainrInstantiator",
")",
"{",
"Object",
"chainrSpec",
";",
"try",
"{",
"FileInputStream",
"fileInputStream",
"=",
"new",
"FileInputStream",
"(",
"chainrSpecFile",
")"... | Builds a Chainr instance using the spec described in the File that is passed in.
@param chainrSpecFile The File which contains the chainr spec.
@param chainrInstantiator the ChainrInstantiator to use to initialze the Chainr instance
@return a Chainr instance | [
"Builds",
"a",
"Chainr",
"instance",
"using",
"the",
"spec",
"described",
"in",
"the",
"File",
"that",
"is",
"passed",
"in",
"."
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/complete/src/main/java/com/bazaarvoice/jolt/ChainrFactory.java#L89-L98 |
27,822 | bazaarvoice/jolt | complete/src/main/java/com/bazaarvoice/jolt/ChainrFactory.java | ChainrFactory.getChainr | private static Chainr getChainr( ChainrInstantiator chainrInstantiator, Object chainrSpec ) {
Chainr chainr;
if (chainrInstantiator == null ) {
chainr = Chainr.fromSpec( chainrSpec );
}
else {
chainr = Chainr.fromSpec( chainrSpec, chainrInstantiator );
}
... | java | private static Chainr getChainr( ChainrInstantiator chainrInstantiator, Object chainrSpec ) {
Chainr chainr;
if (chainrInstantiator == null ) {
chainr = Chainr.fromSpec( chainrSpec );
}
else {
chainr = Chainr.fromSpec( chainrSpec, chainrInstantiator );
}
... | [
"private",
"static",
"Chainr",
"getChainr",
"(",
"ChainrInstantiator",
"chainrInstantiator",
",",
"Object",
"chainrSpec",
")",
"{",
"Chainr",
"chainr",
";",
"if",
"(",
"chainrInstantiator",
"==",
"null",
")",
"{",
"chainr",
"=",
"Chainr",
".",
"fromSpec",
"(",
... | The main engine in ChainrFactory for building a Chainr Instance.
@param chainrInstantiator The ChainrInstantiator to use. If null it will not be used.
@param chainrSpec The json spec for the chainr transformation
@return the Chainr instance created from the chainrInstantiator and inputStream | [
"The",
"main",
"engine",
"in",
"ChainrFactory",
"for",
"building",
"a",
"Chainr",
"Instance",
"."
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/complete/src/main/java/com/bazaarvoice/jolt/ChainrFactory.java#L107-L116 |
27,823 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/Removr.java | Removr.transform | @Override
public Object transform( Object input ) {
// Wrap the input in a map to fool the CompositeSpec to recurse itself.
Map<String,Object> wrappedMap = new HashMap<>();
wrappedMap.put(ROOT_KEY, input);
rootSpec.applyToMap( wrappedMap );
return input;
} | java | @Override
public Object transform( Object input ) {
// Wrap the input in a map to fool the CompositeSpec to recurse itself.
Map<String,Object> wrappedMap = new HashMap<>();
wrappedMap.put(ROOT_KEY, input);
rootSpec.applyToMap( wrappedMap );
return input;
} | [
"@",
"Override",
"public",
"Object",
"transform",
"(",
"Object",
"input",
")",
"{",
"// Wrap the input in a map to fool the CompositeSpec to recurse itself.",
"Map",
"<",
"String",
",",
"Object",
">",
"wrappedMap",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"wrappe... | Recursively removes data from the input JSON.
@param input the JSON object to transform in plain vanilla Jackson Map<String, Object> style | [
"Recursively",
"removes",
"data",
"from",
"the",
"input",
"JSON",
"."
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/Removr.java#L205-L213 |
27,824 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/Shiftr.java | Shiftr.transform | @Override
public Object transform( Object input ) {
Map<String,Object> output = new HashMap<>();
// Create a root LiteralPathElement so that # is useful at the root level
MatchedElement rootLpe = new MatchedElement( ROOT_KEY );
WalkedPath walkedPath = new WalkedPath();
walk... | java | @Override
public Object transform( Object input ) {
Map<String,Object> output = new HashMap<>();
// Create a root LiteralPathElement so that # is useful at the root level
MatchedElement rootLpe = new MatchedElement( ROOT_KEY );
WalkedPath walkedPath = new WalkedPath();
walk... | [
"@",
"Override",
"public",
"Object",
"transform",
"(",
"Object",
"input",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"output",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"// Create a root LiteralPathElement so that # is useful at the root level",
"MatchedE... | Applies the Shiftr transform.
@param input the JSON object to transform
@return the output object with data shifted to it
@throws com.bazaarvoice.jolt.exception.TransformException for a malformed spec or if there are issues during
the transform | [
"Applies",
"the",
"Shiftr",
"transform",
"."
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/Shiftr.java#L495-L508 |
27,825 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/common/PathElementBuilder.java | PathElementBuilder.buildMatchablePathElement | public static MatchablePathElement buildMatchablePathElement(String rawJsonKey) {
PathElement pe = PathElementBuilder.parseSingleKeyLHS( rawJsonKey );
if ( ! ( pe instanceof MatchablePathElement ) ) {
throw new SpecException( "Spec LHS key=" + rawJsonKey + " is not a valid LHS key." );
... | java | public static MatchablePathElement buildMatchablePathElement(String rawJsonKey) {
PathElement pe = PathElementBuilder.parseSingleKeyLHS( rawJsonKey );
if ( ! ( pe instanceof MatchablePathElement ) ) {
throw new SpecException( "Spec LHS key=" + rawJsonKey + " is not a valid LHS key." );
... | [
"public",
"static",
"MatchablePathElement",
"buildMatchablePathElement",
"(",
"String",
"rawJsonKey",
")",
"{",
"PathElement",
"pe",
"=",
"PathElementBuilder",
".",
"parseSingleKeyLHS",
"(",
"rawJsonKey",
")",
";",
"if",
"(",
"!",
"(",
"pe",
"instanceof",
"Matchable... | Create a path element and ensures it is a Matchable Path Element | [
"Create",
"a",
"path",
"element",
"and",
"ensures",
"it",
"is",
"a",
"Matchable",
"Path",
"Element"
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/common/PathElementBuilder.java#L55-L63 |
27,826 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/common/PathElementBuilder.java | PathElementBuilder.parseSingleKeyLHS | public static PathElement parseSingleKeyLHS( String origKey ) {
String elementKey; // the String to use to actually make Elements
String keyToInspect; // the String to use to determine which kind of Element to create
if ( origKey.contains( "\\" ) ) {
// only do the extra work of... | java | public static PathElement parseSingleKeyLHS( String origKey ) {
String elementKey; // the String to use to actually make Elements
String keyToInspect; // the String to use to determine which kind of Element to create
if ( origKey.contains( "\\" ) ) {
// only do the extra work of... | [
"public",
"static",
"PathElement",
"parseSingleKeyLHS",
"(",
"String",
"origKey",
")",
"{",
"String",
"elementKey",
";",
"// the String to use to actually make Elements",
"String",
"keyToInspect",
";",
"// the String to use to determine which kind of Element to create",
"if",
"("... | Visible for Testing.
Inspects the key in a particular order to determine the correct sublass of
PathElement to create.
@param origKey String that should represent a single PathElement
@return a concrete implementation of PathElement | [
"Visible",
"for",
"Testing",
"."
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/common/PathElementBuilder.java#L74-L151 |
27,827 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/common/PathElementBuilder.java | PathElementBuilder.parseDotNotationRHS | public static List<PathElement> parseDotNotationRHS( String dotNotation ) {
String fixedNotation = fixLeadingBracketSugar( dotNotation );
List<String> pathStrs = parseDotNotation( new LinkedList<String>(), stringIterator( fixedNotation ), dotNotation );
return parseList( pathStrs, dotNotation )... | java | public static List<PathElement> parseDotNotationRHS( String dotNotation ) {
String fixedNotation = fixLeadingBracketSugar( dotNotation );
List<String> pathStrs = parseDotNotation( new LinkedList<String>(), stringIterator( fixedNotation ), dotNotation );
return parseList( pathStrs, dotNotation )... | [
"public",
"static",
"List",
"<",
"PathElement",
">",
"parseDotNotationRHS",
"(",
"String",
"dotNotation",
")",
"{",
"String",
"fixedNotation",
"=",
"fixLeadingBracketSugar",
"(",
"dotNotation",
")",
";",
"List",
"<",
"String",
">",
"pathStrs",
"=",
"parseDotNotati... | Parse the dotNotation of the RHS. | [
"Parse",
"the",
"dotNotation",
"of",
"the",
"RHS",
"."
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/common/PathElementBuilder.java#L156-L161 |
27,828 | bazaarvoice/jolt | cli/src/main/java/com/bazaarvoice/jolt/DiffyCliProcessor.java | DiffyCliProcessor.intializeSubCommand | @Override
public void intializeSubCommand( Subparsers subparsers ) {
Subparser diffyParser = subparsers.addParser( "diffy" )
.description( "Jolt CLI Diffy Tool. This tool will ingest two JSON inputs (from files or standard input) and " +
"perform the Jolt Diffy operat... | java | @Override
public void intializeSubCommand( Subparsers subparsers ) {
Subparser diffyParser = subparsers.addParser( "diffy" )
.description( "Jolt CLI Diffy Tool. This tool will ingest two JSON inputs (from files or standard input) and " +
"perform the Jolt Diffy operat... | [
"@",
"Override",
"public",
"void",
"intializeSubCommand",
"(",
"Subparsers",
"subparsers",
")",
"{",
"Subparser",
"diffyParser",
"=",
"subparsers",
".",
"addParser",
"(",
"\"diffy\"",
")",
".",
"description",
"(",
"\"Jolt CLI Diffy Tool. This tool will ingest two JSON inp... | Initialize the arg parser for the Diffy sub command
@param subparsers The Subparsers object to attach the new Subparser to | [
"Initialize",
"the",
"arg",
"parser",
"for",
"the",
"Diffy",
"sub",
"command"
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/cli/src/main/java/com/bazaarvoice/jolt/DiffyCliProcessor.java#L36-L57 |
27,829 | bazaarvoice/jolt | cli/src/main/java/com/bazaarvoice/jolt/DiffyCliProcessor.java | DiffyCliProcessor.process | @Override
public boolean process( Namespace ns ) {
boolean suppressOutput = ns.getBoolean( "s" );
Object jsonObject1 = JoltCliUtilities.createJsonObjectFromFile( (File) ns.get( "filePath1" ), suppressOutput );
File file = ns.get( "filePath2" );
Object jsonObject2 = JoltCliUtilities.... | java | @Override
public boolean process( Namespace ns ) {
boolean suppressOutput = ns.getBoolean( "s" );
Object jsonObject1 = JoltCliUtilities.createJsonObjectFromFile( (File) ns.get( "filePath1" ), suppressOutput );
File file = ns.get( "filePath2" );
Object jsonObject2 = JoltCliUtilities.... | [
"@",
"Override",
"public",
"boolean",
"process",
"(",
"Namespace",
"ns",
")",
"{",
"boolean",
"suppressOutput",
"=",
"ns",
".",
"getBoolean",
"(",
"\"s\"",
")",
";",
"Object",
"jsonObject1",
"=",
"JoltCliUtilities",
".",
"createJsonObjectFromFile",
"(",
"(",
"... | Process the Diffy Subcommand
@param ns Namespace which contains parsed commandline arguments
@return true if no differences are found, false if a difference is found or an error occurs | [
"Process",
"the",
"Diffy",
"Subcommand"
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/cli/src/main/java/com/bazaarvoice/jolt/DiffyCliProcessor.java#L65-L97 |
27,830 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/common/SpecStringParser.java | SpecStringParser.parseDotNotation | public static List<String> parseDotNotation( List<String> pathStrings, Iterator<Character> iter,
String dotNotationRef ) {
if ( ! iter.hasNext() ) {
return pathStrings;
}
// Leave the forward slashes, unless it precedes a "."
... | java | public static List<String> parseDotNotation( List<String> pathStrings, Iterator<Character> iter,
String dotNotationRef ) {
if ( ! iter.hasNext() ) {
return pathStrings;
}
// Leave the forward slashes, unless it precedes a "."
... | [
"public",
"static",
"List",
"<",
"String",
">",
"parseDotNotation",
"(",
"List",
"<",
"String",
">",
"pathStrings",
",",
"Iterator",
"<",
"Character",
">",
"iter",
",",
"String",
"dotNotationRef",
")",
"{",
"if",
"(",
"!",
"iter",
".",
"hasNext",
"(",
")... | Method that recursively parses a dotNotation String based on an iterator.
This method will call out to parseAtPathElement
@param pathStrings List to store parsed Strings that each represent a PathElement
@param iter the iterator to pull characters from
@param dotNotationRef the original dotNotation string used for er... | [
"Method",
"that",
"recursively",
"parses",
"a",
"dotNotation",
"String",
"based",
"on",
"an",
"iterator",
"."
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/common/SpecStringParser.java#L45-L109 |
27,831 | bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/common/SpecStringParser.java | SpecStringParser.removeEscapeChars | public static String removeEscapeChars( String origKey ) {
StringBuilder sb = new StringBuilder();
boolean prevWasEscape = false;
for ( char c : origKey.toCharArray() ) {
if ( '\\' == c ) {
if ( prevWasEscape ) {
sb.append( c );
... | java | public static String removeEscapeChars( String origKey ) {
StringBuilder sb = new StringBuilder();
boolean prevWasEscape = false;
for ( char c : origKey.toCharArray() ) {
if ( '\\' == c ) {
if ( prevWasEscape ) {
sb.append( c );
... | [
"public",
"static",
"String",
"removeEscapeChars",
"(",
"String",
"origKey",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"prevWasEscape",
"=",
"false",
";",
"for",
"(",
"char",
"c",
":",
"origKey",
".",
"toCharArra... | given "rating\\pants" -> "rating\pants" escape the escape char | [
"given",
"rating",
"\\\\",
"pants",
"-",
">",
"rating",
"\\",
"pants",
"escape",
"the",
"escape",
"char"
] | 4cf866a9f4222142da41b50dbcccce022a956bff | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/common/SpecStringParser.java#L283-L304 |
27,832 | apache/incubator-heron | heron/instance/src/java/org/apache/heron/instance/AbstractOutputCollector.java | AbstractOutputCollector.sendOutState | public void sendOutState(State<Serializable, Serializable> state,
String checkpointId,
boolean spillState,
String location) {
outputter.sendOutState(state, checkpointId, spillState, location);
} | java | public void sendOutState(State<Serializable, Serializable> state,
String checkpointId,
boolean spillState,
String location) {
outputter.sendOutState(state, checkpointId, spillState, location);
} | [
"public",
"void",
"sendOutState",
"(",
"State",
"<",
"Serializable",
",",
"Serializable",
">",
"state",
",",
"String",
"checkpointId",
",",
"boolean",
"spillState",
",",
"String",
"location",
")",
"{",
"outputter",
".",
"sendOutState",
"(",
"state",
",",
"chec... | Flush the states | [
"Flush",
"the",
"states"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/instance/src/java/org/apache/heron/instance/AbstractOutputCollector.java#L116-L121 |
27,833 | apache/incubator-heron | storm-compatibility/src/java/org/apache/storm/task/GeneralTopologyContext.java | GeneralTopologyContext.getRawTopology | @SuppressWarnings("deprecation")
public StormTopology getRawTopology() {
StormTopology stormTopology = new StormTopology();
Map<String, SpoutSpec> spouts = new HashMap<>();
for (TopologyAPI.Spout spout : this.delegate.getRawTopology().getSpoutsList()) {
spouts.put(spout.getComp().getName(), new Spo... | java | @SuppressWarnings("deprecation")
public StormTopology getRawTopology() {
StormTopology stormTopology = new StormTopology();
Map<String, SpoutSpec> spouts = new HashMap<>();
for (TopologyAPI.Spout spout : this.delegate.getRawTopology().getSpoutsList()) {
spouts.put(spout.getComp().getName(), new Spo... | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"StormTopology",
"getRawTopology",
"(",
")",
"{",
"StormTopology",
"stormTopology",
"=",
"new",
"StormTopology",
"(",
")",
";",
"Map",
"<",
"String",
",",
"SpoutSpec",
">",
"spouts",
"=",
"new",
"... | Gets the Thrift object representing the topology.
@return the Thrift definition representing the topology | [
"Gets",
"the",
"Thrift",
"object",
"representing",
"the",
"topology",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/storm-compatibility/src/java/org/apache/storm/task/GeneralTopologyContext.java#L70-L87 |
27,834 | apache/incubator-heron | heron/simulator/src/java/org/apache/heron/simulator/executors/StreamExecutor.java | StreamExecutor.handleInstanceExecutor | public void handleInstanceExecutor() {
for (InstanceExecutor executor : taskIdToInstanceExecutor.values()) {
boolean isLocalSpout = spoutSets.contains(executor.getComponentName());
int taskId = executor.getTaskId();
int items = executor.getStreamOutQueue().size();
for (int i = 0; i < items;... | java | public void handleInstanceExecutor() {
for (InstanceExecutor executor : taskIdToInstanceExecutor.values()) {
boolean isLocalSpout = spoutSets.contains(executor.getComponentName());
int taskId = executor.getTaskId();
int items = executor.getStreamOutQueue().size();
for (int i = 0; i < items;... | [
"public",
"void",
"handleInstanceExecutor",
"(",
")",
"{",
"for",
"(",
"InstanceExecutor",
"executor",
":",
"taskIdToInstanceExecutor",
".",
"values",
"(",
")",
")",
"{",
"boolean",
"isLocalSpout",
"=",
"spoutSets",
".",
"contains",
"(",
"executor",
".",
"getCom... | Handle the execution of the instance | [
"Handle",
"the",
"execution",
"of",
"the",
"instance"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/simulator/src/java/org/apache/heron/simulator/executors/StreamExecutor.java#L131-L172 |
27,835 | apache/incubator-heron | heron/simulator/src/java/org/apache/heron/simulator/executors/StreamExecutor.java | StreamExecutor.isSendTuplesToInstance | protected boolean isSendTuplesToInstance(List<Integer> taskIds) {
for (Integer taskId : taskIds) {
if (taskIdToInstanceExecutor.get(taskId).getStreamInQueue().remainingCapacity() <= 0) {
return false;
}
}
return true;
} | java | protected boolean isSendTuplesToInstance(List<Integer> taskIds) {
for (Integer taskId : taskIds) {
if (taskIdToInstanceExecutor.get(taskId).getStreamInQueue().remainingCapacity() <= 0) {
return false;
}
}
return true;
} | [
"protected",
"boolean",
"isSendTuplesToInstance",
"(",
"List",
"<",
"Integer",
">",
"taskIds",
")",
"{",
"for",
"(",
"Integer",
"taskId",
":",
"taskIds",
")",
"{",
"if",
"(",
"taskIdToInstanceExecutor",
".",
"get",
"(",
"taskId",
")",
".",
"getStreamInQueue",
... | Check whether target destination task has free room to receive more tuples | [
"Check",
"whether",
"target",
"destination",
"task",
"has",
"free",
"room",
"to",
"receive",
"more",
"tuples"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/simulator/src/java/org/apache/heron/simulator/executors/StreamExecutor.java#L175-L183 |
27,836 | apache/incubator-heron | heron/simulator/src/java/org/apache/heron/simulator/executors/StreamExecutor.java | StreamExecutor.copyDataOutBound | protected void copyDataOutBound(int sourceTaskId,
boolean isLocalSpout,
TopologyAPI.StreamId streamId,
HeronTuples.HeronDataTuple tuple,
List<Integer> outTasks) {
boolean firstIter... | java | protected void copyDataOutBound(int sourceTaskId,
boolean isLocalSpout,
TopologyAPI.StreamId streamId,
HeronTuples.HeronDataTuple tuple,
List<Integer> outTasks) {
boolean firstIter... | [
"protected",
"void",
"copyDataOutBound",
"(",
"int",
"sourceTaskId",
",",
"boolean",
"isLocalSpout",
",",
"TopologyAPI",
".",
"StreamId",
"streamId",
",",
"HeronTuples",
".",
"HeronDataTuple",
"tuple",
",",
"List",
"<",
"Integer",
">",
"outTasks",
")",
"{",
"boo... | Process HeronDataTuple and insert it into cache | [
"Process",
"HeronDataTuple",
"and",
"insert",
"it",
"into",
"cache"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/simulator/src/java/org/apache/heron/simulator/executors/StreamExecutor.java#L186-L222 |
27,837 | apache/incubator-heron | heron/simulator/src/java/org/apache/heron/simulator/executors/StreamExecutor.java | StreamExecutor.copyControlOutBound | protected void copyControlOutBound(int srcTaskId,
HeronTuples.AckTuple control,
boolean isSuccess) {
for (HeronTuples.RootId rootId : control.getRootsList()) {
HeronTuples.AckTuple t =
HeronTuples.AckTuple.newBuilder().
... | java | protected void copyControlOutBound(int srcTaskId,
HeronTuples.AckTuple control,
boolean isSuccess) {
for (HeronTuples.RootId rootId : control.getRootsList()) {
HeronTuples.AckTuple t =
HeronTuples.AckTuple.newBuilder().
... | [
"protected",
"void",
"copyControlOutBound",
"(",
"int",
"srcTaskId",
",",
"HeronTuples",
".",
"AckTuple",
"control",
",",
"boolean",
"isSuccess",
")",
"{",
"for",
"(",
"HeronTuples",
".",
"RootId",
"rootId",
":",
"control",
".",
"getRootsList",
"(",
")",
")",
... | Process HeronAckTuple and insert it into cache | [
"Process",
"HeronAckTuple",
"and",
"insert",
"it",
"into",
"cache"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/simulator/src/java/org/apache/heron/simulator/executors/StreamExecutor.java#L225-L241 |
27,838 | apache/incubator-heron | heron/simulator/src/java/org/apache/heron/simulator/executors/StreamExecutor.java | StreamExecutor.processAcksAndFails | protected void processAcksAndFails(int srcTaskId, int taskId,
HeronTuples.HeronControlTupleSet controlTupleSet) {
HeronTuples.HeronTupleSet.Builder out = HeronTuples.HeronTupleSet.newBuilder();
out.setSrcTaskId(srcTaskId);
// First go over emits. This makes sure that ne... | java | protected void processAcksAndFails(int srcTaskId, int taskId,
HeronTuples.HeronControlTupleSet controlTupleSet) {
HeronTuples.HeronTupleSet.Builder out = HeronTuples.HeronTupleSet.newBuilder();
out.setSrcTaskId(srcTaskId);
// First go over emits. This makes sure that ne... | [
"protected",
"void",
"processAcksAndFails",
"(",
"int",
"srcTaskId",
",",
"int",
"taskId",
",",
"HeronTuples",
".",
"HeronControlTupleSet",
"controlTupleSet",
")",
"{",
"HeronTuples",
".",
"HeronTupleSet",
".",
"Builder",
"out",
"=",
"HeronTuples",
".",
"HeronTupleS... | Do the XOR control and send the ack tuples to instance if necessary | [
"Do",
"the",
"XOR",
"control",
"and",
"send",
"the",
"ack",
"tuples",
"to",
"instance",
"if",
"necessary"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/simulator/src/java/org/apache/heron/simulator/executors/StreamExecutor.java#L244-L297 |
27,839 | apache/incubator-heron | heron/simulator/src/java/org/apache/heron/simulator/executors/StreamExecutor.java | StreamExecutor.drainCache | protected void drainCache() {
// Route the tuples to correct places
Map<Integer, List<HeronTuples.HeronTupleSet>> cache = tupleCache.getCache();
if (!isSendTuplesToInstance(new LinkedList<Integer>(cache.keySet()))) {
// Check whether we could send tuples
return;
}
for (Map.Entry<Intege... | java | protected void drainCache() {
// Route the tuples to correct places
Map<Integer, List<HeronTuples.HeronTupleSet>> cache = tupleCache.getCache();
if (!isSendTuplesToInstance(new LinkedList<Integer>(cache.keySet()))) {
// Check whether we could send tuples
return;
}
for (Map.Entry<Intege... | [
"protected",
"void",
"drainCache",
"(",
")",
"{",
"// Route the tuples to correct places",
"Map",
"<",
"Integer",
",",
"List",
"<",
"HeronTuples",
".",
"HeronTupleSet",
">",
">",
"cache",
"=",
"tupleCache",
".",
"getCache",
"(",
")",
";",
"if",
"(",
"!",
"is... | Drain the TupleCache if there are room in destination tasks | [
"Drain",
"the",
"TupleCache",
"if",
"there",
"are",
"room",
"in",
"destination",
"tasks"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/simulator/src/java/org/apache/heron/simulator/executors/StreamExecutor.java#L300-L318 |
27,840 | apache/incubator-heron | heron/simulator/src/java/org/apache/heron/simulator/executors/StreamExecutor.java | StreamExecutor.sendInBound | protected void sendInBound(int taskId, HeronTuples.HeronTupleSet message) {
if (message.hasData()) {
sendMessageToInstance(taskId, message);
}
if (message.hasControl()) {
processAcksAndFails(message.getSrcTaskId(), taskId, message.getControl());
}
} | java | protected void sendInBound(int taskId, HeronTuples.HeronTupleSet message) {
if (message.hasData()) {
sendMessageToInstance(taskId, message);
}
if (message.hasControl()) {
processAcksAndFails(message.getSrcTaskId(), taskId, message.getControl());
}
} | [
"protected",
"void",
"sendInBound",
"(",
"int",
"taskId",
",",
"HeronTuples",
".",
"HeronTupleSet",
"message",
")",
"{",
"if",
"(",
"message",
".",
"hasData",
"(",
")",
")",
"{",
"sendMessageToInstance",
"(",
"taskId",
",",
"message",
")",
";",
"}",
"if",
... | Send Stream to instance | [
"Send",
"Stream",
"to",
"instance"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/simulator/src/java/org/apache/heron/simulator/executors/StreamExecutor.java#L321-L329 |
27,841 | apache/incubator-heron | heron/simulator/src/java/org/apache/heron/simulator/executors/StreamExecutor.java | StreamExecutor.sendMessageToInstance | protected void sendMessageToInstance(int taskId, HeronTuples.HeronTupleSet message) {
taskIdToInstanceExecutor.get(taskId).getStreamInQueue().offer(message);
} | java | protected void sendMessageToInstance(int taskId, HeronTuples.HeronTupleSet message) {
taskIdToInstanceExecutor.get(taskId).getStreamInQueue().offer(message);
} | [
"protected",
"void",
"sendMessageToInstance",
"(",
"int",
"taskId",
",",
"HeronTuples",
".",
"HeronTupleSet",
"message",
")",
"{",
"taskIdToInstanceExecutor",
".",
"get",
"(",
"taskId",
")",
".",
"getStreamInQueue",
"(",
")",
".",
"offer",
"(",
"message",
")",
... | Send one message to target task | [
"Send",
"one",
"message",
"to",
"target",
"task"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/simulator/src/java/org/apache/heron/simulator/executors/StreamExecutor.java#L332-L334 |
27,842 | apache/incubator-heron | heron/packing/src/java/org/apache/heron/packing/utils/PackingUtils.java | PackingUtils.getComponentResourceMap | public static Map<String, Resource> getComponentResourceMap(
Set<String> components,
Map<String, ByteAmount> componentRamMap,
Map<String, Double> componentCpuMap,
Map<String, ByteAmount> componentDiskMap,
Resource defaultInstanceResource) {
Map<String, Resource> componentResourceMap = ... | java | public static Map<String, Resource> getComponentResourceMap(
Set<String> components,
Map<String, ByteAmount> componentRamMap,
Map<String, Double> componentCpuMap,
Map<String, ByteAmount> componentDiskMap,
Resource defaultInstanceResource) {
Map<String, Resource> componentResourceMap = ... | [
"public",
"static",
"Map",
"<",
"String",
",",
"Resource",
">",
"getComponentResourceMap",
"(",
"Set",
"<",
"String",
">",
"components",
",",
"Map",
"<",
"String",
",",
"ByteAmount",
">",
"componentRamMap",
",",
"Map",
"<",
"String",
",",
"Double",
">",
"c... | Compose the component resource map by reading from user configs or default
@param components component names
@param componentRamMap user configured component ram map
@param componentCpuMap user configured component cpu map
@param componentDiskMap user configured component disk map
@param defaultInstanceResource defaul... | [
"Compose",
"the",
"component",
"resource",
"map",
"by",
"reading",
"from",
"user",
"configs",
"or",
"default"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/packing/src/java/org/apache/heron/packing/utils/PackingUtils.java#L58-L76 |
27,843 | apache/incubator-heron | heron/packing/src/java/org/apache/heron/packing/utils/PackingUtils.java | PackingUtils.getComponentsToScale | public static Map<String, Integer> getComponentsToScale(Map<String,
Integer> componentChanges, ScalingDirection scalingDirection) {
Map<String, Integer> componentsToScale = new HashMap<String, Integer>();
for (String component : componentChanges.keySet()) {
int parallelismChange = componentChanges.g... | java | public static Map<String, Integer> getComponentsToScale(Map<String,
Integer> componentChanges, ScalingDirection scalingDirection) {
Map<String, Integer> componentsToScale = new HashMap<String, Integer>();
for (String component : componentChanges.keySet()) {
int parallelismChange = componentChanges.g... | [
"public",
"static",
"Map",
"<",
"String",
",",
"Integer",
">",
"getComponentsToScale",
"(",
"Map",
"<",
"String",
",",
"Integer",
">",
"componentChanges",
",",
"ScalingDirection",
"scalingDirection",
")",
"{",
"Map",
"<",
"String",
",",
"Integer",
">",
"compon... | Identifies which components need to be scaled given specific scaling direction
@return Map < component name, scale factor > | [
"Identifies",
"which",
"components",
"need",
"to",
"be",
"scaled",
"given",
"specific",
"scaling",
"direction"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/packing/src/java/org/apache/heron/packing/utils/PackingUtils.java#L111-L121 |
27,844 | apache/incubator-heron | heron/packing/src/java/org/apache/heron/packing/utils/PackingUtils.java | PackingUtils.computeTotalResourceChange | public static Resource computeTotalResourceChange(TopologyAPI.Topology topology,
Map<String, Integer> componentChanges,
Resource defaultInstanceResources,
ScalingDi... | java | public static Resource computeTotalResourceChange(TopologyAPI.Topology topology,
Map<String, Integer> componentChanges,
Resource defaultInstanceResources,
ScalingDi... | [
"public",
"static",
"Resource",
"computeTotalResourceChange",
"(",
"TopologyAPI",
".",
"Topology",
"topology",
",",
"Map",
"<",
"String",
",",
"Integer",
">",
"componentChanges",
",",
"Resource",
"defaultInstanceResources",
",",
"ScalingDirection",
"scalingDirection",
"... | Identifies the resources reclaimed by the components that will be scaled down
@return Total resources reclaimed | [
"Identifies",
"the",
"resources",
"reclaimed",
"by",
"the",
"components",
"that",
"will",
"be",
"scaled",
"down"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/packing/src/java/org/apache/heron/packing/utils/PackingUtils.java#L128-L149 |
27,845 | apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/RuntimeManagerMain.java | RuntimeManagerMain.constructHelpOptions | private static Options constructHelpOptions() {
Options options = new Options();
Option help = Option.builder("h")
.desc("List all options and their description")
.longOpt("help")
.build();
options.addOption(help);
return options;
} | java | private static Options constructHelpOptions() {
Options options = new Options();
Option help = Option.builder("h")
.desc("List all options and their description")
.longOpt("help")
.build();
options.addOption(help);
return options;
} | [
"private",
"static",
"Options",
"constructHelpOptions",
"(",
")",
"{",
"Options",
"options",
"=",
"new",
"Options",
"(",
")",
";",
"Option",
"help",
"=",
"Option",
".",
"builder",
"(",
"\"h\"",
")",
".",
"desc",
"(",
"\"List all options and their description\"",... | construct command line help options | [
"construct",
"command",
"line",
"help",
"options"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/RuntimeManagerMain.java#L213-L222 |
27,846 | apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/RuntimeManagerMain.java | RuntimeManagerMain.manageTopology | public void manageTopology()
throws TopologyRuntimeManagementException, TMasterException, PackingException {
String topologyName = Context.topologyName(config);
// 1. Do prepare work
// create an instance of state manager
String statemgrClass = Context.stateManagerClass(config);
IStateManager ... | java | public void manageTopology()
throws TopologyRuntimeManagementException, TMasterException, PackingException {
String topologyName = Context.topologyName(config);
// 1. Do prepare work
// create an instance of state manager
String statemgrClass = Context.stateManagerClass(config);
IStateManager ... | [
"public",
"void",
"manageTopology",
"(",
")",
"throws",
"TopologyRuntimeManagementException",
",",
"TMasterException",
",",
"PackingException",
"{",
"String",
"topologyName",
"=",
"Context",
".",
"topologyName",
"(",
"config",
")",
";",
"// 1. Do prepare work",
"// crea... | Manager a topology
1. Instantiate necessary resources
2. Valid whether the runtime management is legal
3. Complete the runtime management for a specific command | [
"Manager",
"a",
"topology",
"1",
".",
"Instantiate",
"necessary",
"resources",
"2",
".",
"Valid",
"whether",
"the",
"runtime",
"management",
"is",
"legal",
"3",
".",
"Complete",
"the",
"runtime",
"management",
"for",
"a",
"specific",
"command"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/RuntimeManagerMain.java#L373-L419 |
27,847 | apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/RuntimeManagerMain.java | RuntimeManagerMain.validateExecutionState | protected void validateExecutionState(
String topologyName,
ExecutionEnvironment.ExecutionState executionState)
throws TopologyRuntimeManagementException {
String stateCluster = executionState.getCluster();
String stateRole = executionState.getRole();
String stateEnv = executionState.getEn... | java | protected void validateExecutionState(
String topologyName,
ExecutionEnvironment.ExecutionState executionState)
throws TopologyRuntimeManagementException {
String stateCluster = executionState.getCluster();
String stateRole = executionState.getRole();
String stateEnv = executionState.getEn... | [
"protected",
"void",
"validateExecutionState",
"(",
"String",
"topologyName",
",",
"ExecutionEnvironment",
".",
"ExecutionState",
"executionState",
")",
"throws",
"TopologyRuntimeManagementException",
"{",
"String",
"stateCluster",
"=",
"executionState",
".",
"getCluster",
... | Verify that the environment information in execution state matches the request | [
"Verify",
"that",
"the",
"environment",
"information",
"in",
"execution",
"state",
"matches",
"the",
"request"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/RuntimeManagerMain.java#L465-L485 |
27,848 | apache/incubator-heron | heron/api/src/java/org/apache/heron/api/tuple/Fields.java | Fields.fieldIndex | public int fieldIndex(String field) {
Integer ret = mIndex.get(field);
if (ret == null) {
throw new IllegalArgumentException(field + " does not exist");
}
return ret;
} | java | public int fieldIndex(String field) {
Integer ret = mIndex.get(field);
if (ret == null) {
throw new IllegalArgumentException(field + " does not exist");
}
return ret;
} | [
"public",
"int",
"fieldIndex",
"(",
"String",
"field",
")",
"{",
"Integer",
"ret",
"=",
"mIndex",
".",
"get",
"(",
"field",
")",
";",
"if",
"(",
"ret",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"field",
"+",
"\" does not ex... | Returns the position of the specified field. | [
"Returns",
"the",
"position",
"of",
"the",
"specified",
"field",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/api/tuple/Fields.java#L80-L86 |
27,849 | apache/incubator-heron | heron/schedulers/src/java/org/apache/heron/scheduler/yarn/YarnLauncher.java | YarnLauncher.getClientConf | private Configuration getClientConf() {
return HeronClientConfiguration.CONF
.set(ClientConfiguration.ON_JOB_RUNNING, ReefClientSideHandlers.RunningJobHandler.class)
.set(ClientConfiguration.ON_JOB_FAILED, ReefClientSideHandlers.FailedJobHandler.class)
.set(ClientConfiguration.ON_RUNTIME_ERR... | java | private Configuration getClientConf() {
return HeronClientConfiguration.CONF
.set(ClientConfiguration.ON_JOB_RUNNING, ReefClientSideHandlers.RunningJobHandler.class)
.set(ClientConfiguration.ON_JOB_FAILED, ReefClientSideHandlers.FailedJobHandler.class)
.set(ClientConfiguration.ON_RUNTIME_ERR... | [
"private",
"Configuration",
"getClientConf",
"(",
")",
"{",
"return",
"HeronClientConfiguration",
".",
"CONF",
".",
"set",
"(",
"ClientConfiguration",
".",
"ON_JOB_RUNNING",
",",
"ReefClientSideHandlers",
".",
"RunningJobHandler",
".",
"class",
")",
".",
"set",
"(",... | Builds and returns configuration needed by REEF client to launch topology as a REEF job and
track it. | [
"Builds",
"and",
"returns",
"configuration",
"needed",
"by",
"REEF",
"client",
"to",
"launch",
"topology",
"as",
"a",
"REEF",
"job",
"and",
"track",
"it",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/schedulers/src/java/org/apache/heron/scheduler/yarn/YarnLauncher.java#L189-L196 |
27,850 | apache/incubator-heron | heron/common/src/java/org/apache/heron/common/basics/NIOLooper.java | NIOLooper.handleSelectedKeys | private void handleSelectedKeys() {
Set<SelectionKey> selectedKeys = selector.selectedKeys();
Iterator<SelectionKey> keyIterator = selectedKeys.iterator();
while (keyIterator.hasNext()) {
SelectionKey key = keyIterator.next();
keyIterator.remove();
ISelectHandler callback = (ISelectHandle... | java | private void handleSelectedKeys() {
Set<SelectionKey> selectedKeys = selector.selectedKeys();
Iterator<SelectionKey> keyIterator = selectedKeys.iterator();
while (keyIterator.hasNext()) {
SelectionKey key = keyIterator.next();
keyIterator.remove();
ISelectHandler callback = (ISelectHandle... | [
"private",
"void",
"handleSelectedKeys",
"(",
")",
"{",
"Set",
"<",
"SelectionKey",
">",
"selectedKeys",
"=",
"selector",
".",
"selectedKeys",
"(",
")",
";",
"Iterator",
"<",
"SelectionKey",
">",
"keyIterator",
"=",
"selectedKeys",
".",
"iterator",
"(",
")",
... | Handle the selected keys | [
"Handle",
"the",
"selected",
"keys"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/common/src/java/org/apache/heron/common/basics/NIOLooper.java#L92-L128 |
27,851 | apache/incubator-heron | heron/common/src/java/org/apache/heron/common/basics/NIOLooper.java | NIOLooper.registerRead | public void registerRead(SelectableChannel channel, ISelectHandler callback)
throws ClosedChannelException {
assert channel.keyFor(selector) == null
|| (channel.keyFor(selector).interestOps() & SelectionKey.OP_CONNECT) == 0;
addInterest(channel, SelectionKey.OP_READ, callback);
} | java | public void registerRead(SelectableChannel channel, ISelectHandler callback)
throws ClosedChannelException {
assert channel.keyFor(selector) == null
|| (channel.keyFor(selector).interestOps() & SelectionKey.OP_CONNECT) == 0;
addInterest(channel, SelectionKey.OP_READ, callback);
} | [
"public",
"void",
"registerRead",
"(",
"SelectableChannel",
"channel",
",",
"ISelectHandler",
"callback",
")",
"throws",
"ClosedChannelException",
"{",
"assert",
"channel",
".",
"keyFor",
"(",
"selector",
")",
"==",
"null",
"||",
"(",
"channel",
".",
"keyFor",
"... | Followings are the register, unregister, isRegister for different operations for the selector and channel | [
"Followings",
"are",
"the",
"register",
"unregister",
"isRegister",
"for",
"different",
"operations",
"for",
"the",
"selector",
"and",
"channel"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/common/src/java/org/apache/heron/common/basics/NIOLooper.java#L138-L143 |
27,852 | apache/incubator-heron | heron/common/src/java/org/apache/heron/common/basics/NIOLooper.java | NIOLooper.removeInterest | private void removeInterest(SelectableChannel channel, int operation) {
SelectionKey key = channel.keyFor(selector);
// Exception would be thrown if key is null or key is inValid
// We do not need double check it ahead
key.interestOps(key.interestOps() & (~operation));
} | java | private void removeInterest(SelectableChannel channel, int operation) {
SelectionKey key = channel.keyFor(selector);
// Exception would be thrown if key is null or key is inValid
// We do not need double check it ahead
key.interestOps(key.interestOps() & (~operation));
} | [
"private",
"void",
"removeInterest",
"(",
"SelectableChannel",
"channel",
",",
"int",
"operation",
")",
"{",
"SelectionKey",
"key",
"=",
"channel",
".",
"keyFor",
"(",
"selector",
")",
";",
"// Exception would be thrown if key is null or key is inValid",
"// We do not nee... | Remove one operation interest on a SelectableChannel.
The SelectableChannel has to be registered with Selector ahead.
Otherwise, NullPointerExceptions would throw
The key for SelectableChannel has to be valid.
Otherwise, InvalidValid Exception would throw.
@param channel the SelectableChannel to remove operation inter... | [
"Remove",
"one",
"operation",
"interest",
"on",
"a",
"SelectableChannel",
".",
"The",
"SelectableChannel",
"has",
"to",
"be",
"registered",
"with",
"Selector",
"ahead",
".",
"Otherwise",
"NullPointerExceptions",
"would",
"throw",
"The",
"key",
"for",
"SelectableChan... | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/common/src/java/org/apache/heron/common/basics/NIOLooper.java#L254-L260 |
27,853 | apache/incubator-heron | heron/common/src/java/org/apache/heron/common/basics/NIOLooper.java | NIOLooper.isInterestRegistered | private boolean isInterestRegistered(SelectableChannel channel, int operation) {
SelectionKey key = channel.keyFor(selector);
return key != null && (key.interestOps() & operation) != 0;
} | java | private boolean isInterestRegistered(SelectableChannel channel, int operation) {
SelectionKey key = channel.keyFor(selector);
return key != null && (key.interestOps() & operation) != 0;
} | [
"private",
"boolean",
"isInterestRegistered",
"(",
"SelectableChannel",
"channel",
",",
"int",
"operation",
")",
"{",
"SelectionKey",
"key",
"=",
"channel",
".",
"keyFor",
"(",
"selector",
")",
";",
"return",
"key",
"!=",
"null",
"&&",
"(",
"key",
".",
"inte... | Check whether an operation interest was registered on a SelectableChannel
There are two cases that interest is not registered
1. The whole key does not exist; no interests ever registered for this channel
2. The key exists due to other interests registered but not the one we are adding
If the key exists, the key for Se... | [
"Check",
"whether",
"an",
"operation",
"interest",
"was",
"registered",
"on",
"a",
"SelectableChannel",
"There",
"are",
"two",
"cases",
"that",
"interest",
"is",
"not",
"registered",
"1",
".",
"The",
"whole",
"key",
"does",
"not",
"exist",
";",
"no",
"intere... | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/common/src/java/org/apache/heron/common/basics/NIOLooper.java#L273-L277 |
27,854 | apache/incubator-heron | heron/uploaders/src/java/org/apache/heron/uploader/localfs/LocalFileSystemUploader.java | LocalFileSystemUploader.uploadPackage | @Override
public URI uploadPackage() throws UploaderException {
// first, check if the topology package exists
boolean fileExists = new File(topologyPackageLocation).isFile();
if (!fileExists) {
throw new UploaderException(
String.format("Topology package does not exist at '%s'", topologyP... | java | @Override
public URI uploadPackage() throws UploaderException {
// first, check if the topology package exists
boolean fileExists = new File(topologyPackageLocation).isFile();
if (!fileExists) {
throw new UploaderException(
String.format("Topology package does not exist at '%s'", topologyP... | [
"@",
"Override",
"public",
"URI",
"uploadPackage",
"(",
")",
"throws",
"UploaderException",
"{",
"// first, check if the topology package exists",
"boolean",
"fileExists",
"=",
"new",
"File",
"(",
"topologyPackageLocation",
")",
".",
"isFile",
"(",
")",
";",
"if",
"... | Upload the topology package to the destined location in local file system
@return destination URI of where the topology package has
been uploaded if successful, or {@code null} if failed. | [
"Upload",
"the",
"topology",
"package",
"to",
"the",
"destined",
"location",
"in",
"local",
"file",
"system"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/uploaders/src/java/org/apache/heron/uploader/localfs/LocalFileSystemUploader.java#L77-L124 |
27,855 | apache/incubator-heron | heron/uploaders/src/java/org/apache/heron/uploader/localfs/LocalFileSystemUploader.java | LocalFileSystemUploader.undo | @Override
public boolean undo() {
if (destTopologyFile != null) {
LOG.info("Clean uploaded jar");
File file = new File(destTopologyFile);
return file.delete();
}
return true;
} | java | @Override
public boolean undo() {
if (destTopologyFile != null) {
LOG.info("Clean uploaded jar");
File file = new File(destTopologyFile);
return file.delete();
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"undo",
"(",
")",
"{",
"if",
"(",
"destTopologyFile",
"!=",
"null",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Clean uploaded jar\"",
")",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"destTopologyFile",
")",
";",
"retur... | Remove the uploaded topology package for cleaning up
@return true, if successful | [
"Remove",
"the",
"uploaded",
"topology",
"package",
"for",
"cleaning",
"up"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/uploaders/src/java/org/apache/heron/uploader/localfs/LocalFileSystemUploader.java#L131-L139 |
27,856 | apache/incubator-heron | heron/packing/src/java/org/apache/heron/packing/AbstractPacking.java | AbstractPacking.setPackingConfigs | private void setPackingConfigs(Config config) {
List<TopologyAPI.Config.KeyValue> topologyConfig = topology.getTopologyConfig().getKvsList();
// instance default resources are acquired from heron system level config
this.defaultInstanceResources = new Resource(
Context.instanceCpu(config),
... | java | private void setPackingConfigs(Config config) {
List<TopologyAPI.Config.KeyValue> topologyConfig = topology.getTopologyConfig().getKvsList();
// instance default resources are acquired from heron system level config
this.defaultInstanceResources = new Resource(
Context.instanceCpu(config),
... | [
"private",
"void",
"setPackingConfigs",
"(",
"Config",
"config",
")",
"{",
"List",
"<",
"TopologyAPI",
".",
"Config",
".",
"KeyValue",
">",
"topologyConfig",
"=",
"topology",
".",
"getTopologyConfig",
"(",
")",
".",
"getKvsList",
"(",
")",
";",
"// instance de... | Instatiate the packing algorithm parameters related to this topology. | [
"Instatiate",
"the",
"packing",
"algorithm",
"parameters",
"related",
"to",
"this",
"topology",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/packing/src/java/org/apache/heron/packing/AbstractPacking.java#L118-L171 |
27,857 | apache/incubator-heron | heron/common/src/java/org/apache/heron/common/utils/topology/GeneralTopologyContextImpl.java | GeneralTopologyContextImpl.getComponentStreams | public Set<String> getComponentStreams(String componentId) {
if (outputs.containsKey(componentId)) {
Set<String> streams = new HashSet<>();
List<TopologyAPI.OutputStream> olist = outputs.get(componentId);
for (TopologyAPI.OutputStream ostream : olist) {
streams.add(ostream.getStream().getI... | java | public Set<String> getComponentStreams(String componentId) {
if (outputs.containsKey(componentId)) {
Set<String> streams = new HashSet<>();
List<TopologyAPI.OutputStream> olist = outputs.get(componentId);
for (TopologyAPI.OutputStream ostream : olist) {
streams.add(ostream.getStream().getI... | [
"public",
"Set",
"<",
"String",
">",
"getComponentStreams",
"(",
"String",
"componentId",
")",
"{",
"if",
"(",
"outputs",
".",
"containsKey",
"(",
"componentId",
")",
")",
"{",
"Set",
"<",
"String",
">",
"streams",
"=",
"new",
"HashSet",
"<>",
"(",
")",
... | Gets the set of streams declared for the specified component. | [
"Gets",
"the",
"set",
"of",
"streams",
"declared",
"for",
"the",
"specified",
"component",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/common/src/java/org/apache/heron/common/utils/topology/GeneralTopologyContextImpl.java#L152-L163 |
27,858 | apache/incubator-heron | heron/common/src/java/org/apache/heron/common/utils/topology/GeneralTopologyContextImpl.java | GeneralTopologyContextImpl.getSources | public Map<TopologyAPI.StreamId, TopologyAPI.Grouping> getSources(String componentId) {
if (inputs.containsKey(componentId)) {
Map<TopologyAPI.StreamId, TopologyAPI.Grouping> retVal =
new HashMap<>();
for (TopologyAPI.InputStream istream : inputs.get(componentId)) {
retVal.put(istream.... | java | public Map<TopologyAPI.StreamId, TopologyAPI.Grouping> getSources(String componentId) {
if (inputs.containsKey(componentId)) {
Map<TopologyAPI.StreamId, TopologyAPI.Grouping> retVal =
new HashMap<>();
for (TopologyAPI.InputStream istream : inputs.get(componentId)) {
retVal.put(istream.... | [
"public",
"Map",
"<",
"TopologyAPI",
".",
"StreamId",
",",
"TopologyAPI",
".",
"Grouping",
">",
"getSources",
"(",
"String",
"componentId",
")",
"{",
"if",
"(",
"inputs",
".",
"containsKey",
"(",
"componentId",
")",
")",
"{",
"Map",
"<",
"TopologyAPI",
"."... | Gets the declared inputs to the specified component.
@return A map from subscribed component/stream to the grouping subscribed with. | [
"Gets",
"the",
"declared",
"inputs",
"to",
"the",
"specified",
"component",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/common/src/java/org/apache/heron/common/utils/topology/GeneralTopologyContextImpl.java#L204-L215 |
27,859 | apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/SubmitterMain.java | SubmitterMain.submitTopology | public void submitTopology() throws TopologySubmissionException {
// build primary runtime config first
Config primaryRuntime = Config.newBuilder()
.putAll(LauncherUtils.getInstance().createPrimaryRuntime(topology)).build();
// call launcher directly here if in dry-run mode
if (Context.dryRun(... | java | public void submitTopology() throws TopologySubmissionException {
// build primary runtime config first
Config primaryRuntime = Config.newBuilder()
.putAll(LauncherUtils.getInstance().createPrimaryRuntime(topology)).build();
// call launcher directly here if in dry-run mode
if (Context.dryRun(... | [
"public",
"void",
"submitTopology",
"(",
")",
"throws",
"TopologySubmissionException",
"{",
"// build primary runtime config first",
"Config",
"primaryRuntime",
"=",
"Config",
".",
"newBuilder",
"(",
")",
".",
"putAll",
"(",
"LauncherUtils",
".",
"getInstance",
"(",
"... | Submit a topology
1. Instantiate necessary resources
2. Valid whether it is legal to submit a topology
3. Call LauncherRunner | [
"Submit",
"a",
"topology",
"1",
".",
"Instantiate",
"necessary",
"resources",
"2",
".",
"Valid",
"whether",
"it",
"is",
"legal",
"to",
"submit",
"a",
"topology",
"3",
".",
"Call",
"LauncherRunner"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/SubmitterMain.java#L375-L472 |
27,860 | apache/incubator-heron | heron/schedulers/src/java/org/apache/heron/scheduler/yarn/HeronMasterDriver.java | HeronMasterDriver.scheduleHeronWorkers | void scheduleHeronWorkers(PackingPlan topologyPacking) throws ContainerAllocationException {
this.componentRamMap = topologyPacking.getComponentRamDistribution();
scheduleHeronWorkers(topologyPacking.getContainers());
} | java | void scheduleHeronWorkers(PackingPlan topologyPacking) throws ContainerAllocationException {
this.componentRamMap = topologyPacking.getComponentRamDistribution();
scheduleHeronWorkers(topologyPacking.getContainers());
} | [
"void",
"scheduleHeronWorkers",
"(",
"PackingPlan",
"topologyPacking",
")",
"throws",
"ContainerAllocationException",
"{",
"this",
".",
"componentRamMap",
"=",
"topologyPacking",
".",
"getComponentRamDistribution",
"(",
")",
";",
"scheduleHeronWorkers",
"(",
"topologyPackin... | Container allocation is asynchronous. Requests all containers in the input packing plan
serially to ensure allocated resources match the required resources. | [
"Container",
"allocation",
"is",
"asynchronous",
".",
"Requests",
"all",
"containers",
"in",
"the",
"input",
"packing",
"plan",
"serially",
"to",
"ensure",
"allocated",
"resources",
"match",
"the",
"required",
"resources",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/schedulers/src/java/org/apache/heron/scheduler/yarn/HeronMasterDriver.java#L182-L185 |
27,861 | apache/incubator-heron | heron/schedulers/src/java/org/apache/heron/scheduler/yarn/HeronMasterDriver.java | HeronMasterDriver.scheduleHeronWorkers | void scheduleHeronWorkers(Set<ContainerPlan> containers) throws ContainerAllocationException {
for (ContainerPlan containerPlan : containers) {
int id = containerPlan.getId();
if (containerPlans.containsKey(containerPlan.getId())) {
throw new ContainerAllocationException("Received duplicate allo... | java | void scheduleHeronWorkers(Set<ContainerPlan> containers) throws ContainerAllocationException {
for (ContainerPlan containerPlan : containers) {
int id = containerPlan.getId();
if (containerPlans.containsKey(containerPlan.getId())) {
throw new ContainerAllocationException("Received duplicate allo... | [
"void",
"scheduleHeronWorkers",
"(",
"Set",
"<",
"ContainerPlan",
">",
"containers",
")",
"throws",
"ContainerAllocationException",
"{",
"for",
"(",
"ContainerPlan",
"containerPlan",
":",
"containers",
")",
"{",
"int",
"id",
"=",
"containerPlan",
".",
"getId",
"("... | Container allocation is asynchronous. Requests all containers in the input set serially
to ensure allocated resources match the required resources. | [
"Container",
"allocation",
"is",
"asynchronous",
".",
"Requests",
"all",
"containers",
"in",
"the",
"input",
"set",
"serially",
"to",
"ensure",
"allocated",
"resources",
"match",
"the",
"required",
"resources",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/schedulers/src/java/org/apache/heron/scheduler/yarn/HeronMasterDriver.java#L199-L209 |
27,862 | apache/incubator-heron | heron/schedulers/src/java/org/apache/heron/scheduler/yarn/HeronMasterDriver.java | HeronMasterDriver.killWorkers | public void killWorkers(Set<ContainerPlan> containers) {
for (ContainerPlan container : containers) {
LOG.log(Level.INFO, "Find and kill container for worker {0}", container.getId());
Optional<HeronWorker> worker = multiKeyWorkerMap.lookupByWorkerId(container.getId());
if (worker.isPresent()) {
... | java | public void killWorkers(Set<ContainerPlan> containers) {
for (ContainerPlan container : containers) {
LOG.log(Level.INFO, "Find and kill container for worker {0}", container.getId());
Optional<HeronWorker> worker = multiKeyWorkerMap.lookupByWorkerId(container.getId());
if (worker.isPresent()) {
... | [
"public",
"void",
"killWorkers",
"(",
"Set",
"<",
"ContainerPlan",
">",
"containers",
")",
"{",
"for",
"(",
"ContainerPlan",
"container",
":",
"containers",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"Find and kill container for worker {0}\""... | Terminates any yarn containers associated with the given containers. | [
"Terminates",
"any",
"yarn",
"containers",
"associated",
"with",
"the",
"given",
"containers",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/schedulers/src/java/org/apache/heron/scheduler/yarn/HeronMasterDriver.java#L282-L296 |
27,863 | apache/incubator-heron | heron/api/src/java/org/apache/heron/api/windowing/WindowManager.java | WindowManager.restoreState | @SuppressWarnings("unchecked")
public void restoreState(Map<String, Serializable> state) {
LOG.info("Restoring window manager state");
//restore eviction policy state
if (state.get(EVICTION_STATE_KEY) != null) {
((EvictionPolicy) evictionPolicy).restoreState(state.get(EVICTION_STATE_KEY));
}
... | java | @SuppressWarnings("unchecked")
public void restoreState(Map<String, Serializable> state) {
LOG.info("Restoring window manager state");
//restore eviction policy state
if (state.get(EVICTION_STATE_KEY) != null) {
((EvictionPolicy) evictionPolicy).restoreState(state.get(EVICTION_STATE_KEY));
}
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"restoreState",
"(",
"Map",
"<",
"String",
",",
"Serializable",
">",
"state",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Restoring window manager state\"",
")",
";",
"//restore eviction policy state",
... | Restore state associated with the window manager
@param state | [
"Restore",
"state",
"associated",
"with",
"the",
"window",
"manager"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/api/windowing/WindowManager.java#L315-L340 |
27,864 | apache/incubator-heron | heron/api/src/java/org/apache/heron/api/windowing/WindowManager.java | WindowManager.getState | public Map<String, Serializable> getState() {
Map<String, Serializable> ret = new HashMap<>();
// get potential eviction policy state
if (evictionPolicy.getState() != null) {
ret.put(EVICTION_STATE_KEY, (Serializable) evictionPolicy.getState());
}
// get potential trigger policy state
if (... | java | public Map<String, Serializable> getState() {
Map<String, Serializable> ret = new HashMap<>();
// get potential eviction policy state
if (evictionPolicy.getState() != null) {
ret.put(EVICTION_STATE_KEY, (Serializable) evictionPolicy.getState());
}
// get potential trigger policy state
if (... | [
"public",
"Map",
"<",
"String",
",",
"Serializable",
">",
"getState",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Serializable",
">",
"ret",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"// get potential eviction policy state",
"if",
"(",
"evictionPolicy",
"."... | Get the state of the window manager
@return a Map representing the state of the window manager | [
"Get",
"the",
"state",
"of",
"the",
"window",
"manager"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/api/windowing/WindowManager.java#L346-L361 |
27,865 | apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java | SchedulerUtils.schedulerCommand | public static String[] schedulerCommand(
Config config,
Config runtime,
List<Integer> freePorts) {
List<String> commands = new ArrayList<>();
// The java executable should be "{JAVA_HOME}/bin/java"
String javaExecutable = String.format("%s/%s", Context.clusterJavaHome(config), "bin/java")... | java | public static String[] schedulerCommand(
Config config,
Config runtime,
List<Integer> freePorts) {
List<String> commands = new ArrayList<>();
// The java executable should be "{JAVA_HOME}/bin/java"
String javaExecutable = String.format("%s/%s", Context.clusterJavaHome(config), "bin/java")... | [
"public",
"static",
"String",
"[",
"]",
"schedulerCommand",
"(",
"Config",
"config",
",",
"Config",
"runtime",
",",
"List",
"<",
"Integer",
">",
"freePorts",
")",
"{",
"List",
"<",
"String",
">",
"commands",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
... | Utils method to construct the command to start heron-scheduler
@param config The static Config
@param runtime The runtime Config
@param freePorts list of free ports
@return String[] representing the command to start heron-scheduler | [
"Utils",
"method",
"to",
"construct",
"the",
"command",
"to",
"start",
"heron",
"-",
"scheduler"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java#L117-L140 |
27,866 | apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java | SchedulerUtils.schedulerCommandArgs | public static String[] schedulerCommandArgs(
Config config, Config runtime, List<Integer> freePorts) {
// First let us have some safe checks
if (freePorts.size() < PORTS_REQUIRED_FOR_SCHEDULER) {
throw new RuntimeException("Failed to find enough ports for executor");
}
for (int port : freePo... | java | public static String[] schedulerCommandArgs(
Config config, Config runtime, List<Integer> freePorts) {
// First let us have some safe checks
if (freePorts.size() < PORTS_REQUIRED_FOR_SCHEDULER) {
throw new RuntimeException("Failed to find enough ports for executor");
}
for (int port : freePo... | [
"public",
"static",
"String",
"[",
"]",
"schedulerCommandArgs",
"(",
"Config",
"config",
",",
"Config",
"runtime",
",",
"List",
"<",
"Integer",
">",
"freePorts",
")",
"{",
"// First let us have some safe checks",
"if",
"(",
"freePorts",
".",
"size",
"(",
")",
... | Util method to get the arguments to the heron scheduler.
@param config The static Config
@param runtime The runtime Config
@param freePorts list of free ports
@return String[] representing the arguments to start heron-scheduler | [
"Util",
"method",
"to",
"get",
"the",
"arguments",
"to",
"the",
"heron",
"scheduler",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java#L150-L180 |
27,867 | apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java | SchedulerUtils.executorCommandArgs | public static String[] executorCommandArgs(
Config config, Config runtime, Map<ExecutorPort, String> ports, String containerIndex) {
List<String> args = new ArrayList<>();
addExecutorTopologyArgs(args, config, runtime);
addExecutorContainerArgs(args, ports, containerIndex);
return args.toArray(ne... | java | public static String[] executorCommandArgs(
Config config, Config runtime, Map<ExecutorPort, String> ports, String containerIndex) {
List<String> args = new ArrayList<>();
addExecutorTopologyArgs(args, config, runtime);
addExecutorContainerArgs(args, ports, containerIndex);
return args.toArray(ne... | [
"public",
"static",
"String",
"[",
"]",
"executorCommandArgs",
"(",
"Config",
"config",
",",
"Config",
"runtime",
",",
"Map",
"<",
"ExecutorPort",
",",
"String",
">",
"ports",
",",
"String",
"containerIndex",
")",
"{",
"List",
"<",
"String",
">",
"args",
"... | Util method to get the arguments to the heron executor. This method creates the arguments
without the container index, which is the first argument to the executor
@param config The static Config
@param runtime The runtime Config
@param ports a map of ports to use where the key indicate the port type and the
value is t... | [
"Util",
"method",
"to",
"get",
"the",
"arguments",
"to",
"the",
"heron",
"executor",
".",
"This",
"method",
"creates",
"the",
"arguments",
"without",
"the",
"container",
"index",
"which",
"is",
"the",
"first",
"argument",
"to",
"the",
"executor"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java#L235-L242 |
27,868 | apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java | SchedulerUtils.addExecutorContainerArgs | public static void addExecutorContainerArgs(
List<String> args,
Map<ExecutorPort, String> ports,
String containerIndex) {
String masterPort = ExecutorPort.getPort(ExecutorPort.MASTER_PORT, ports);
String tmasterControllerPort = ExecutorPort.getPort(
ExecutorPort.TMASTER_CONTROLLER_PORT... | java | public static void addExecutorContainerArgs(
List<String> args,
Map<ExecutorPort, String> ports,
String containerIndex) {
String masterPort = ExecutorPort.getPort(ExecutorPort.MASTER_PORT, ports);
String tmasterControllerPort = ExecutorPort.getPort(
ExecutorPort.TMASTER_CONTROLLER_PORT... | [
"public",
"static",
"void",
"addExecutorContainerArgs",
"(",
"List",
"<",
"String",
">",
"args",
",",
"Map",
"<",
"ExecutorPort",
",",
"String",
">",
"ports",
",",
"String",
"containerIndex",
")",
"{",
"String",
"masterPort",
"=",
"ExecutorPort",
".",
"getPort... | Util method to parse port map and container id and translate them into arguments to be used
by executor
@param args The list to accept new topology arguments
@param ports a map of ports to use where the key indicate the port type and the
value is the port
@param containerIndex The index of the current container | [
"Util",
"method",
"to",
"parse",
"port",
"map",
"and",
"container",
"id",
"and",
"translate",
"them",
"into",
"arguments",
"to",
"be",
"used",
"by",
"executor"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java#L334-L368 |
27,869 | apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java | SchedulerUtils.setLibSchedulerLocation | public static boolean setLibSchedulerLocation(
Config runtime,
IScheduler scheduler,
boolean isService) {
// Dummy value since there is no scheduler running as service
final String endpoint = "scheduler_as_lib_no_endpoint";
return setSchedulerLocation(runtime, endpoint, scheduler);
} | java | public static boolean setLibSchedulerLocation(
Config runtime,
IScheduler scheduler,
boolean isService) {
// Dummy value since there is no scheduler running as service
final String endpoint = "scheduler_as_lib_no_endpoint";
return setSchedulerLocation(runtime, endpoint, scheduler);
} | [
"public",
"static",
"boolean",
"setLibSchedulerLocation",
"(",
"Config",
"runtime",
",",
"IScheduler",
"scheduler",
",",
"boolean",
"isService",
")",
"{",
"// Dummy value since there is no scheduler running as service",
"final",
"String",
"endpoint",
"=",
"\"scheduler_as_lib_... | Set the location of scheduler for other processes to discover,
when invoke IScheduler as a library on client side
@param runtime the runtime configuration
@param scheduler the IScheduler to provide more info
@param isService true if the scheduler is a service; false otherwise | [
"Set",
"the",
"location",
"of",
"scheduler",
"for",
"other",
"processes",
"to",
"discover",
"when",
"invoke",
"IScheduler",
"as",
"a",
"library",
"on",
"client",
"side"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java#L386-L393 |
27,870 | apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java | SchedulerUtils.setSchedulerLocation | public static boolean setSchedulerLocation(
Config runtime,
String schedulerEndpoint,
IScheduler scheduler) {
// Set scheduler location to host:port by default. Overwrite scheduler location if behind DNS.
Scheduler.SchedulerLocation.Builder builder = Scheduler.SchedulerLocation.newBuilder()
... | java | public static boolean setSchedulerLocation(
Config runtime,
String schedulerEndpoint,
IScheduler scheduler) {
// Set scheduler location to host:port by default. Overwrite scheduler location if behind DNS.
Scheduler.SchedulerLocation.Builder builder = Scheduler.SchedulerLocation.newBuilder()
... | [
"public",
"static",
"boolean",
"setSchedulerLocation",
"(",
"Config",
"runtime",
",",
"String",
"schedulerEndpoint",
",",
"IScheduler",
"scheduler",
")",
"{",
"// Set scheduler location to host:port by default. Overwrite scheduler location if behind DNS.",
"Scheduler",
".",
"Sche... | Set the location of scheduler for other processes to discover
@param runtime the runtime configuration
@param schedulerEndpoint the endpoint that scheduler listens for receives requests
@param scheduler the IScheduler to provide more info | [
"Set",
"the",
"location",
"of",
"scheduler",
"for",
"other",
"processes",
"to",
"discover"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java#L402-L432 |
27,871 | apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java | SchedulerUtils.constructSchedulerResponse | public static Scheduler.SchedulerResponse constructSchedulerResponse(boolean isOK) {
Common.Status.Builder status = Common.Status.newBuilder();
if (isOK) {
status.setStatus(Common.StatusCode.OK);
} else {
status.setStatus(Common.StatusCode.NOTOK);
}
return Scheduler.SchedulerResponse.ne... | java | public static Scheduler.SchedulerResponse constructSchedulerResponse(boolean isOK) {
Common.Status.Builder status = Common.Status.newBuilder();
if (isOK) {
status.setStatus(Common.StatusCode.OK);
} else {
status.setStatus(Common.StatusCode.NOTOK);
}
return Scheduler.SchedulerResponse.ne... | [
"public",
"static",
"Scheduler",
".",
"SchedulerResponse",
"constructSchedulerResponse",
"(",
"boolean",
"isOK",
")",
"{",
"Common",
".",
"Status",
".",
"Builder",
"status",
"=",
"Common",
".",
"Status",
".",
"newBuilder",
"(",
")",
";",
"if",
"(",
"isOK",
"... | construct heron scheduler response basing on the given result
@param isOK whether the request successful | [
"construct",
"heron",
"scheduler",
"response",
"basing",
"on",
"the",
"given",
"result"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java#L439-L450 |
27,872 | apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java | SchedulerUtils.createOrCleanDirectory | public static boolean createOrCleanDirectory(String directory) {
// if the directory does not exist, create it.
if (!FileUtils.isDirectoryExists(directory)) {
LOG.fine("The directory does not exist; creating it.");
if (!FileUtils.createDirectory(directory)) {
LOG.severe("Failed to create dir... | java | public static boolean createOrCleanDirectory(String directory) {
// if the directory does not exist, create it.
if (!FileUtils.isDirectoryExists(directory)) {
LOG.fine("The directory does not exist; creating it.");
if (!FileUtils.createDirectory(directory)) {
LOG.severe("Failed to create dir... | [
"public",
"static",
"boolean",
"createOrCleanDirectory",
"(",
"String",
"directory",
")",
"{",
"// if the directory does not exist, create it.",
"if",
"(",
"!",
"FileUtils",
".",
"isDirectoryExists",
"(",
"directory",
")",
")",
"{",
"LOG",
".",
"fine",
"(",
"\"The d... | Create the directory if it does not exist otherwise clean the directory.
@param directory the working directory to setup
@return true if successful | [
"Create",
"the",
"directory",
"if",
"it",
"does",
"not",
"exist",
"otherwise",
"clean",
"the",
"directory",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java#L498-L515 |
27,873 | apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java | SchedulerUtils.curlAndExtractPackage | public static boolean curlAndExtractPackage(
String workingDirectory,
String packageURI,
String packageDestination,
boolean isDeletePackage,
boolean isVerbose) {
// curl the package to the working directory and extract it
LOG.log(Level.FINE, "Fetching package {0}", packageURI);
... | java | public static boolean curlAndExtractPackage(
String workingDirectory,
String packageURI,
String packageDestination,
boolean isDeletePackage,
boolean isVerbose) {
// curl the package to the working directory and extract it
LOG.log(Level.FINE, "Fetching package {0}", packageURI);
... | [
"public",
"static",
"boolean",
"curlAndExtractPackage",
"(",
"String",
"workingDirectory",
",",
"String",
"packageURI",
",",
"String",
"packageDestination",
",",
"boolean",
"isDeletePackage",
",",
"boolean",
"isVerbose",
")",
"{",
"// curl the package to the working directo... | Curl a package, extract it to working directory
@param workingDirectory the working directory to setup
@param packageURI the URL of core release package
@param packageDestination the destination of the core release package fetched
@param isDeletePackage delete the package curled or not
@param isVerbose display verbose... | [
"Curl",
"a",
"package",
"extract",
"it",
"to",
"working",
"directory"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java#L533-L562 |
27,874 | apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java | SchedulerUtils.persistUpdatedPackingPlan | public static void persistUpdatedPackingPlan(String topologyName,
PackingPlan updatedPackingPlan,
SchedulerStateManagerAdaptor stateManager) {
LOG.log(Level.INFO, "Updating scheduled-resource in packing plan: {0}", topolog... | java | public static void persistUpdatedPackingPlan(String topologyName,
PackingPlan updatedPackingPlan,
SchedulerStateManagerAdaptor stateManager) {
LOG.log(Level.INFO, "Updating scheduled-resource in packing plan: {0}", topolog... | [
"public",
"static",
"void",
"persistUpdatedPackingPlan",
"(",
"String",
"topologyName",
",",
"PackingPlan",
"updatedPackingPlan",
",",
"SchedulerStateManagerAdaptor",
"stateManager",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"Updating scheduled-reso... | Replaces persisted packing plan in state manager. | [
"Replaces",
"persisted",
"packing",
"plan",
"in",
"state",
"manager",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java#L567-L577 |
27,875 | apache/incubator-heron | heron/packing/src/java/org/apache/heron/packing/builder/PackingPlanBuilder.java | PackingPlanBuilder.build | public PackingPlan build() {
assertResourceSettings();
Set<PackingPlan.ContainerPlan> containerPlans = buildContainerPlans(this.containers);
return new PackingPlan(topologyId, containerPlans);
} | java | public PackingPlan build() {
assertResourceSettings();
Set<PackingPlan.ContainerPlan> containerPlans = buildContainerPlans(this.containers);
return new PackingPlan(topologyId, containerPlans);
} | [
"public",
"PackingPlan",
"build",
"(",
")",
"{",
"assertResourceSettings",
"(",
")",
";",
"Set",
"<",
"PackingPlan",
".",
"ContainerPlan",
">",
"containerPlans",
"=",
"buildContainerPlans",
"(",
"this",
".",
"containers",
")",
";",
"return",
"new",
"PackingPlan"... | build container plan sets by summing up instance resources | [
"build",
"container",
"plan",
"sets",
"by",
"summing",
"up",
"instance",
"resources"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/packing/src/java/org/apache/heron/packing/builder/PackingPlanBuilder.java#L250-L254 |
27,876 | apache/incubator-heron | heron/packing/src/java/org/apache/heron/packing/builder/PackingPlanBuilder.java | PackingPlanBuilder.buildContainerPlans | private static Set<PackingPlan.ContainerPlan> buildContainerPlans(
Map<Integer, Container> containerInstances) {
Set<PackingPlan.ContainerPlan> containerPlans = new LinkedHashSet<>();
for (Integer containerId : containerInstances.keySet()) {
Container container = containerInstances.get(containerId)... | java | private static Set<PackingPlan.ContainerPlan> buildContainerPlans(
Map<Integer, Container> containerInstances) {
Set<PackingPlan.ContainerPlan> containerPlans = new LinkedHashSet<>();
for (Integer containerId : containerInstances.keySet()) {
Container container = containerInstances.get(containerId)... | [
"private",
"static",
"Set",
"<",
"PackingPlan",
".",
"ContainerPlan",
">",
"buildContainerPlans",
"(",
"Map",
"<",
"Integer",
",",
"Container",
">",
"containerInstances",
")",
"{",
"Set",
"<",
"PackingPlan",
".",
"ContainerPlan",
">",
"containerPlans",
"=",
"new... | Estimate the per instance and topology resources for the packing plan based on the ramMap,
instance defaults and paddingPercentage.
@return container plans | [
"Estimate",
"the",
"per",
"instance",
"and",
"topology",
"resources",
"for",
"the",
"packing",
"plan",
"based",
"on",
"the",
"ramMap",
"instance",
"defaults",
"and",
"paddingPercentage",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/packing/src/java/org/apache/heron/packing/builder/PackingPlanBuilder.java#L325-L347 |
27,877 | apache/incubator-heron | heron/packing/src/java/org/apache/heron/packing/builder/PackingPlanBuilder.java | PackingPlanBuilder.getContainers | @VisibleForTesting
static Map<Integer, Container> getContainers(
PackingPlan currentPackingPlan, Resource maxContainerResource, Resource padding,
Map<String, TreeSet<Integer>> componentIndexes, TreeSet<Integer> taskIds) {
Map<Integer, Container> containers = new HashMap<>();
Resource capacity = m... | java | @VisibleForTesting
static Map<Integer, Container> getContainers(
PackingPlan currentPackingPlan, Resource maxContainerResource, Resource padding,
Map<String, TreeSet<Integer>> componentIndexes, TreeSet<Integer> taskIds) {
Map<Integer, Container> containers = new HashMap<>();
Resource capacity = m... | [
"@",
"VisibleForTesting",
"static",
"Map",
"<",
"Integer",
",",
"Container",
">",
"getContainers",
"(",
"PackingPlan",
"currentPackingPlan",
",",
"Resource",
"maxContainerResource",
",",
"Resource",
"padding",
",",
"Map",
"<",
"String",
",",
"TreeSet",
"<",
"Integ... | Generates the containers that correspond to the current packing plan
along with their associated instances.
@return Map of containers for the current packing plan, keyed by containerId | [
"Generates",
"the",
"containers",
"that",
"correspond",
"to",
"the",
"current",
"packing",
"plan",
"along",
"with",
"their",
"associated",
"instances",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/packing/src/java/org/apache/heron/packing/builder/PackingPlanBuilder.java#L355-L371 |
27,878 | apache/incubator-heron | heron/packing/src/java/org/apache/heron/packing/builder/PackingPlanBuilder.java | PackingPlanBuilder.addToContainer | private static void addToContainer(Container container,
PackingPlan.InstancePlan instancePlan,
Map<String, TreeSet<Integer>> componentIndexes,
Set<Integer> taskIds) {
container.add(instancePlan);
Strin... | java | private static void addToContainer(Container container,
PackingPlan.InstancePlan instancePlan,
Map<String, TreeSet<Integer>> componentIndexes,
Set<Integer> taskIds) {
container.add(instancePlan);
Strin... | [
"private",
"static",
"void",
"addToContainer",
"(",
"Container",
"container",
",",
"PackingPlan",
".",
"InstancePlan",
"instancePlan",
",",
"Map",
"<",
"String",
",",
"TreeSet",
"<",
"Integer",
">",
">",
"componentIndexes",
",",
"Set",
"<",
"Integer",
">",
"ta... | Add instancePlan to container and update the componentIndexes and taskIds indexes | [
"Add",
"instancePlan",
"to",
"container",
"and",
"update",
"the",
"componentIndexes",
"and",
"taskIds",
"indexes"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/packing/src/java/org/apache/heron/packing/builder/PackingPlanBuilder.java#L384-L395 |
27,879 | apache/incubator-heron | examples/src/java/org/apache/heron/examples/streamlet/utils/StreamletUtils.java | StreamletUtils.randomFromList | public static <T> T randomFromList(List<T> ls) {
return ls.get(new Random().nextInt(ls.size()));
} | java | public static <T> T randomFromList(List<T> ls) {
return ls.get(new Random().nextInt(ls.size()));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"randomFromList",
"(",
"List",
"<",
"T",
">",
"ls",
")",
"{",
"return",
"ls",
".",
"get",
"(",
"new",
"Random",
"(",
")",
".",
"nextInt",
"(",
"ls",
".",
"size",
"(",
")",
")",
")",
";",
"}"
] | Selects a random item from a list. Used in many example source streamlets. | [
"Selects",
"a",
"random",
"item",
"from",
"a",
"list",
".",
"Used",
"in",
"many",
"example",
"source",
"streamlets",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/examples/src/java/org/apache/heron/examples/streamlet/utils/StreamletUtils.java#L57-L59 |
27,880 | apache/incubator-heron | examples/src/java/org/apache/heron/examples/streamlet/utils/StreamletUtils.java | StreamletUtils.getParallelism | public static int getParallelism(String[] args, int defaultParallelism) {
return (args.length > 1) ? Integer.parseInt(args[1]) : defaultParallelism;
} | java | public static int getParallelism(String[] args, int defaultParallelism) {
return (args.length > 1) ? Integer.parseInt(args[1]) : defaultParallelism;
} | [
"public",
"static",
"int",
"getParallelism",
"(",
"String",
"[",
"]",
"args",
",",
"int",
"defaultParallelism",
")",
"{",
"return",
"(",
"args",
".",
"length",
">",
"1",
")",
"?",
"Integer",
".",
"parseInt",
"(",
"args",
"[",
"1",
"]",
")",
":",
"def... | Fetches the topology's parallelism from the second-command-line
argument or defers to a supplied default. | [
"Fetches",
"the",
"topology",
"s",
"parallelism",
"from",
"the",
"second",
"-",
"command",
"-",
"line",
"argument",
"or",
"defers",
"to",
"a",
"supplied",
"default",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/examples/src/java/org/apache/heron/examples/streamlet/utils/StreamletUtils.java#L65-L67 |
27,881 | apache/incubator-heron | examples/src/java/org/apache/heron/examples/streamlet/utils/StreamletUtils.java | StreamletUtils.intListAsString | public static String intListAsString(List<Integer> ls) {
return String.join(", ", ls.stream().map(i -> i.toString()).collect(Collectors.toList()));
} | java | public static String intListAsString(List<Integer> ls) {
return String.join(", ", ls.stream().map(i -> i.toString()).collect(Collectors.toList()));
} | [
"public",
"static",
"String",
"intListAsString",
"(",
"List",
"<",
"Integer",
">",
"ls",
")",
"{",
"return",
"String",
".",
"join",
"(",
"\", \"",
",",
"ls",
".",
"stream",
"(",
")",
".",
"map",
"(",
"i",
"->",
"i",
".",
"toString",
"(",
")",
")",
... | Converts a list of integers into a comma-separated string. | [
"Converts",
"a",
"list",
"of",
"integers",
"into",
"a",
"comma",
"-",
"separated",
"string",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/examples/src/java/org/apache/heron/examples/streamlet/utils/StreamletUtils.java#L72-L74 |
27,882 | apache/incubator-heron | heron/common/src/java/org/apache/heron/common/network/HeronClient.java | HeronClient.sendRequest | public void sendRequest(Message request, Object context, Message.Builder responseBuilder,
Duration timeout) {
// Pack it as a no-timeout request and send it!
final REQID rid = REQID.generate();
contextMap.put(rid, context);
responseMessageMap.put(rid, responseBuilder);
// ... | java | public void sendRequest(Message request, Object context, Message.Builder responseBuilder,
Duration timeout) {
// Pack it as a no-timeout request and send it!
final REQID rid = REQID.generate();
contextMap.put(rid, context);
responseMessageMap.put(rid, responseBuilder);
// ... | [
"public",
"void",
"sendRequest",
"(",
"Message",
"request",
",",
"Object",
"context",
",",
"Message",
".",
"Builder",
"responseBuilder",
",",
"Duration",
"timeout",
")",
"{",
"// Pack it as a no-timeout request and send it!",
"final",
"REQID",
"rid",
"=",
"REQID",
"... | A negative value of the timeout means no timeout. | [
"A",
"negative",
"value",
"of",
"the",
"timeout",
"means",
"no",
"timeout",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/common/src/java/org/apache/heron/common/network/HeronClient.java#L192-L211 |
27,883 | apache/incubator-heron | heron/common/src/java/org/apache/heron/common/network/HeronClient.java | HeronClient.sendRequest | public void sendRequest(Message request, Message.Builder responseBuilder) {
sendRequest(request, null, responseBuilder, Duration.ZERO);
} | java | public void sendRequest(Message request, Message.Builder responseBuilder) {
sendRequest(request, null, responseBuilder, Duration.ZERO);
} | [
"public",
"void",
"sendRequest",
"(",
"Message",
"request",
",",
"Message",
".",
"Builder",
"responseBuilder",
")",
"{",
"sendRequest",
"(",
"request",
",",
"null",
",",
"responseBuilder",
",",
"Duration",
".",
"ZERO",
")",
";",
"}"
] | Convenience method of the above method with no timeout or context | [
"Convenience",
"method",
"of",
"the",
"above",
"method",
"with",
"no",
"timeout",
"or",
"context"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/common/src/java/org/apache/heron/common/network/HeronClient.java#L214-L216 |
27,884 | apache/incubator-heron | heron/common/src/java/org/apache/heron/common/network/HeronClient.java | HeronClient.handleTimeout | protected void handleTimeout(REQID rid) {
if (contextMap.containsKey(rid)) {
Object ctx = contextMap.get(rid);
contextMap.remove(rid);
responseMessageMap.remove(rid);
onResponse(StatusCode.TIMEOUT_ERROR, ctx, null);
} else {
// Since we dont do cancel timer, this is because we alre... | java | protected void handleTimeout(REQID rid) {
if (contextMap.containsKey(rid)) {
Object ctx = contextMap.get(rid);
contextMap.remove(rid);
responseMessageMap.remove(rid);
onResponse(StatusCode.TIMEOUT_ERROR, ctx, null);
} else {
// Since we dont do cancel timer, this is because we alre... | [
"protected",
"void",
"handleTimeout",
"(",
"REQID",
"rid",
")",
"{",
"if",
"(",
"contextMap",
".",
"containsKey",
"(",
"rid",
")",
")",
"{",
"Object",
"ctx",
"=",
"contextMap",
".",
"get",
"(",
"rid",
")",
";",
"contextMap",
".",
"remove",
"(",
"rid",
... | Handle the timeout for a particular REQID | [
"Handle",
"the",
"timeout",
"for",
"a",
"particular",
"REQID"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/common/src/java/org/apache/heron/common/network/HeronClient.java#L320-L331 |
27,885 | apache/incubator-heron | heron/schedulers/src/java/org/apache/heron/scheduler/mesos/MesosScheduler.java | MesosScheduler.startSchedulerDriver | protected void startSchedulerDriver() {
// start the driver non-blocking,
// since we need to set heron state after the scheduler driver is started.
// Heron will block the main thread eventually
driver.start();
// Staging the Mesos Framework
LOG.info("Waiting for Mesos Framework get registered... | java | protected void startSchedulerDriver() {
// start the driver non-blocking,
// since we need to set heron state after the scheduler driver is started.
// Heron will block the main thread eventually
driver.start();
// Staging the Mesos Framework
LOG.info("Waiting for Mesos Framework get registered... | [
"protected",
"void",
"startSchedulerDriver",
"(",
")",
"{",
"// start the driver non-blocking,",
"// since we need to set heron state after the scheduler driver is started.",
"// Heron will block the main thread eventually",
"driver",
".",
"start",
"(",
")",
";",
"// Staging the Mesos ... | Start the scheduler driver and wait it to get registered | [
"Start",
"the",
"scheduler",
"driver",
"and",
"wait",
"it",
"to",
"get",
"registered"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/schedulers/src/java/org/apache/heron/scheduler/mesos/MesosScheduler.java#L78-L90 |
27,886 | apache/incubator-heron | heron/schedulers/src/java/org/apache/heron/scheduler/mesos/MesosScheduler.java | MesosScheduler.joinSchedulerDriver | protected void joinSchedulerDriver(long timeout, TimeUnit unit) {
// ExecutorService used to monitor whether close() completes in time
ExecutorService service = Executors.newFixedThreadPool(1);
final CountDownLatch closeLatch = new CountDownLatch(1);
Runnable driverJoin = new Runnable() {
@Overrid... | java | protected void joinSchedulerDriver(long timeout, TimeUnit unit) {
// ExecutorService used to monitor whether close() completes in time
ExecutorService service = Executors.newFixedThreadPool(1);
final CountDownLatch closeLatch = new CountDownLatch(1);
Runnable driverJoin = new Runnable() {
@Overrid... | [
"protected",
"void",
"joinSchedulerDriver",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"// ExecutorService used to monitor whether close() completes in time",
"ExecutorService",
"service",
"=",
"Executors",
".",
"newFixedThreadPool",
"(",
"1",
")",
";",
"f... | Waits for the driver to be stopped or aborted
@param timeout maximum time waiting
@param unit time unit to wait | [
"Waits",
"for",
"the",
"driver",
"to",
"be",
"stopped",
"or",
"aborted"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/schedulers/src/java/org/apache/heron/scheduler/mesos/MesosScheduler.java#L98-L124 |
27,887 | apache/incubator-heron | heron/schedulers/src/java/org/apache/heron/scheduler/mesos/MesosScheduler.java | MesosScheduler.getBaseContainer | protected BaseContainer getBaseContainer(Integer containerIndex, PackingPlan packing) {
BaseContainer container = new BaseContainer();
container.name = TaskUtils.getTaskNameForContainerIndex(containerIndex);
container.runAsUser = Context.role(config);
container.description = String.format("Container %... | java | protected BaseContainer getBaseContainer(Integer containerIndex, PackingPlan packing) {
BaseContainer container = new BaseContainer();
container.name = TaskUtils.getTaskNameForContainerIndex(containerIndex);
container.runAsUser = Context.role(config);
container.description = String.format("Container %... | [
"protected",
"BaseContainer",
"getBaseContainer",
"(",
"Integer",
"containerIndex",
",",
"PackingPlan",
"packing",
")",
"{",
"BaseContainer",
"container",
"=",
"new",
"BaseContainer",
"(",
")",
";",
"container",
".",
"name",
"=",
"TaskUtils",
".",
"getTaskNameForCon... | Get BaseContainer info.
@param containerIndex container index to start
@param packing the PackingPlan
@return BaseContainer Info | [
"Get",
"BaseContainer",
"info",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/schedulers/src/java/org/apache/heron/scheduler/mesos/MesosScheduler.java#L217-L244 |
27,888 | apache/incubator-heron | heron/schedulers/src/java/org/apache/heron/scheduler/mesos/framework/LaunchableTask.java | LaunchableTask.constructMesosTaskInfo | public Protos.TaskInfo constructMesosTaskInfo(Config heronConfig, Config heronRuntime) {
//String taskIdStr, BaseContainer task, Offer offer
String taskIdStr = this.taskId;
Protos.TaskID mesosTaskID = Protos.TaskID.newBuilder().setValue(taskIdStr).build();
Protos.TaskInfo.Builder taskInfo = Protos.Task... | java | public Protos.TaskInfo constructMesosTaskInfo(Config heronConfig, Config heronRuntime) {
//String taskIdStr, BaseContainer task, Offer offer
String taskIdStr = this.taskId;
Protos.TaskID mesosTaskID = Protos.TaskID.newBuilder().setValue(taskIdStr).build();
Protos.TaskInfo.Builder taskInfo = Protos.Task... | [
"public",
"Protos",
".",
"TaskInfo",
"constructMesosTaskInfo",
"(",
"Config",
"heronConfig",
",",
"Config",
"heronRuntime",
")",
"{",
"//String taskIdStr, BaseContainer task, Offer offer",
"String",
"taskIdStr",
"=",
"this",
".",
"taskId",
";",
"Protos",
".",
"TaskID",
... | Construct the Mesos TaskInfo in Protos to launch basing on the LaunchableTask
@param heronConfig the heron config
@param heronRuntime the heron runtime
@return Mesos TaskInfo in Protos to launch | [
"Construct",
"the",
"Mesos",
"TaskInfo",
"in",
"Protos",
"to",
"launch",
"basing",
"on",
"the",
"LaunchableTask"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/schedulers/src/java/org/apache/heron/scheduler/mesos/framework/LaunchableTask.java#L143-L197 |
27,889 | apache/incubator-heron | heron/common/src/java/org/apache/heron/common/utils/metrics/MetricsCollector.java | MetricsCollector.gatherOneMetric | @SuppressWarnings("unchecked")
private void gatherOneMetric(
String metricName,
Metrics.MetricPublisherPublishMessage.Builder builder) {
Object metricValue = metrics.get(metricName).getValueAndReset();
// Decide how to handle the metric based on type
if (metricValue == null) {
return;
... | java | @SuppressWarnings("unchecked")
private void gatherOneMetric(
String metricName,
Metrics.MetricPublisherPublishMessage.Builder builder) {
Object metricValue = metrics.get(metricName).getValueAndReset();
// Decide how to handle the metric based on type
if (metricValue == null) {
return;
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"gatherOneMetric",
"(",
"String",
"metricName",
",",
"Metrics",
".",
"MetricPublisherPublishMessage",
".",
"Builder",
"builder",
")",
"{",
"Object",
"metricValue",
"=",
"metrics",
".",
"get",
"... | and add it to MetricPublisherPublishMessage builder given. | [
"and",
"add",
"it",
"to",
"MetricPublisherPublishMessage",
"builder",
"given",
"."
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/common/src/java/org/apache/heron/common/utils/metrics/MetricsCollector.java#L176-L200 |
27,890 | apache/incubator-heron | heron/metricscachemgr/src/java/org/apache/heron/metricscachemgr/metricscache/MetricsCacheQueryUtils.java | MetricsCacheQueryUtils.fromProtobuf | public static MetricRequest fromProtobuf(TopologyMaster.MetricRequest request) {
String componentName = request.getComponentName();
Map<String, Set<String>> componentNameInstanceId = new HashMap<>();
if (request.getInstanceIdCount() == 0) {
// empty list means all instances
// 'null' means all ... | java | public static MetricRequest fromProtobuf(TopologyMaster.MetricRequest request) {
String componentName = request.getComponentName();
Map<String, Set<String>> componentNameInstanceId = new HashMap<>();
if (request.getInstanceIdCount() == 0) {
// empty list means all instances
// 'null' means all ... | [
"public",
"static",
"MetricRequest",
"fromProtobuf",
"(",
"TopologyMaster",
".",
"MetricRequest",
"request",
")",
"{",
"String",
"componentName",
"=",
"request",
".",
"getComponentName",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",... | compatible with org.apache.heron.proto.tmaster.TopologyMaster.MetricRequest
@param request protobuf defined message
@return metricscache defined data structure | [
"compatible",
"with",
"org",
".",
"apache",
".",
"heron",
".",
"proto",
".",
"tmaster",
".",
"TopologyMaster",
".",
"MetricRequest"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/metricscachemgr/src/java/org/apache/heron/metricscachemgr/metricscache/MetricsCacheQueryUtils.java#L55-L101 |
27,891 | apache/incubator-heron | heron/metricscachemgr/src/java/org/apache/heron/metricscachemgr/metricscache/MetricsCacheQueryUtils.java | MetricsCacheQueryUtils.toProtobuf | public static TopologyMaster.MetricResponse toProtobuf(MetricResponse response,
MetricRequest request) {
TopologyMaster.MetricResponse.Builder builder =
TopologyMaster.MetricResponse.newBuilder();
builder.setInterval((request.getEndTime() - reques... | java | public static TopologyMaster.MetricResponse toProtobuf(MetricResponse response,
MetricRequest request) {
TopologyMaster.MetricResponse.Builder builder =
TopologyMaster.MetricResponse.newBuilder();
builder.setInterval((request.getEndTime() - reques... | [
"public",
"static",
"TopologyMaster",
".",
"MetricResponse",
"toProtobuf",
"(",
"MetricResponse",
"response",
",",
"MetricRequest",
"request",
")",
"{",
"TopologyMaster",
".",
"MetricResponse",
".",
"Builder",
"builder",
"=",
"TopologyMaster",
".",
"MetricResponse",
"... | compatible with org.apache.heron.proto.tmaster.TopologyMaster.MetricResponse
@param response metricscache defined data structure
@param request metricscache defined data structure
@return protobuf defined message | [
"compatible",
"with",
"org",
".",
"apache",
".",
"heron",
".",
"proto",
".",
"tmaster",
".",
"TopologyMaster",
".",
"MetricResponse"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/metricscachemgr/src/java/org/apache/heron/metricscachemgr/metricscache/MetricsCacheQueryUtils.java#L109-L174 |
27,892 | apache/incubator-heron | heron/metricscachemgr/src/java/org/apache/heron/metricscachemgr/metricscache/MetricsCacheQueryUtils.java | MetricsCacheQueryUtils.fromProtobuf | public static ExceptionRequest fromProtobuf(TopologyMaster.ExceptionLogRequest request) {
String componentName = request.getComponentName();
Map<String, Set<String>> componentNameInstanceId = new HashMap<>();
Set<String> instances = null;
if (request.getInstancesCount() > 0) {
instances = new Ha... | java | public static ExceptionRequest fromProtobuf(TopologyMaster.ExceptionLogRequest request) {
String componentName = request.getComponentName();
Map<String, Set<String>> componentNameInstanceId = new HashMap<>();
Set<String> instances = null;
if (request.getInstancesCount() > 0) {
instances = new Ha... | [
"public",
"static",
"ExceptionRequest",
"fromProtobuf",
"(",
"TopologyMaster",
".",
"ExceptionLogRequest",
"request",
")",
"{",
"String",
"componentName",
"=",
"request",
".",
"getComponentName",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">... | compatible with org.apache.heron.proto.tmaster.TopologyMaster.ExceptionLogRequest | [
"compatible",
"with",
"org",
".",
"apache",
".",
"heron",
".",
"proto",
".",
"tmaster",
".",
"TopologyMaster",
".",
"ExceptionLogRequest"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/metricscachemgr/src/java/org/apache/heron/metricscachemgr/metricscache/MetricsCacheQueryUtils.java#L177-L192 |
27,893 | apache/incubator-heron | heron/metricscachemgr/src/java/org/apache/heron/metricscachemgr/metricscache/MetricsCacheQueryUtils.java | MetricsCacheQueryUtils.toProtobuf | public static TopologyMaster.ExceptionLogResponse toProtobuf(ExceptionResponse response) {
TopologyMaster.ExceptionLogResponse.Builder builder =
TopologyMaster.ExceptionLogResponse.newBuilder();
// default OK if we have response to build already
builder.setStatus(Common.Status.newBuilder().setStatus... | java | public static TopologyMaster.ExceptionLogResponse toProtobuf(ExceptionResponse response) {
TopologyMaster.ExceptionLogResponse.Builder builder =
TopologyMaster.ExceptionLogResponse.newBuilder();
// default OK if we have response to build already
builder.setStatus(Common.Status.newBuilder().setStatus... | [
"public",
"static",
"TopologyMaster",
".",
"ExceptionLogResponse",
"toProtobuf",
"(",
"ExceptionResponse",
"response",
")",
"{",
"TopologyMaster",
".",
"ExceptionLogResponse",
".",
"Builder",
"builder",
"=",
"TopologyMaster",
".",
"ExceptionLogResponse",
".",
"newBuilder"... | compatible with org.apache.heron.proto.tmaster.TopologyMaster.ExceptionLogResponse | [
"compatible",
"with",
"org",
".",
"apache",
".",
"heron",
".",
"proto",
".",
"tmaster",
".",
"TopologyMaster",
".",
"ExceptionLogResponse"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/metricscachemgr/src/java/org/apache/heron/metricscachemgr/metricscache/MetricsCacheQueryUtils.java#L195-L219 |
27,894 | apache/incubator-heron | heron/simulator/src/java/org/apache/heron/simulator/utils/TopologyManager.java | TopologyManager.getComponentToTaskIds | public Map<String, List<Integer>> getComponentToTaskIds() {
if (this.componentToTaskIds == null) {
this.componentToTaskIds = new HashMap<>();
// Iterate over all instances and insert necessary info into the map
for (PhysicalPlans.Instance instance : this.getPhysicalPlan().getInstancesList()) {
... | java | public Map<String, List<Integer>> getComponentToTaskIds() {
if (this.componentToTaskIds == null) {
this.componentToTaskIds = new HashMap<>();
// Iterate over all instances and insert necessary info into the map
for (PhysicalPlans.Instance instance : this.getPhysicalPlan().getInstancesList()) {
... | [
"public",
"Map",
"<",
"String",
",",
"List",
"<",
"Integer",
">",
">",
"getComponentToTaskIds",
"(",
")",
"{",
"if",
"(",
"this",
".",
"componentToTaskIds",
"==",
"null",
")",
"{",
"this",
".",
"componentToTaskIds",
"=",
"new",
"HashMap",
"<>",
"(",
")",... | Get the map <componentId -> taskIds> from the Physical Plan
@return the map from componentId to its task ids | [
"Get",
"the",
"map",
"<",
";",
"componentId",
"-",
">",
";",
"taskIds>",
";",
"from",
"the",
"Physical",
"Plan"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/simulator/src/java/org/apache/heron/simulator/utils/TopologyManager.java#L110-L128 |
27,895 | apache/incubator-heron | heron/simulator/src/java/org/apache/heron/simulator/utils/TopologyManager.java | TopologyManager.extractTopologyTimeout | public Duration extractTopologyTimeout() {
for (TopologyAPI.Config.KeyValue keyValue
: this.getTopology().getTopologyConfig().getKvsList()) {
if (keyValue.getKey().equals("topology.message.timeout.secs")) {
return TypeUtils.getDuration(keyValue.getValue(), ChronoUnit.SECONDS);
}
}
... | java | public Duration extractTopologyTimeout() {
for (TopologyAPI.Config.KeyValue keyValue
: this.getTopology().getTopologyConfig().getKvsList()) {
if (keyValue.getKey().equals("topology.message.timeout.secs")) {
return TypeUtils.getDuration(keyValue.getValue(), ChronoUnit.SECONDS);
}
}
... | [
"public",
"Duration",
"extractTopologyTimeout",
"(",
")",
"{",
"for",
"(",
"TopologyAPI",
".",
"Config",
".",
"KeyValue",
"keyValue",
":",
"this",
".",
"getTopology",
"(",
")",
".",
"getTopologyConfig",
"(",
")",
".",
"getKvsList",
"(",
")",
")",
"{",
"if"... | Extract the config value "topology.message.timeout.secs" for given topology protobuf
@return the config value of "topology.message.timeout.secs" | [
"Extract",
"the",
"config",
"value",
"topology",
".",
"message",
".",
"timeout",
".",
"secs",
"for",
"given",
"topology",
"protobuf"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/simulator/src/java/org/apache/heron/simulator/utils/TopologyManager.java#L135-L144 |
27,896 | apache/incubator-heron | heron/simulator/src/java/org/apache/heron/simulator/utils/TopologyManager.java | TopologyManager.getStreamConsumers | public HashMap<TopologyAPI.StreamId, List<Grouping>> getStreamConsumers() {
if (this.streamConsumers == null) {
this.streamConsumers = new HashMap<>();
// First get a map of (TopologyAPI.StreamId -> TopologyAPI.StreamSchema)
Map<TopologyAPI.StreamId, TopologyAPI.StreamSchema> streamToSchema =
... | java | public HashMap<TopologyAPI.StreamId, List<Grouping>> getStreamConsumers() {
if (this.streamConsumers == null) {
this.streamConsumers = new HashMap<>();
// First get a map of (TopologyAPI.StreamId -> TopologyAPI.StreamSchema)
Map<TopologyAPI.StreamId, TopologyAPI.StreamSchema> streamToSchema =
... | [
"public",
"HashMap",
"<",
"TopologyAPI",
".",
"StreamId",
",",
"List",
"<",
"Grouping",
">",
">",
"getStreamConsumers",
"(",
")",
"{",
"if",
"(",
"this",
".",
"streamConsumers",
"==",
"null",
")",
"{",
"this",
".",
"streamConsumers",
"=",
"new",
"HashMap",... | Get the stream consumers map that was generated from the topology
@return the populated stream consumers' map | [
"Get",
"the",
"stream",
"consumers",
"map",
"that",
"was",
"generated",
"from",
"the",
"topology"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/simulator/src/java/org/apache/heron/simulator/utils/TopologyManager.java#L168-L214 |
27,897 | apache/incubator-heron | heron/common/src/java/org/apache/heron/common/network/HeronServer.java | HeronServer.stop | public void stop() {
if (acceptChannel == null || !acceptChannel.isOpen()) {
LOG.info("Fail to stop server; not yet open.");
return;
}
// Clear all connected socket and related stuff
for (Map.Entry<SocketChannel, SocketChannelHelper> connections : activeConnections.entrySet()) {
Socket... | java | public void stop() {
if (acceptChannel == null || !acceptChannel.isOpen()) {
LOG.info("Fail to stop server; not yet open.");
return;
}
// Clear all connected socket and related stuff
for (Map.Entry<SocketChannel, SocketChannelHelper> connections : activeConnections.entrySet()) {
Socket... | [
"public",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"acceptChannel",
"==",
"null",
"||",
"!",
"acceptChannel",
".",
"isOpen",
"(",
")",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Fail to stop server; not yet open.\"",
")",
";",
"return",
";",
"}",
"// Clear all... | Stop the HeronServer and clean relative staff | [
"Stop",
"the",
"HeronServer",
"and",
"clean",
"relative",
"staff"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/common/src/java/org/apache/heron/common/network/HeronServer.java#L107-L135 |
27,898 | apache/incubator-heron | storm-compatibility/src/java/backtype/storm/metric/api/GlobalMetrics.java | GlobalMetrics.incr | public static void incr(String counterName) {
org.apache.heron.api.metric.GlobalMetrics.incr(counterName);
} | java | public static void incr(String counterName) {
org.apache.heron.api.metric.GlobalMetrics.incr(counterName);
} | [
"public",
"static",
"void",
"incr",
"(",
"String",
"counterName",
")",
"{",
"org",
".",
"apache",
".",
"heron",
".",
"api",
".",
"metric",
".",
"GlobalMetrics",
".",
"incr",
"(",
"counterName",
")",
";",
"}"
] | Not thread safe increment of counterName. Counter doesn't exist unless incremented once | [
"Not",
"thread",
"safe",
"increment",
"of",
"counterName",
".",
"Counter",
"doesn",
"t",
"exist",
"unless",
"incremented",
"once"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/storm-compatibility/src/java/backtype/storm/metric/api/GlobalMetrics.java#L29-L31 |
27,899 | apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/RuntimeManagerRunner.java | RuntimeManagerRunner.activateTopologyHandler | private void activateTopologyHandler(String topologyName) throws TMasterException {
assert !potentialStaleExecutionData;
NetworkUtils.TunnelConfig tunnelConfig =
NetworkUtils.TunnelConfig.build(config, NetworkUtils.HeronSystem.SCHEDULER);
TMasterUtils.transitionTopologyState(topologyName,
TM... | java | private void activateTopologyHandler(String topologyName) throws TMasterException {
assert !potentialStaleExecutionData;
NetworkUtils.TunnelConfig tunnelConfig =
NetworkUtils.TunnelConfig.build(config, NetworkUtils.HeronSystem.SCHEDULER);
TMasterUtils.transitionTopologyState(topologyName,
TM... | [
"private",
"void",
"activateTopologyHandler",
"(",
"String",
"topologyName",
")",
"throws",
"TMasterException",
"{",
"assert",
"!",
"potentialStaleExecutionData",
";",
"NetworkUtils",
".",
"TunnelConfig",
"tunnelConfig",
"=",
"NetworkUtils",
".",
"TunnelConfig",
".",
"b... | Handler to activate a topology | [
"Handler",
"to",
"activate",
"a",
"topology"
] | 776abe2b5a45b93a0eb957fd65cbc149d901a92a | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/RuntimeManagerRunner.java#L111-L118 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.