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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
apache/reef | lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/cli/LogFileEntry.java | LogFileEntry.write | public void write(final Writer outputWriter) throws IOException {
try (final DataInputStream keyStream = entry.getKeyStream();
final DataInputStream valueStream = entry.getValueStream();) {
outputWriter.write("Container: ");
outputWriter.write(keyStream.readUTF());
outputWriter.write("\n"... | java | public void write(final Writer outputWriter) throws IOException {
try (final DataInputStream keyStream = entry.getKeyStream();
final DataInputStream valueStream = entry.getValueStream();) {
outputWriter.write("Container: ");
outputWriter.write(keyStream.readUTF());
outputWriter.write("\n"... | [
"public",
"void",
"write",
"(",
"final",
"Writer",
"outputWriter",
")",
"throws",
"IOException",
"{",
"try",
"(",
"final",
"DataInputStream",
"keyStream",
"=",
"entry",
".",
"getKeyStream",
"(",
")",
";",
"final",
"DataInputStream",
"valueStream",
"=",
"entry",
... | Writes the contents of the entry into the given outputWriter.
@param outputWriter
@throws IOException | [
"Writes",
"the",
"contents",
"of",
"the",
"entry",
"into",
"the",
"given",
"outputWriter",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/cli/LogFileEntry.java#L45-L53 | train |
apache/reef | lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/cli/LogFileEntry.java | LogFileEntry.write | public void write(final File folder) throws IOException {
try (final DataInputStream keyStream = entry.getKeyStream();
final DataInputStream valueStream = entry.getValueStream();) {
final String containerId = keyStream.readUTF();
try (final Writer outputWriter = new OutputStreamWriter(
... | java | public void write(final File folder) throws IOException {
try (final DataInputStream keyStream = entry.getKeyStream();
final DataInputStream valueStream = entry.getValueStream();) {
final String containerId = keyStream.readUTF();
try (final Writer outputWriter = new OutputStreamWriter(
... | [
"public",
"void",
"write",
"(",
"final",
"File",
"folder",
")",
"throws",
"IOException",
"{",
"try",
"(",
"final",
"DataInputStream",
"keyStream",
"=",
"entry",
".",
"getKeyStream",
"(",
")",
";",
"final",
"DataInputStream",
"valueStream",
"=",
"entry",
".",
... | Writes the logs stored in the entry as text files in folder, one per container.
@param folder
@throws IOException | [
"Writes",
"the",
"logs",
"stored",
"in",
"the",
"entry",
"as",
"text",
"files",
"in",
"folder",
"one",
"per",
"container",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/cli/LogFileEntry.java#L61-L70 | train |
apache/reef | lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/cli/LogFileEntry.java | LogFileEntry.writeFiles | private void writeFiles(final DataInputStream valueStream, final Writer outputWriter) throws IOException {
while (valueStream.available() > 0) {
final String strFileName = valueStream.readUTF();
final int entryLength = Integer.parseInt(valueStream.readUTF());
outputWriter.write("==================... | java | private void writeFiles(final DataInputStream valueStream, final Writer outputWriter) throws IOException {
while (valueStream.available() > 0) {
final String strFileName = valueStream.readUTF();
final int entryLength = Integer.parseInt(valueStream.readUTF());
outputWriter.write("==================... | [
"private",
"void",
"writeFiles",
"(",
"final",
"DataInputStream",
"valueStream",
",",
"final",
"Writer",
"outputWriter",
")",
"throws",
"IOException",
"{",
"while",
"(",
"valueStream",
".",
"available",
"(",
")",
">",
"0",
")",
"{",
"final",
"String",
"strFile... | Writes the logs of the next container to the given writer. Assumes that the valueStream is suitably positioned.
@param valueStream
@param outputWriter
@throws IOException | [
"Writes",
"the",
"logs",
"of",
"the",
"next",
"container",
"to",
"the",
"given",
"writer",
".",
"Assumes",
"that",
"the",
"valueStream",
"is",
"suitably",
"positioned",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/cli/LogFileEntry.java#L80-L91 | train |
apache/reef | lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/cli/LogFileEntry.java | LogFileEntry.write | private void write(final DataInputStream stream, final Writer outputWriter, final int numberOfBytes)
throws IOException {
final byte[] buf = new byte[65535];
int lenRemaining = numberOfBytes;
while (lenRemaining > 0) {
final int len = stream.read(buf, 0, lenRemaining > 65535 ? 65535 : lenRemaini... | java | private void write(final DataInputStream stream, final Writer outputWriter, final int numberOfBytes)
throws IOException {
final byte[] buf = new byte[65535];
int lenRemaining = numberOfBytes;
while (lenRemaining > 0) {
final int len = stream.read(buf, 0, lenRemaining > 65535 ? 65535 : lenRemaini... | [
"private",
"void",
"write",
"(",
"final",
"DataInputStream",
"stream",
",",
"final",
"Writer",
"outputWriter",
",",
"final",
"int",
"numberOfBytes",
")",
"throws",
"IOException",
"{",
"final",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"65535",
"]",
... | Writes the next numberOfBytes bytes from the stream to the outputWriter, assuming that the bytes are UTF-8 encoded
characters.
@param stream
@param outputWriter
@param numberOfBytes
@throws IOException | [
"Writes",
"the",
"next",
"numberOfBytes",
"bytes",
"from",
"the",
"stream",
"to",
"the",
"outputWriter",
"assuming",
"that",
"the",
"bytes",
"are",
"UTF",
"-",
"8",
"encoded",
"characters",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/cli/LogFileEntry.java#L102-L115 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/unmanaged/YarnProxyUser.java | YarnProxyUser.set | @Override
public void set(final String name, final UserCredentials hostUser) throws IOException {
assert this.proxyUGI == null;
assert hostUser instanceof YarnProxyUser;
LOG.log(Level.FINE, "UGI: user {0} copy from: {1}", new Object[] {name, hostUser});
final UserGroupInformation hostUGI = ((YarnPr... | java | @Override
public void set(final String name, final UserCredentials hostUser) throws IOException {
assert this.proxyUGI == null;
assert hostUser instanceof YarnProxyUser;
LOG.log(Level.FINE, "UGI: user {0} copy from: {1}", new Object[] {name, hostUser});
final UserGroupInformation hostUGI = ((YarnPr... | [
"@",
"Override",
"public",
"void",
"set",
"(",
"final",
"String",
"name",
",",
"final",
"UserCredentials",
"hostUser",
")",
"throws",
"IOException",
"{",
"assert",
"this",
".",
"proxyUGI",
"==",
"null",
";",
"assert",
"hostUser",
"instanceof",
"YarnProxyUser",
... | Set YARN user. This method can be called only once per class instance.
@param name Name of the new proxy user.
@param hostUser User credentials to copy. Must be an instance of YarnProxyUser. | [
"Set",
"YARN",
"user",
".",
"This",
"method",
"can",
"be",
"called",
"only",
"once",
"per",
"class",
"instance",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/unmanaged/YarnProxyUser.java#L83-L95 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/unmanaged/YarnProxyUser.java | YarnProxyUser.set | @SafeVarargs
public final void set(final String proxyName,
final UserGroupInformation hostUGI, final Token<? extends TokenIdentifier>... tokens) {
assert this.proxyUGI == null;
this.proxyUGI = UserGroupInformation.createProxyUser(proxyName, hostUGI);
for (final Token<? extends TokenIdentifier> tok... | java | @SafeVarargs
public final void set(final String proxyName,
final UserGroupInformation hostUGI, final Token<? extends TokenIdentifier>... tokens) {
assert this.proxyUGI == null;
this.proxyUGI = UserGroupInformation.createProxyUser(proxyName, hostUGI);
for (final Token<? extends TokenIdentifier> tok... | [
"@",
"SafeVarargs",
"public",
"final",
"void",
"set",
"(",
"final",
"String",
"proxyName",
",",
"final",
"UserGroupInformation",
"hostUGI",
",",
"final",
"Token",
"<",
"?",
"extends",
"TokenIdentifier",
">",
"...",
"tokens",
")",
"{",
"assert",
"this",
".",
... | Create YARN proxy user and add security tokens to its credentials.
This method can be called only once per class instance.
@param proxyName Name of the new proxy user.
@param hostUGI YARN user to impersonate the proxy.
@param tokens Security tokens to add to the new proxy user's credentials. | [
"Create",
"YARN",
"proxy",
"user",
"and",
"add",
"security",
"tokens",
"to",
"its",
"credentials",
".",
"This",
"method",
"can",
"be",
"called",
"only",
"once",
"per",
"class",
"instance",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/unmanaged/YarnProxyUser.java#L104-L116 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/unmanaged/YarnProxyUser.java | YarnProxyUser.doAs | public <T> T doAs(final PrivilegedExceptionAction<T> action) throws Exception {
LOG.log(Level.FINE, "{0} execute {1}", new Object[] {this, action});
return this.proxyUGI == null ? action.run() : this.proxyUGI.doAs(action);
} | java | public <T> T doAs(final PrivilegedExceptionAction<T> action) throws Exception {
LOG.log(Level.FINE, "{0} execute {1}", new Object[] {this, action});
return this.proxyUGI == null ? action.run() : this.proxyUGI.doAs(action);
} | [
"public",
"<",
"T",
">",
"T",
"doAs",
"(",
"final",
"PrivilegedExceptionAction",
"<",
"T",
">",
"action",
")",
"throws",
"Exception",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"{0} execute {1}\"",
",",
"new",
"Object",
"[",
"]",
"{",
"t... | Execute the privileged action as a given user.
If user credentials are not set, execute the action outside the user context.
@param action an action to run.
@param <T> action return type.
@return result of an action.
@throws Exception whatever the action can throw. | [
"Execute",
"the",
"privileged",
"action",
"as",
"a",
"given",
"user",
".",
"If",
"user",
"credentials",
"are",
"not",
"set",
"execute",
"the",
"action",
"outside",
"the",
"user",
"context",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/unmanaged/YarnProxyUser.java#L126-L129 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/pool/SleepTask.java | SleepTask.call | @Override
public byte[] call(final byte[] memento) {
LOG.log(Level.FINE, "Task started: sleep for: {0} msec.", this.delay);
final long ts = System.currentTimeMillis();
for (long period = this.delay; period > 0; period -= System.currentTimeMillis() - ts) {
try {
Thread.sleep(period);
} ... | java | @Override
public byte[] call(final byte[] memento) {
LOG.log(Level.FINE, "Task started: sleep for: {0} msec.", this.delay);
final long ts = System.currentTimeMillis();
for (long period = this.delay; period > 0; period -= System.currentTimeMillis() - ts) {
try {
Thread.sleep(period);
} ... | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"call",
"(",
"final",
"byte",
"[",
"]",
"memento",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"Task started: sleep for: {0} msec.\"",
",",
"this",
".",
"delay",
")",
";",
"final",
"long",
... | Sleep for delay milliseconds and return.
@param memento ignored.
@return null. | [
"Sleep",
"for",
"delay",
"milliseconds",
"and",
"return",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/pool/SleepTask.java#L59-L72 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/JobSubmissionHelper.java | JobSubmissionHelper.getJobSubmissionBuilder | JobSubmissionEventImpl.Builder getJobSubmissionBuilder(final Configuration driverConfiguration)
throws InjectionException, IOException {
final Injector injector = Tang.Factory.getTang().newInjector(driverConfiguration);
final boolean preserveEvaluators = injector.getNamedInstance(ResourceManagerPreserveE... | java | JobSubmissionEventImpl.Builder getJobSubmissionBuilder(final Configuration driverConfiguration)
throws InjectionException, IOException {
final Injector injector = Tang.Factory.getTang().newInjector(driverConfiguration);
final boolean preserveEvaluators = injector.getNamedInstance(ResourceManagerPreserveE... | [
"JobSubmissionEventImpl",
".",
"Builder",
"getJobSubmissionBuilder",
"(",
"final",
"Configuration",
"driverConfiguration",
")",
"throws",
"InjectionException",
",",
"IOException",
"{",
"final",
"Injector",
"injector",
"=",
"Tang",
".",
"Factory",
".",
"getTang",
"(",
... | Fils out a JobSubmissionProto based on the driver configuration given.
@param driverConfiguration
@return
@throws InjectionException
@throws IOException | [
"Fils",
"out",
"a",
"JobSubmissionProto",
"based",
"on",
"the",
"driver",
"configuration",
"given",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/JobSubmissionHelper.java#L76-L113 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/JobSubmissionHelper.java | JobSubmissionHelper.getFileResourceProto | private static FileResource getFileResourceProto(final String fileName, final FileType type) throws IOException {
File file = new File(fileName);
if (file.exists()) {
// It is a local file and can be added.
if (file.isDirectory()) {
// If it is a directory, create a JAR file of it and add th... | java | private static FileResource getFileResourceProto(final String fileName, final FileType type) throws IOException {
File file = new File(fileName);
if (file.exists()) {
// It is a local file and can be added.
if (file.isDirectory()) {
// If it is a directory, create a JAR file of it and add th... | [
"private",
"static",
"FileResource",
"getFileResourceProto",
"(",
"final",
"String",
"fileName",
",",
"final",
"FileType",
"type",
")",
"throws",
"IOException",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"fileName",
")",
";",
"if",
"(",
"file",
".",
"exis... | Turns a pathname into the right protocol for job submission.
@param fileName
@param type
@return
@throws IOException | [
"Turns",
"a",
"pathname",
"into",
"the",
"right",
"protocol",
"for",
"job",
"submission",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/JobSubmissionHelper.java#L141-L170 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/JobSubmissionHelper.java | JobSubmissionHelper.toJar | private static File toJar(final File file) throws IOException {
final File tempFolder = Files.createTempDirectory("reef-tmp-tempFolder").toFile();
final File jarFile = File.createTempFile(file.getCanonicalFile().getName(), ".jar", tempFolder);
LOG.log(Level.FINEST, "Adding contents of folder {0} to {1}", ne... | java | private static File toJar(final File file) throws IOException {
final File tempFolder = Files.createTempDirectory("reef-tmp-tempFolder").toFile();
final File jarFile = File.createTempFile(file.getCanonicalFile().getName(), ".jar", tempFolder);
LOG.log(Level.FINEST, "Adding contents of folder {0} to {1}", ne... | [
"private",
"static",
"File",
"toJar",
"(",
"final",
"File",
"file",
")",
"throws",
"IOException",
"{",
"final",
"File",
"tempFolder",
"=",
"Files",
".",
"createTempDirectory",
"(",
"\"reef-tmp-tempFolder\"",
")",
".",
"toFile",
"(",
")",
";",
"final",
"File",
... | Turns temporary folder "foo" into a jar file "foo.jar".
@param file
@return
@throws IOException | [
"Turns",
"temporary",
"folder",
"foo",
"into",
"a",
"jar",
"file",
"foo",
".",
"jar",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/JobSubmissionHelper.java#L179-L187 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/client/FailedRuntime.java | FailedRuntime.getThrowable | private static Throwable getThrowable(final RuntimeErrorProto error) {
final byte[] data = getData(error);
if (data != null) {
try {
return CODEC.decode(data);
} catch (final RemoteRuntimeException ex) {
LOG.log(Level.FINE, "Could not decode exception {0}: {1}", new Object[]{error, e... | java | private static Throwable getThrowable(final RuntimeErrorProto error) {
final byte[] data = getData(error);
if (data != null) {
try {
return CODEC.decode(data);
} catch (final RemoteRuntimeException ex) {
LOG.log(Level.FINE, "Could not decode exception {0}: {1}", new Object[]{error, e... | [
"private",
"static",
"Throwable",
"getThrowable",
"(",
"final",
"RuntimeErrorProto",
"error",
")",
"{",
"final",
"byte",
"[",
"]",
"data",
"=",
"getData",
"(",
"error",
")",
";",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"CODEC",
... | Retrieve Java exception from protobuf object, if possible. Otherwise, return null.
This is a utility method used in the FailedRuntime constructor.
@param error protobuf error message structure.
@return Java exception or null if exception is missing or cannot be decoded. | [
"Retrieve",
"Java",
"exception",
"from",
"protobuf",
"object",
"if",
"possible",
".",
"Otherwise",
"return",
"null",
".",
"This",
"is",
"a",
"utility",
"method",
"used",
"in",
"the",
"FailedRuntime",
"constructor",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/client/FailedRuntime.java#L62-L72 | train |
apache/reef | lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java | HDInsightInstance.getApplicationID | public ApplicationID getApplicationID() throws IOException {
final String url = "ws/v1/cluster/apps/new-application";
final HttpPost post = preparePost(url);
try (final CloseableHttpResponse response = this.httpClient.execute(post, this.httpClientContext)) {
final String message = IOUtils.toString(res... | java | public ApplicationID getApplicationID() throws IOException {
final String url = "ws/v1/cluster/apps/new-application";
final HttpPost post = preparePost(url);
try (final CloseableHttpResponse response = this.httpClient.execute(post, this.httpClientContext)) {
final String message = IOUtils.toString(res... | [
"public",
"ApplicationID",
"getApplicationID",
"(",
")",
"throws",
"IOException",
"{",
"final",
"String",
"url",
"=",
"\"ws/v1/cluster/apps/new-application\"",
";",
"final",
"HttpPost",
"post",
"=",
"preparePost",
"(",
"url",
")",
";",
"try",
"(",
"final",
"Closea... | Request an ApplicationId from the cluster.
@return
@throws IOException | [
"Request",
"an",
"ApplicationId",
"from",
"the",
"cluster",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java#L90-L98 | train |
apache/reef | lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java | HDInsightInstance.submitApplication | public void submitApplication(final ApplicationSubmission applicationSubmission) throws IOException {
final String url = "ws/v1/cluster/apps";
final HttpPost post = preparePost(url);
final StringWriter writer = new StringWriter();
try {
this.objectMapper.writeValue(writer, applicationSubmission);... | java | public void submitApplication(final ApplicationSubmission applicationSubmission) throws IOException {
final String url = "ws/v1/cluster/apps";
final HttpPost post = preparePost(url);
final StringWriter writer = new StringWriter();
try {
this.objectMapper.writeValue(writer, applicationSubmission);... | [
"public",
"void",
"submitApplication",
"(",
"final",
"ApplicationSubmission",
"applicationSubmission",
")",
"throws",
"IOException",
"{",
"final",
"String",
"url",
"=",
"\"ws/v1/cluster/apps\"",
";",
"final",
"HttpPost",
"post",
"=",
"preparePost",
"(",
"url",
")",
... | Submits an application for execution.
@param applicationSubmission
@throws IOException | [
"Submits",
"an",
"application",
"for",
"execution",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java#L106-L124 | train |
apache/reef | lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java | HDInsightInstance.killApplication | public void killApplication(final String applicationId) throws IOException {
final String url = this.getApplicationURL(applicationId) + "/state";
final HttpPut put = preparePut(url);
put.setEntity(new StringEntity(APPLICATION_KILL_MESSAGE, ContentType.APPLICATION_JSON));
this.httpClient.execute(put, thi... | java | public void killApplication(final String applicationId) throws IOException {
final String url = this.getApplicationURL(applicationId) + "/state";
final HttpPut put = preparePut(url);
put.setEntity(new StringEntity(APPLICATION_KILL_MESSAGE, ContentType.APPLICATION_JSON));
this.httpClient.execute(put, thi... | [
"public",
"void",
"killApplication",
"(",
"final",
"String",
"applicationId",
")",
"throws",
"IOException",
"{",
"final",
"String",
"url",
"=",
"this",
".",
"getApplicationURL",
"(",
"applicationId",
")",
"+",
"\"/state\"",
";",
"final",
"HttpPut",
"put",
"=",
... | Issues a YARN kill command to the application.
@param applicationId | [
"Issues",
"a",
"YARN",
"kill",
"command",
"to",
"the",
"application",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java#L131-L136 | train |
apache/reef | lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java | HDInsightInstance.getApplication | public ApplicationState getApplication(final String applicationId) throws IOException {
final String url = this.getApplicationURL(applicationId);
final HttpGet get = prepareGet(url);
try (final CloseableHttpResponse response = this.httpClient.execute(get, this.httpClientContext)) {
final String messag... | java | public ApplicationState getApplication(final String applicationId) throws IOException {
final String url = this.getApplicationURL(applicationId);
final HttpGet get = prepareGet(url);
try (final CloseableHttpResponse response = this.httpClient.execute(get, this.httpClientContext)) {
final String messag... | [
"public",
"ApplicationState",
"getApplication",
"(",
"final",
"String",
"applicationId",
")",
"throws",
"IOException",
"{",
"final",
"String",
"url",
"=",
"this",
".",
"getApplicationURL",
"(",
"applicationId",
")",
";",
"final",
"HttpGet",
"get",
"=",
"prepareGet... | Gets the application state given a YARN application ID.
@param applicationId
@return Application state of the requested application. | [
"Gets",
"the",
"application",
"state",
"given",
"a",
"YARN",
"application",
"ID",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java#L143-L151 | train |
apache/reef | lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java | HDInsightInstance.prepareGet | private HttpGet prepareGet(final String url) {
final HttpGet httpGet = new HttpGet(this.instanceUrl + url);
for (final Header header : this.headers) {
httpGet.addHeader(header);
}
return httpGet;
} | java | private HttpGet prepareGet(final String url) {
final HttpGet httpGet = new HttpGet(this.instanceUrl + url);
for (final Header header : this.headers) {
httpGet.addHeader(header);
}
return httpGet;
} | [
"private",
"HttpGet",
"prepareGet",
"(",
"final",
"String",
"url",
")",
"{",
"final",
"HttpGet",
"httpGet",
"=",
"new",
"HttpGet",
"(",
"this",
".",
"instanceUrl",
"+",
"url",
")",
";",
"for",
"(",
"final",
"Header",
"header",
":",
"this",
".",
"headers"... | Creates a HttpGet request with all the common headers.
@param url
@return | [
"Creates",
"a",
"HttpGet",
"request",
"with",
"all",
"the",
"common",
"headers",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java#L182-L188 | train |
apache/reef | lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java | HDInsightInstance.preparePost | private HttpPost preparePost(final String url) {
final HttpPost httpPost = new HttpPost(this.instanceUrl + url);
for (final Header header : this.headers) {
httpPost.addHeader(header);
}
return httpPost;
} | java | private HttpPost preparePost(final String url) {
final HttpPost httpPost = new HttpPost(this.instanceUrl + url);
for (final Header header : this.headers) {
httpPost.addHeader(header);
}
return httpPost;
} | [
"private",
"HttpPost",
"preparePost",
"(",
"final",
"String",
"url",
")",
"{",
"final",
"HttpPost",
"httpPost",
"=",
"new",
"HttpPost",
"(",
"this",
".",
"instanceUrl",
"+",
"url",
")",
";",
"for",
"(",
"final",
"Header",
"header",
":",
"this",
".",
"hea... | Creates a HttpPost request with all the common headers.
@param url
@return | [
"Creates",
"a",
"HttpPost",
"request",
"with",
"all",
"the",
"common",
"headers",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java#L196-L202 | train |
apache/reef | lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java | HDInsightInstance.preparePut | private HttpPut preparePut(final String url) {
final HttpPut httpPut = new HttpPut(this.instanceUrl + url);
for (final Header header : this.headers) {
httpPut.addHeader(header);
}
return httpPut;
} | java | private HttpPut preparePut(final String url) {
final HttpPut httpPut = new HttpPut(this.instanceUrl + url);
for (final Header header : this.headers) {
httpPut.addHeader(header);
}
return httpPut;
} | [
"private",
"HttpPut",
"preparePut",
"(",
"final",
"String",
"url",
")",
"{",
"final",
"HttpPut",
"httpPut",
"=",
"new",
"HttpPut",
"(",
"this",
".",
"instanceUrl",
"+",
"url",
")",
";",
"for",
"(",
"final",
"Header",
"header",
":",
"this",
".",
"headers"... | Creates a HttpPut request with all the common headers.
@param url
@return | [
"Creates",
"a",
"HttpPut",
"request",
"with",
"all",
"the",
"common",
"headers",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java#L209-L215 | train |
apache/reef | lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/driver/AzureBatchTaskStatusAlarmHandler.java | AzureBatchTaskStatusAlarmHandler.onNext | @Override
public void onNext(final Alarm alarm) {
String jobId = this.azureBatchHelper.getAzureBatchJobId();
List<CloudTask> allTasks = this.azureBatchHelper.getTaskStatusForJob(jobId);
// Report status if the task has an associated active container.
LOG.log(Level.FINER, "Found {0} tasks from job id ... | java | @Override
public void onNext(final Alarm alarm) {
String jobId = this.azureBatchHelper.getAzureBatchJobId();
List<CloudTask> allTasks = this.azureBatchHelper.getTaskStatusForJob(jobId);
// Report status if the task has an associated active container.
LOG.log(Level.FINER, "Found {0} tasks from job id ... | [
"@",
"Override",
"public",
"void",
"onNext",
"(",
"final",
"Alarm",
"alarm",
")",
"{",
"String",
"jobId",
"=",
"this",
".",
"azureBatchHelper",
".",
"getAzureBatchJobId",
"(",
")",
";",
"List",
"<",
"CloudTask",
">",
"allTasks",
"=",
"this",
".",
"azureBat... | This method is periodically invoked by the Runtime Clock. It will call Azure Batch APIs to determine
the status of tasks running inside the job and notify REEF of tasks statuses that correspond to running
evaluators.
@param alarm alarm object. | [
"This",
"method",
"is",
"periodically",
"invoked",
"by",
"the",
"Runtime",
"Clock",
".",
"It",
"will",
"call",
"Azure",
"Batch",
"APIs",
"to",
"determine",
"the",
"status",
"of",
"tasks",
"running",
"inside",
"the",
"job",
"and",
"notify",
"REEF",
"of",
"t... | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/driver/AzureBatchTaskStatusAlarmHandler.java#L88-L123 | train |
apache/reef | lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/driver/AzureBatchTaskStatusAlarmHandler.java | AzureBatchTaskStatusAlarmHandler.enableAlarm | public synchronized void enableAlarm() {
if (!this.isAlarmEnabled) {
LOG.log(Level.FINE, "Enabling the alarm and scheduling it to fire in {0} ms.", this.taskStatusCheckPeriod);
this.isAlarmEnabled = true;
this.scheduleAlarm();
} else {
LOG.log(Level.FINE, "Alarm is already enabled.");
... | java | public synchronized void enableAlarm() {
if (!this.isAlarmEnabled) {
LOG.log(Level.FINE, "Enabling the alarm and scheduling it to fire in {0} ms.", this.taskStatusCheckPeriod);
this.isAlarmEnabled = true;
this.scheduleAlarm();
} else {
LOG.log(Level.FINE, "Alarm is already enabled.");
... | [
"public",
"synchronized",
"void",
"enableAlarm",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isAlarmEnabled",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"Enabling the alarm and scheduling it to fire in {0} ms.\"",
",",
"this",
".",
"taskStat... | Enable the period alarm to send status updates. | [
"Enable",
"the",
"period",
"alarm",
"to",
"send",
"status",
"updates",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/driver/AzureBatchTaskStatusAlarmHandler.java#L128-L136 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/SchedulerDriver.java | SchedulerDriver.submitCommand | public synchronized int submitCommand(final String command) {
final Integer id = scheduler.assignTaskId();
scheduler.addTask(new TaskEntity(id, command));
if (state == State.READY) {
notify(); // Wake up at {waitForCommands}
} else if (state == State.RUNNING && nMaxEval > nActiveEval + nRequested... | java | public synchronized int submitCommand(final String command) {
final Integer id = scheduler.assignTaskId();
scheduler.addTask(new TaskEntity(id, command));
if (state == State.READY) {
notify(); // Wake up at {waitForCommands}
} else if (state == State.RUNNING && nMaxEval > nActiveEval + nRequested... | [
"public",
"synchronized",
"int",
"submitCommand",
"(",
"final",
"String",
"command",
")",
"{",
"final",
"Integer",
"id",
"=",
"scheduler",
".",
"assignTaskId",
"(",
")",
";",
"scheduler",
".",
"addTask",
"(",
"new",
"TaskEntity",
"(",
"id",
",",
"command",
... | Submit a command to schedule. | [
"Submit",
"a",
"command",
"to",
"schedule",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/SchedulerDriver.java#L211-L221 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/SchedulerDriver.java | SchedulerDriver.setMaxEvaluators | public synchronized int setMaxEvaluators(final int targetNum) throws UnsuccessfulException {
if (targetNum < nActiveEval + nRequestedEval) {
throw new UnsuccessfulException(nActiveEval + nRequestedEval +
" evaluators are used now. Should be larger than that.");
}
nMaxEval = targetNum;
i... | java | public synchronized int setMaxEvaluators(final int targetNum) throws UnsuccessfulException {
if (targetNum < nActiveEval + nRequestedEval) {
throw new UnsuccessfulException(nActiveEval + nRequestedEval +
" evaluators are used now. Should be larger than that.");
}
nMaxEval = targetNum;
i... | [
"public",
"synchronized",
"int",
"setMaxEvaluators",
"(",
"final",
"int",
"targetNum",
")",
"throws",
"UnsuccessfulException",
"{",
"if",
"(",
"targetNum",
"<",
"nActiveEval",
"+",
"nRequestedEval",
")",
"{",
"throw",
"new",
"UnsuccessfulException",
"(",
"nActiveEva... | Update the maximum number of evaluators to hold.
Request more evaluators in case there are pending tasks
in the queue and the number of evaluators is less than the limit. | [
"Update",
"the",
"maximum",
"number",
"of",
"evaluators",
"to",
"hold",
".",
"Request",
"more",
"evaluators",
"in",
"case",
"there",
"are",
"pending",
"tasks",
"in",
"the",
"queue",
"and",
"the",
"number",
"of",
"evaluators",
"is",
"less",
"than",
"the",
"... | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/SchedulerDriver.java#L228-L241 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/SchedulerDriver.java | SchedulerDriver.requestEvaluator | private synchronized void requestEvaluator(final int numToRequest) {
if (numToRequest <= 0) {
throw new IllegalArgumentException("The number of evaluator request should be a positive integer");
}
nRequestedEval += numToRequest;
requestor.newRequest()
.setMemory(32)
.setNumber(numT... | java | private synchronized void requestEvaluator(final int numToRequest) {
if (numToRequest <= 0) {
throw new IllegalArgumentException("The number of evaluator request should be a positive integer");
}
nRequestedEval += numToRequest;
requestor.newRequest()
.setMemory(32)
.setNumber(numT... | [
"private",
"synchronized",
"void",
"requestEvaluator",
"(",
"final",
"int",
"numToRequest",
")",
"{",
"if",
"(",
"numToRequest",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The number of evaluator request should be a positive integer\"",
")",
... | Request evaluators. Passing a non positive number is illegal,
so it does not make a trial for that situation. | [
"Request",
"evaluators",
".",
"Passing",
"a",
"non",
"positive",
"number",
"is",
"illegal",
"so",
"it",
"does",
"not",
"make",
"a",
"trial",
"for",
"that",
"situation",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/SchedulerDriver.java#L247-L257 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/SchedulerDriver.java | SchedulerDriver.waitForCommands | private synchronized void waitForCommands(final ActiveContext context) {
while (!scheduler.hasPendingTasks()) {
// Wait until any command enters in the queue
try {
wait();
} catch (final InterruptedException e) {
LOG.log(Level.WARNING, "InterruptedException occurred in SchedulerDri... | java | private synchronized void waitForCommands(final ActiveContext context) {
while (!scheduler.hasPendingTasks()) {
// Wait until any command enters in the queue
try {
wait();
} catch (final InterruptedException e) {
LOG.log(Level.WARNING, "InterruptedException occurred in SchedulerDri... | [
"private",
"synchronized",
"void",
"waitForCommands",
"(",
"final",
"ActiveContext",
"context",
")",
"{",
"while",
"(",
"!",
"scheduler",
".",
"hasPendingTasks",
"(",
")",
")",
"{",
"// Wait until any command enters in the queue",
"try",
"{",
"wait",
"(",
")",
";"... | Pick up a command from the queue and run it. Wait until
any command coming up if no command exists. | [
"Pick",
"up",
"a",
"command",
"from",
"the",
"queue",
"and",
"run",
"it",
".",
"Wait",
"until",
"any",
"command",
"coming",
"up",
"if",
"no",
"command",
"exists",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/SchedulerDriver.java#L263-L275 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/SchedulerDriver.java | SchedulerDriver.retainEvaluator | private synchronized void retainEvaluator(final ActiveContext context) {
if (scheduler.hasPendingTasks()) {
scheduler.submitTask(context);
} else if (nActiveEval > 1) {
nActiveEval--;
context.close();
} else {
state = State.READY;
waitForCommands(context);
}
} | java | private synchronized void retainEvaluator(final ActiveContext context) {
if (scheduler.hasPendingTasks()) {
scheduler.submitTask(context);
} else if (nActiveEval > 1) {
nActiveEval--;
context.close();
} else {
state = State.READY;
waitForCommands(context);
}
} | [
"private",
"synchronized",
"void",
"retainEvaluator",
"(",
"final",
"ActiveContext",
"context",
")",
"{",
"if",
"(",
"scheduler",
".",
"hasPendingTasks",
"(",
")",
")",
"{",
"scheduler",
".",
"submitTask",
"(",
"context",
")",
";",
"}",
"else",
"if",
"(",
... | Retain the complete evaluators submitting another task
until there is no need to reuse them. | [
"Retain",
"the",
"complete",
"evaluators",
"submitting",
"another",
"task",
"until",
"there",
"is",
"no",
"need",
"to",
"reuse",
"them",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/SchedulerDriver.java#L281-L291 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/SchedulerDriver.java | SchedulerDriver.reallocateEvaluator | private synchronized void reallocateEvaluator(final ActiveContext context) {
nActiveEval--;
context.close();
if (scheduler.hasPendingTasks()) {
requestEvaluator(1);
} else if (nActiveEval <= 0) {
state = State.WAIT_EVALUATORS;
requestEvaluator(1);
}
} | java | private synchronized void reallocateEvaluator(final ActiveContext context) {
nActiveEval--;
context.close();
if (scheduler.hasPendingTasks()) {
requestEvaluator(1);
} else if (nActiveEval <= 0) {
state = State.WAIT_EVALUATORS;
requestEvaluator(1);
}
} | [
"private",
"synchronized",
"void",
"reallocateEvaluator",
"(",
"final",
"ActiveContext",
"context",
")",
"{",
"nActiveEval",
"--",
";",
"context",
".",
"close",
"(",
")",
";",
"if",
"(",
"scheduler",
".",
"hasPendingTasks",
"(",
")",
")",
"{",
"requestEvaluato... | Always close the complete evaluators and
allocate a new evaluator if necessary. | [
"Always",
"close",
"the",
"complete",
"evaluators",
"and",
"allocate",
"a",
"new",
"evaluator",
"if",
"necessary",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/SchedulerDriver.java#L297-L307 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/EvaluatorSetupHelper.java | EvaluatorSetupHelper.getResources | Map<String, LocalResource> getResources(
final ResourceLaunchEvent resourceLaunchEvent)
throws IOException {
final Map<String, LocalResource> result = new HashMap<>();
result.putAll(getGlobalResources());
final File localStagingFolder = this.tempFileCreator.createTempDirectory(this.fileNames.g... | java | Map<String, LocalResource> getResources(
final ResourceLaunchEvent resourceLaunchEvent)
throws IOException {
final Map<String, LocalResource> result = new HashMap<>();
result.putAll(getGlobalResources());
final File localStagingFolder = this.tempFileCreator.createTempDirectory(this.fileNames.g... | [
"Map",
"<",
"String",
",",
"LocalResource",
">",
"getResources",
"(",
"final",
"ResourceLaunchEvent",
"resourceLaunchEvent",
")",
"throws",
"IOException",
"{",
"final",
"Map",
"<",
"String",
",",
"LocalResource",
">",
"result",
"=",
"new",
"HashMap",
"<>",
"(",
... | Sets up the LocalResources for a new Evaluator.
@param resourceLaunchEvent
@return
@throws IOException | [
"Sets",
"up",
"the",
"LocalResources",
"for",
"a",
"new",
"Evaluator",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/EvaluatorSetupHelper.java#L94-L131 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/EvaluatorSetupHelper.java | EvaluatorSetupHelper.makeEvaluatorConfiguration | private Configuration makeEvaluatorConfiguration(final ResourceLaunchEvent resourceLaunchEvent)
throws IOException {
return Tang.Factory.getTang()
.newConfigurationBuilder(resourceLaunchEvent.getEvaluatorConf())
.build();
} | java | private Configuration makeEvaluatorConfiguration(final ResourceLaunchEvent resourceLaunchEvent)
throws IOException {
return Tang.Factory.getTang()
.newConfigurationBuilder(resourceLaunchEvent.getEvaluatorConf())
.build();
} | [
"private",
"Configuration",
"makeEvaluatorConfiguration",
"(",
"final",
"ResourceLaunchEvent",
"resourceLaunchEvent",
")",
"throws",
"IOException",
"{",
"return",
"Tang",
".",
"Factory",
".",
"getTang",
"(",
")",
".",
"newConfigurationBuilder",
"(",
"resourceLaunchEvent",... | Assembles the configuration for an Evaluator.
@param resourceLaunchEvent
@return
@throws IOException | [
"Assembles",
"the",
"configuration",
"for",
"an",
"Evaluator",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/EvaluatorSetupHelper.java#L141-L146 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/driver/restart/DriverRestartManager.java | DriverRestartManager.detectRestart | public synchronized boolean detectRestart() {
if (this.state.hasNotRestarted()) {
resubmissionAttempts = driverRuntimeRestartManager.getResubmissionAttempts();
if (resubmissionAttempts > 0) {
// set the state machine in motion.
this.state = DriverRestartState.BEGAN;
}
}
r... | java | public synchronized boolean detectRestart() {
if (this.state.hasNotRestarted()) {
resubmissionAttempts = driverRuntimeRestartManager.getResubmissionAttempts();
if (resubmissionAttempts > 0) {
// set the state machine in motion.
this.state = DriverRestartState.BEGAN;
}
}
r... | [
"public",
"synchronized",
"boolean",
"detectRestart",
"(",
")",
"{",
"if",
"(",
"this",
".",
"state",
".",
"hasNotRestarted",
"(",
")",
")",
"{",
"resubmissionAttempts",
"=",
"driverRuntimeRestartManager",
".",
"getResubmissionAttempts",
"(",
")",
";",
"if",
"("... | Triggers the state machine if the application is a restart instance. Returns true
@return true if the application is a restart instance.
Can be already done with restart or in the process of restart. | [
"Triggers",
"the",
"state",
"machine",
"if",
"the",
"application",
"is",
"a",
"restart",
"instance",
".",
"Returns",
"true"
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/driver/restart/DriverRestartManager.java#L86-L97 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/driver/restart/DriverRestartManager.java | DriverRestartManager.onRestart | public synchronized void onRestart(final StartTime startTime,
final List<EventHandler<DriverRestarted>> orderedHandlers) {
if (this.state == DriverRestartState.BEGAN) {
restartEvaluators = driverRuntimeRestartManager.getPreviousEvaluators();
final DriverRestarted res... | java | public synchronized void onRestart(final StartTime startTime,
final List<EventHandler<DriverRestarted>> orderedHandlers) {
if (this.state == DriverRestartState.BEGAN) {
restartEvaluators = driverRuntimeRestartManager.getPreviousEvaluators();
final DriverRestarted res... | [
"public",
"synchronized",
"void",
"onRestart",
"(",
"final",
"StartTime",
"startTime",
",",
"final",
"List",
"<",
"EventHandler",
"<",
"DriverRestarted",
">",
">",
"orderedHandlers",
")",
"{",
"if",
"(",
"this",
".",
"state",
"==",
"DriverRestartState",
".",
"... | Recovers the list of alive and failed evaluators and inform the driver restart handlers and inform the
evaluator failure handlers based on the specific runtime. Also sets the expected amount of evaluators to report
back as alive to the job driver. | [
"Recovers",
"the",
"list",
"of",
"alive",
"and",
"failed",
"evaluators",
"and",
"inform",
"the",
"driver",
"restart",
"handlers",
"and",
"inform",
"the",
"evaluator",
"failure",
"handlers",
"based",
"on",
"the",
"specific",
"runtime",
".",
"Also",
"sets",
"the... | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/driver/restart/DriverRestartManager.java#L111-L140 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/driver/restart/DriverRestartManager.java | DriverRestartManager.onRecoverEvaluator | public synchronized boolean onRecoverEvaluator(final String evaluatorId) {
if (getStateOfPreviousEvaluator(evaluatorId).isFailedOrNotExpected()) {
final String errMsg = "Evaluator with evaluator ID " + evaluatorId + " not expected to be alive.";
LOG.log(Level.SEVERE, errMsg);
throw new DriverFatal... | java | public synchronized boolean onRecoverEvaluator(final String evaluatorId) {
if (getStateOfPreviousEvaluator(evaluatorId).isFailedOrNotExpected()) {
final String errMsg = "Evaluator with evaluator ID " + evaluatorId + " not expected to be alive.";
LOG.log(Level.SEVERE, errMsg);
throw new DriverFatal... | [
"public",
"synchronized",
"boolean",
"onRecoverEvaluator",
"(",
"final",
"String",
"evaluatorId",
")",
"{",
"if",
"(",
"getStateOfPreviousEvaluator",
"(",
"evaluatorId",
")",
".",
"isFailedOrNotExpected",
"(",
")",
")",
"{",
"final",
"String",
"errMsg",
"=",
"\"Ev... | Indicate that this Driver has re-established the connection with one more Evaluator of a previous run.
@return true if the evaluator has been newly recovered. | [
"Indicate",
"that",
"this",
"Driver",
"has",
"re",
"-",
"established",
"the",
"connection",
"with",
"one",
"more",
"Evaluator",
"of",
"a",
"previous",
"run",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/driver/restart/DriverRestartManager.java#L171-L192 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/driver/restart/DriverRestartManager.java | DriverRestartManager.onDriverRestartCompleted | private synchronized void onDriverRestartCompleted(final boolean isTimedOut) {
if (this.state != DriverRestartState.COMPLETED) {
final Set<String> outstandingEvaluatorIds = getOutstandingEvaluatorsAndMarkExpired();
driverRuntimeRestartManager.informAboutEvaluatorFailures(outstandingEvaluatorIds);
... | java | private synchronized void onDriverRestartCompleted(final boolean isTimedOut) {
if (this.state != DriverRestartState.COMPLETED) {
final Set<String> outstandingEvaluatorIds = getOutstandingEvaluatorsAndMarkExpired();
driverRuntimeRestartManager.informAboutEvaluatorFailures(outstandingEvaluatorIds);
... | [
"private",
"synchronized",
"void",
"onDriverRestartCompleted",
"(",
"final",
"boolean",
"isTimedOut",
")",
"{",
"if",
"(",
"this",
".",
"state",
"!=",
"DriverRestartState",
".",
"COMPLETED",
")",
"{",
"final",
"Set",
"<",
"String",
">",
"outstandingEvaluatorIds",
... | Sets the driver restart status to be completed if not yet set and notifies the restart completed event handlers. | [
"Sets",
"the",
"driver",
"restart",
"status",
"to",
"be",
"completed",
"if",
"not",
"yet",
"set",
"and",
"notifies",
"the",
"restart",
"completed",
"event",
"handlers",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/driver/restart/DriverRestartManager.java#L279-L301 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/driver/restart/DriverRestartManager.java | DriverRestartManager.getOutstandingEvaluatorsAndMarkExpired | private Set<String> getOutstandingEvaluatorsAndMarkExpired() {
final Set<String> outstanding = new HashSet<>();
for (final String previousEvaluatorId : restartEvaluators.getEvaluatorIds()) {
if (getStateOfPreviousEvaluator(previousEvaluatorId) == EvaluatorRestartState.EXPECTED) {
outstanding.add(p... | java | private Set<String> getOutstandingEvaluatorsAndMarkExpired() {
final Set<String> outstanding = new HashSet<>();
for (final String previousEvaluatorId : restartEvaluators.getEvaluatorIds()) {
if (getStateOfPreviousEvaluator(previousEvaluatorId) == EvaluatorRestartState.EXPECTED) {
outstanding.add(p... | [
"private",
"Set",
"<",
"String",
">",
"getOutstandingEvaluatorsAndMarkExpired",
"(",
")",
"{",
"final",
"Set",
"<",
"String",
">",
"outstanding",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"String",
"previousEvaluatorId",
":",
"restartEva... | Gets the outstanding evaluators that have not yet reported back and mark them as expired. | [
"Gets",
"the",
"outstanding",
"evaluators",
"that",
"have",
"not",
"yet",
"reported",
"back",
"and",
"mark",
"them",
"as",
"expired",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/driver/restart/DriverRestartManager.java#L306-L316 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/implementation/avro/AvroClassHierarchy.java | AvroClassHierarchy.parseConstructorDef | private ConstructorDef<?> parseConstructorDef(final AvroConstructorDef def, final boolean isInjectable) {
final List<ConstructorArg> args = new ArrayList<>();
for (final AvroConstructorArg arg : def.getConstructorArgs()) {
args.add(new ConstructorArgImpl(getString(arg.getFullArgClassName()), getString(arg... | java | private ConstructorDef<?> parseConstructorDef(final AvroConstructorDef def, final boolean isInjectable) {
final List<ConstructorArg> args = new ArrayList<>();
for (final AvroConstructorArg arg : def.getConstructorArgs()) {
args.add(new ConstructorArgImpl(getString(arg.getFullArgClassName()), getString(arg... | [
"private",
"ConstructorDef",
"<",
"?",
">",
"parseConstructorDef",
"(",
"final",
"AvroConstructorDef",
"def",
",",
"final",
"boolean",
"isInjectable",
")",
"{",
"final",
"List",
"<",
"ConstructorArg",
">",
"args",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
... | Parse the constructor definition. | [
"Parse",
"the",
"constructor",
"definition",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/implementation/avro/AvroClassHierarchy.java#L69-L78 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/implementation/avro/AvroClassHierarchy.java | AvroClassHierarchy.parseSubHierarchy | private void parseSubHierarchy(final Node parent, final AvroNode n) {
final Node parsed;
if (n.getPackageNode() != null) {
parsed = new PackageNodeImpl(parent, getString(n.getName()), getString(n.getFullName()));
} else if (n.getNamedParameterNode() != null) {
final AvroNamedParameterNode np = n... | java | private void parseSubHierarchy(final Node parent, final AvroNode n) {
final Node parsed;
if (n.getPackageNode() != null) {
parsed = new PackageNodeImpl(parent, getString(n.getName()), getString(n.getFullName()));
} else if (n.getNamedParameterNode() != null) {
final AvroNamedParameterNode np = n... | [
"private",
"void",
"parseSubHierarchy",
"(",
"final",
"Node",
"parent",
",",
"final",
"AvroNode",
"n",
")",
"{",
"final",
"Node",
"parsed",
";",
"if",
"(",
"n",
".",
"getPackageNode",
"(",
")",
"!=",
"null",
")",
"{",
"parsed",
"=",
"new",
"PackageNodeIm... | Register the classes recursively. | [
"Register",
"the",
"classes",
"recursively",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/implementation/avro/AvroClassHierarchy.java#L83-L120 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/implementation/avro/AvroClassHierarchy.java | AvroClassHierarchy.wireUpInheritanceRelationships | @SuppressWarnings({"rawtypes", "unchecked"})
private void wireUpInheritanceRelationships(final AvroNode n) {
if (n.getClassNode() != null) {
final AvroClassNode cn = n.getClassNode();
final ClassNode iface;
try {
iface = (ClassNode) getNode(getString(n.getFullName()));
} catch (fin... | java | @SuppressWarnings({"rawtypes", "unchecked"})
private void wireUpInheritanceRelationships(final AvroNode n) {
if (n.getClassNode() != null) {
final AvroClassNode cn = n.getClassNode();
final ClassNode iface;
try {
iface = (ClassNode) getNode(getString(n.getFullName()));
} catch (fin... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"private",
"void",
"wireUpInheritanceRelationships",
"(",
"final",
"AvroNode",
"n",
")",
"{",
"if",
"(",
"n",
".",
"getClassNode",
"(",
")",
"!=",
"null",
")",
"{",
"final",
... | Register the implementation for the ClassNode recursively. | [
"Register",
"the",
"implementation",
"for",
"the",
"ClassNode",
"recursively",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/implementation/avro/AvroClassHierarchy.java#L125-L165 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/implementation/avro/AvroClassHierarchy.java | AvroClassHierarchy.getStringArray | private String[] getStringArray(final List<CharSequence> charSeqList) {
final int length = charSeqList.size();
final String[] stringArray = new String[length];
for (int i = 0; i < length; i++) {
stringArray[i] = getString(charSeqList.get(i));
}
return stringArray;
} | java | private String[] getStringArray(final List<CharSequence> charSeqList) {
final int length = charSeqList.size();
final String[] stringArray = new String[length];
for (int i = 0; i < length; i++) {
stringArray[i] = getString(charSeqList.get(i));
}
return stringArray;
} | [
"private",
"String",
"[",
"]",
"getStringArray",
"(",
"final",
"List",
"<",
"CharSequence",
">",
"charSeqList",
")",
"{",
"final",
"int",
"length",
"=",
"charSeqList",
".",
"size",
"(",
")",
";",
"final",
"String",
"[",
"]",
"stringArray",
"=",
"new",
"S... | Convert the CharSequence list into the String array. | [
"Convert",
"the",
"CharSequence",
"list",
"into",
"the",
"String",
"array",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/implementation/avro/AvroClassHierarchy.java#L181-L188 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/util/logging/LoggingScopeFactory.java | LoggingScopeFactory.getNewLoggingScope | public static LoggingScope getNewLoggingScope(final Level logLevel, final String msg) {
return new LoggingScopeImpl(LOG, logLevel, msg);
} | java | public static LoggingScope getNewLoggingScope(final Level logLevel, final String msg) {
return new LoggingScopeImpl(LOG, logLevel, msg);
} | [
"public",
"static",
"LoggingScope",
"getNewLoggingScope",
"(",
"final",
"Level",
"logLevel",
",",
"final",
"String",
"msg",
")",
"{",
"return",
"new",
"LoggingScopeImpl",
"(",
"LOG",
",",
"logLevel",
",",
"msg",
")",
";",
"}"
] | Get a new instance of LoggingScope with specified log level.
@param logLevel
@param msg
@return | [
"Get",
"a",
"new",
"instance",
"of",
"LoggingScope",
"with",
"specified",
"log",
"level",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/util/logging/LoggingScopeFactory.java#L82-L84 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/util/logging/LoggingScopeFactory.java | LoggingScopeFactory.getNewLoggingScope | public LoggingScope getNewLoggingScope(final String msg, final Object[] params) {
return new LoggingScopeImpl(LOG, logLevel, msg, params);
} | java | public LoggingScope getNewLoggingScope(final String msg, final Object[] params) {
return new LoggingScopeImpl(LOG, logLevel, msg, params);
} | [
"public",
"LoggingScope",
"getNewLoggingScope",
"(",
"final",
"String",
"msg",
",",
"final",
"Object",
"[",
"]",
"params",
")",
"{",
"return",
"new",
"LoggingScopeImpl",
"(",
"LOG",
",",
"logLevel",
",",
"msg",
",",
"params",
")",
";",
"}"
] | Get a new instance of LoggingScope with msg and params through new.
@param msg
@param params
@return | [
"Get",
"a",
"new",
"instance",
"of",
"LoggingScope",
"with",
"msg",
"and",
"params",
"through",
"new",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/util/logging/LoggingScopeFactory.java#L101-L103 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/avro/ProtocolSerializer.java | ProtocolSerializer.write | public byte[] write(final SpecificRecord message, final long sequence) {
final String classId = getClassId(message.getClass());
try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
LOG.log(Level.FINEST, "Serializing message: {0}", classId);
final IMessageSerializer seria... | java | public byte[] write(final SpecificRecord message, final long sequence) {
final String classId = getClassId(message.getClass());
try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
LOG.log(Level.FINEST, "Serializing message: {0}", classId);
final IMessageSerializer seria... | [
"public",
"byte",
"[",
"]",
"write",
"(",
"final",
"SpecificRecord",
"message",
",",
"final",
"long",
"sequence",
")",
"{",
"final",
"String",
"classId",
"=",
"getClassId",
"(",
"message",
".",
"getClass",
"(",
")",
")",
";",
"try",
"(",
"final",
"ByteAr... | Marshall the input message to a byte array.
@param message The message to be marshaled into a byte array.
@param sequence The unique sequence number of the message. | [
"Marshall",
"the",
"input",
"message",
"to",
"a",
"byte",
"array",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/avro/ProtocolSerializer.java#L111-L128 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/avro/ProtocolSerializer.java | ProtocolSerializer.read | public void read(final byte[] messageBytes, final MultiObserver observer) {
try (final InputStream inputStream = new ByteArrayInputStream(messageBytes)) {
// Binary decoder for both the header and the message.
final BinaryDecoder decoder = DecoderFactory.get().binaryDecoder(inputStream, null);
... | java | public void read(final byte[] messageBytes, final MultiObserver observer) {
try (final InputStream inputStream = new ByteArrayInputStream(messageBytes)) {
// Binary decoder for both the header and the message.
final BinaryDecoder decoder = DecoderFactory.get().binaryDecoder(inputStream, null);
... | [
"public",
"void",
"read",
"(",
"final",
"byte",
"[",
"]",
"messageBytes",
",",
"final",
"MultiObserver",
"observer",
")",
"{",
"try",
"(",
"final",
"InputStream",
"inputStream",
"=",
"new",
"ByteArrayInputStream",
"(",
"messageBytes",
")",
")",
"{",
"// Binary... | Read a message from the input byte stream and send it to the event handler.
@param messageBytes An array of bytes that contains the message to be deserialized.
@param observer An implementation of the MultiObserver interface which will be called
to process the deserialized message. | [
"Read",
"a",
"message",
"from",
"the",
"input",
"byte",
"stream",
"and",
"send",
"it",
"to",
"the",
"event",
"handler",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/avro/ProtocolSerializer.java#L136-L161 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/data/output/OutputServiceREEF.java | OutputServiceREEF.getAbsolutePath | private static String getAbsolutePath(final String relativePath) {
final File outputFile = new File(relativePath);
return outputFile.getAbsolutePath();
} | java | private static String getAbsolutePath(final String relativePath) {
final File outputFile = new File(relativePath);
return outputFile.getAbsolutePath();
} | [
"private",
"static",
"String",
"getAbsolutePath",
"(",
"final",
"String",
"relativePath",
")",
"{",
"final",
"File",
"outputFile",
"=",
"new",
"File",
"(",
"relativePath",
")",
";",
"return",
"outputFile",
".",
"getAbsolutePath",
"(",
")",
";",
"}"
] | transform the given relative path into the absolute path based on the current directory where a user runs the demo.
@param relativePath relative path
@return absolute path | [
"transform",
"the",
"given",
"relative",
"path",
"into",
"the",
"absolute",
"path",
"based",
"on",
"the",
"current",
"directory",
"where",
"a",
"user",
"runs",
"the",
"demo",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/data/output/OutputServiceREEF.java#L137-L140 | train |
apache/reef | lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/MultiRuntimeYarnBootstrapDriverConfigGenerator.java | MultiRuntimeYarnBootstrapDriverConfigGenerator.addYarnRuntimeDefinition | private void addYarnRuntimeDefinition(
final AvroYarnJobSubmissionParameters yarnJobSubmissionParams,
final AvroJobSubmissionParameters jobSubmissionParameters,
final MultiRuntimeDefinitionBuilder builder) {
// create and serialize yarn configuration if defined
final Configuration ... | java | private void addYarnRuntimeDefinition(
final AvroYarnJobSubmissionParameters yarnJobSubmissionParams,
final AvroJobSubmissionParameters jobSubmissionParameters,
final MultiRuntimeDefinitionBuilder builder) {
// create and serialize yarn configuration if defined
final Configuration ... | [
"private",
"void",
"addYarnRuntimeDefinition",
"(",
"final",
"AvroYarnJobSubmissionParameters",
"yarnJobSubmissionParams",
",",
"final",
"AvroJobSubmissionParameters",
"jobSubmissionParameters",
",",
"final",
"MultiRuntimeDefinitionBuilder",
"builder",
")",
"{",
"// create and seri... | Adds yarn runtime definitions to the builder.
@param yarnJobSubmissionParams Yarn job submission parameters
@param jobSubmissionParameters Generic job submission parameters
@param builder The multi runtime builder | [
"Adds",
"yarn",
"runtime",
"definitions",
"to",
"the",
"builder",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/MultiRuntimeYarnBootstrapDriverConfigGenerator.java#L88-L98 | train |
apache/reef | lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/MultiRuntimeYarnBootstrapDriverConfigGenerator.java | MultiRuntimeYarnBootstrapDriverConfigGenerator.addDummyYarnRuntimeDefinition | private void addDummyYarnRuntimeDefinition(
final AvroYarnJobSubmissionParameters yarnJobSubmissionParams,
final AvroJobSubmissionParameters jobSubmissionParameters,
final MultiRuntimeDefinitionBuilder builder) {
// create and serialize yarn configuration if defined
final Configura... | java | private void addDummyYarnRuntimeDefinition(
final AvroYarnJobSubmissionParameters yarnJobSubmissionParams,
final AvroJobSubmissionParameters jobSubmissionParameters,
final MultiRuntimeDefinitionBuilder builder) {
// create and serialize yarn configuration if defined
final Configura... | [
"private",
"void",
"addDummyYarnRuntimeDefinition",
"(",
"final",
"AvroYarnJobSubmissionParameters",
"yarnJobSubmissionParams",
",",
"final",
"AvroJobSubmissionParameters",
"jobSubmissionParameters",
",",
"final",
"MultiRuntimeDefinitionBuilder",
"builder",
")",
"{",
"// create and... | Adds yarn runtime definitions to the builder, with a dummy name.
This is needed to initialze yarn runtme that registers with RM but does not allows submitting evaluators
as evaluator submissions submits to Yarn runtime.
@param yarnJobSubmissionParams Yarn job submission parameters
@param jobSubmissionParameters Generic... | [
"Adds",
"yarn",
"runtime",
"definitions",
"to",
"the",
"builder",
"with",
"a",
"dummy",
"name",
".",
"This",
"is",
"needed",
"to",
"initialze",
"yarn",
"runtme",
"that",
"registers",
"with",
"RM",
"but",
"does",
"not",
"allows",
"submitting",
"evaluators",
"... | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/MultiRuntimeYarnBootstrapDriverConfigGenerator.java#L123-L132 | train |
apache/reef | lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/MultiRuntimeYarnBootstrapDriverConfigGenerator.java | MultiRuntimeYarnBootstrapDriverConfigGenerator.addLocalRuntimeDefinition | private void addLocalRuntimeDefinition(
final AvroLocalAppSubmissionParameters localAppSubmissionParams,
final AvroJobSubmissionParameters jobSubmissionParameters,
final MultiRuntimeDefinitionBuilder builder) {
// create and serialize local configuration if defined
final Configurat... | java | private void addLocalRuntimeDefinition(
final AvroLocalAppSubmissionParameters localAppSubmissionParams,
final AvroJobSubmissionParameters jobSubmissionParameters,
final MultiRuntimeDefinitionBuilder builder) {
// create and serialize local configuration if defined
final Configurat... | [
"private",
"void",
"addLocalRuntimeDefinition",
"(",
"final",
"AvroLocalAppSubmissionParameters",
"localAppSubmissionParams",
",",
"final",
"AvroJobSubmissionParameters",
"jobSubmissionParameters",
",",
"final",
"MultiRuntimeDefinitionBuilder",
"builder",
")",
"{",
"// create and s... | Adds local runtime definitions to the builder.
@param localAppSubmissionParams Local app submission parameters
@param jobSubmissionParameters Generic job submission parameters
@param builder The multi runtime builder | [
"Adds",
"local",
"runtime",
"definitions",
"to",
"the",
"builder",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/MultiRuntimeYarnBootstrapDriverConfigGenerator.java#L139-L159 | train |
apache/reef | lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/MultiRuntimeYarnBootstrapDriverConfigGenerator.java | MultiRuntimeYarnBootstrapDriverConfigGenerator.writeDriverConfigurationFile | String writeDriverConfigurationFile(final String bootstrapJobArgsLocation,
final String bootstrapAppArgsLocation) throws IOException {
final File bootstrapJobArgsFile = new File(bootstrapJobArgsLocation).getCanonicalFile();
final File bootstrapAppArgsFile = new File(... | java | String writeDriverConfigurationFile(final String bootstrapJobArgsLocation,
final String bootstrapAppArgsLocation) throws IOException {
final File bootstrapJobArgsFile = new File(bootstrapJobArgsLocation).getCanonicalFile();
final File bootstrapAppArgsFile = new File(... | [
"String",
"writeDriverConfigurationFile",
"(",
"final",
"String",
"bootstrapJobArgsLocation",
",",
"final",
"String",
"bootstrapAppArgsLocation",
")",
"throws",
"IOException",
"{",
"final",
"File",
"bootstrapJobArgsFile",
"=",
"new",
"File",
"(",
"bootstrapJobArgsLocation",... | Writes the driver configuration files to the provided location.
@param bootstrapJobArgsLocation The path for the job args file
@param bootstrapAppArgsLocation The path for the app args file
@throws IOException
@return A path to the written driver configuration | [
"Writes",
"the",
"driver",
"configuration",
"files",
"to",
"the",
"provided",
"location",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/MultiRuntimeYarnBootstrapDriverConfigGenerator.java#L267-L286 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/formats/CommandLine.java | CommandLine.processCommandLine | @SafeVarargs
public final <T> CommandLine processCommandLine(
final String[] args, final Class<? extends Name<?>>... argClasses)
throws IOException, BindException {
for (final Class<? extends Name<?>> c : argClasses) {
registerShortNameOfClass(c);
}
final Options o = getCommandLineOpti... | java | @SafeVarargs
public final <T> CommandLine processCommandLine(
final String[] args, final Class<? extends Name<?>>... argClasses)
throws IOException, BindException {
for (final Class<? extends Name<?>> c : argClasses) {
registerShortNameOfClass(c);
}
final Options o = getCommandLineOpti... | [
"@",
"SafeVarargs",
"public",
"final",
"<",
"T",
">",
"CommandLine",
"processCommandLine",
"(",
"final",
"String",
"[",
"]",
"args",
",",
"final",
"Class",
"<",
"?",
"extends",
"Name",
"<",
"?",
">",
">",
"...",
"argClasses",
")",
"throws",
"IOException",
... | Process command line arguments.
@param <T> a type
@param args the command line arguments to be parsed
@param argClasses the target named classes to be set
@return Selfie if the command line parsing succeeded, null (or exception) otherwise.
@throws IOException if parsing fails
@throws BindException if a binding of shor... | [
"Process",
"command",
"line",
"arguments",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/formats/CommandLine.java#L127-L169 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/formats/CommandLine.java | CommandLine.parseToConfigurationBuilder | @SuppressWarnings("checkstyle:avoidhidingcauseexception")
public static ConfigurationBuilder parseToConfigurationBuilder(final String[] args,
final Class<? extends Name<?>>... argClasses)
throws ParseException {
final CommandLine commandLine;
... | java | @SuppressWarnings("checkstyle:avoidhidingcauseexception")
public static ConfigurationBuilder parseToConfigurationBuilder(final String[] args,
final Class<? extends Name<?>>... argClasses)
throws ParseException {
final CommandLine commandLine;
... | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:avoidhidingcauseexception\"",
")",
"public",
"static",
"ConfigurationBuilder",
"parseToConfigurationBuilder",
"(",
"final",
"String",
"[",
"]",
"args",
",",
"final",
"Class",
"<",
"?",
"extends",
"Name",
"<",
"?",
">",
">"... | ParseException constructor does not accept a cause Exception, hence | [
"ParseException",
"constructor",
"does",
"not",
"accept",
"a",
"cause",
"Exception",
"hence"
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/formats/CommandLine.java#L201-L220 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/utils/ScatterHelper.java | ScatterHelper.getUniformCounts | public static List<Integer> getUniformCounts(final int elementCount, final int taskCount) {
final int quotient = elementCount / taskCount;
final int remainder = elementCount % taskCount;
final List<Integer> retList = new ArrayList<>();
for (int taskIndex = 0; taskIndex < taskCount; taskIndex++) {
... | java | public static List<Integer> getUniformCounts(final int elementCount, final int taskCount) {
final int quotient = elementCount / taskCount;
final int remainder = elementCount % taskCount;
final List<Integer> retList = new ArrayList<>();
for (int taskIndex = 0; taskIndex < taskCount; taskIndex++) {
... | [
"public",
"static",
"List",
"<",
"Integer",
">",
"getUniformCounts",
"(",
"final",
"int",
"elementCount",
",",
"final",
"int",
"taskCount",
")",
"{",
"final",
"int",
"quotient",
"=",
"elementCount",
"/",
"taskCount",
";",
"final",
"int",
"remainder",
"=",
"e... | Uniformly distribute a number of elements across a number of Tasks and return a list of counts.
If uniform distribution is impossible, then some Tasks will receive one
more element than others. The sequence of the number of elements for each
Task is non-increasing.
@param elementCount number of elements to distribute
... | [
"Uniformly",
"distribute",
"a",
"number",
"of",
"elements",
"across",
"a",
"number",
"of",
"Tasks",
"and",
"return",
"a",
"list",
"of",
"counts",
".",
"If",
"uniform",
"distribution",
"is",
"impossible",
"then",
"some",
"Tasks",
"will",
"receive",
"one",
"mo... | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/utils/ScatterHelper.java#L45-L58 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java | VortexAggregateFuture.completed | @Private
@Override
public void completed(final int taskletId, final TOutput result) {
try {
completedTasklets(result, Collections.singletonList(taskletId));
} catch (final InterruptedException e) {
throw new RuntimeException(e);
}
} | java | @Private
@Override
public void completed(final int taskletId, final TOutput result) {
try {
completedTasklets(result, Collections.singletonList(taskletId));
} catch (final InterruptedException e) {
throw new RuntimeException(e);
}
} | [
"@",
"Private",
"@",
"Override",
"public",
"void",
"completed",
"(",
"final",
"int",
"taskletId",
",",
"final",
"TOutput",
"result",
")",
"{",
"try",
"{",
"completedTasklets",
"(",
"result",
",",
"Collections",
".",
"singletonList",
"(",
"taskletId",
")",
")... | A Tasklet associated with the aggregation has completed. | [
"A",
"Tasklet",
"associated",
"with",
"the",
"aggregation",
"has",
"completed",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java#L112-L120 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java | VortexAggregateFuture.aggregationCompleted | @Private
@Override
public void aggregationCompleted(final List<Integer> taskletIds, final TOutput result) {
try {
completedTasklets(result, taskletIds);
} catch (final InterruptedException e) {
throw new RuntimeException(e);
}
} | java | @Private
@Override
public void aggregationCompleted(final List<Integer> taskletIds, final TOutput result) {
try {
completedTasklets(result, taskletIds);
} catch (final InterruptedException e) {
throw new RuntimeException(e);
}
} | [
"@",
"Private",
"@",
"Override",
"public",
"void",
"aggregationCompleted",
"(",
"final",
"List",
"<",
"Integer",
">",
"taskletIds",
",",
"final",
"TOutput",
"result",
")",
"{",
"try",
"{",
"completedTasklets",
"(",
"result",
",",
"taskletIds",
")",
";",
"}",... | Aggregation has completed for a list of Tasklets, with an aggregated result. | [
"Aggregation",
"has",
"completed",
"for",
"a",
"list",
"of",
"Tasklets",
"with",
"an",
"aggregated",
"result",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java#L125-L133 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java | VortexAggregateFuture.threwException | @Private
@Override
public void threwException(final int taskletId, final Exception exception) {
try {
failedTasklets(exception, Collections.singletonList(taskletId));
} catch (final InterruptedException e) {
throw new RuntimeException(e);
}
} | java | @Private
@Override
public void threwException(final int taskletId, final Exception exception) {
try {
failedTasklets(exception, Collections.singletonList(taskletId));
} catch (final InterruptedException e) {
throw new RuntimeException(e);
}
} | [
"@",
"Private",
"@",
"Override",
"public",
"void",
"threwException",
"(",
"final",
"int",
"taskletId",
",",
"final",
"Exception",
"exception",
")",
"{",
"try",
"{",
"failedTasklets",
"(",
"exception",
",",
"Collections",
".",
"singletonList",
"(",
"taskletId",
... | A Tasklet associated with the aggregation has failed. | [
"A",
"Tasklet",
"associated",
"with",
"the",
"aggregation",
"has",
"failed",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java#L138-L146 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java | VortexAggregateFuture.aggregationThrewException | @Private
@Override
public void aggregationThrewException(final List<Integer> taskletIds, final Exception exception) {
try {
failedTasklets(exception, taskletIds);
} catch (final InterruptedException e) {
throw new RuntimeException(e);
}
} | java | @Private
@Override
public void aggregationThrewException(final List<Integer> taskletIds, final Exception exception) {
try {
failedTasklets(exception, taskletIds);
} catch (final InterruptedException e) {
throw new RuntimeException(e);
}
} | [
"@",
"Private",
"@",
"Override",
"public",
"void",
"aggregationThrewException",
"(",
"final",
"List",
"<",
"Integer",
">",
"taskletIds",
",",
"final",
"Exception",
"exception",
")",
"{",
"try",
"{",
"failedTasklets",
"(",
"exception",
",",
"taskletIds",
")",
"... | A list of Tasklets has failed during aggregation phase. | [
"A",
"list",
"of",
"Tasklets",
"has",
"failed",
"during",
"aggregation",
"phase",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java#L151-L159 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java | VortexAggregateFuture.completedTasklets | private void completedTasklets(final TOutput output, final List<Integer> taskletIds)
throws InterruptedException {
final List<TInput> inputs = getInputs(taskletIds);
final AggregateResult result = new AggregateResult(output, inputs);
if (callbackHandler != null) {
executor.execute(new Runnable(... | java | private void completedTasklets(final TOutput output, final List<Integer> taskletIds)
throws InterruptedException {
final List<TInput> inputs = getInputs(taskletIds);
final AggregateResult result = new AggregateResult(output, inputs);
if (callbackHandler != null) {
executor.execute(new Runnable(... | [
"private",
"void",
"completedTasklets",
"(",
"final",
"TOutput",
"output",
",",
"final",
"List",
"<",
"Integer",
">",
"taskletIds",
")",
"throws",
"InterruptedException",
"{",
"final",
"List",
"<",
"TInput",
">",
"inputs",
"=",
"getInputs",
"(",
"taskletIds",
... | Create and queue result for Tasklets that are expected and invoke callback. | [
"Create",
"and",
"queue",
"result",
"for",
"Tasklets",
"that",
"are",
"expected",
"and",
"invoke",
"callback",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java#L173-L188 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java | VortexAggregateFuture.failedTasklets | private void failedTasklets(final Exception exception, final List<Integer> taskletIds)
throws InterruptedException {
final List<TInput> inputs = getInputs(taskletIds);
final AggregateResult failure = new AggregateResult(exception, inputs);
if (callbackHandler != null) {
executor.execute(new Ru... | java | private void failedTasklets(final Exception exception, final List<Integer> taskletIds)
throws InterruptedException {
final List<TInput> inputs = getInputs(taskletIds);
final AggregateResult failure = new AggregateResult(exception, inputs);
if (callbackHandler != null) {
executor.execute(new Ru... | [
"private",
"void",
"failedTasklets",
"(",
"final",
"Exception",
"exception",
",",
"final",
"List",
"<",
"Integer",
">",
"taskletIds",
")",
"throws",
"InterruptedException",
"{",
"final",
"List",
"<",
"TInput",
">",
"inputs",
"=",
"getInputs",
"(",
"taskletIds",
... | Create and queue result for failed Tasklets that are expected and invokes callback. | [
"Create",
"and",
"queue",
"result",
"for",
"failed",
"Tasklets",
"that",
"are",
"expected",
"and",
"invokes",
"callback",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java#L193-L209 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java | VortexAggregateFuture.getInputs | private List<TInput> getInputs(final List<Integer> taskletIds) {
final List<TInput> inputList = new ArrayList<>(taskletIds.size());
for(final int taskletId : taskletIds) {
inputList.add(taskletIdInputMap.get(taskletId));
}
return inputList;
} | java | private List<TInput> getInputs(final List<Integer> taskletIds) {
final List<TInput> inputList = new ArrayList<>(taskletIds.size());
for(final int taskletId : taskletIds) {
inputList.add(taskletIdInputMap.get(taskletId));
}
return inputList;
} | [
"private",
"List",
"<",
"TInput",
">",
"getInputs",
"(",
"final",
"List",
"<",
"Integer",
">",
"taskletIds",
")",
"{",
"final",
"List",
"<",
"TInput",
">",
"inputList",
"=",
"new",
"ArrayList",
"<>",
"(",
"taskletIds",
".",
"size",
"(",
")",
")",
";",
... | Gets the inputs on Tasklet aggregation completion. | [
"Gets",
"the",
"inputs",
"on",
"Tasklet",
"aggregation",
"completion",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java#L214-L223 | train |
apache/reef | lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/driver/AzureBatchResourceLaunchHandler.java | AzureBatchResourceLaunchHandler.onNext | @Override
public void onNext(final ResourceLaunchEvent resourceLaunchEvent) {
LOG.log(Level.FINEST, "Got ResourceLaunchEvent in AzureBatchResourceLaunchHandler");
this.azureBatchResourceManager.onResourceLaunched(resourceLaunchEvent);
} | java | @Override
public void onNext(final ResourceLaunchEvent resourceLaunchEvent) {
LOG.log(Level.FINEST, "Got ResourceLaunchEvent in AzureBatchResourceLaunchHandler");
this.azureBatchResourceManager.onResourceLaunched(resourceLaunchEvent);
} | [
"@",
"Override",
"public",
"void",
"onNext",
"(",
"final",
"ResourceLaunchEvent",
"resourceLaunchEvent",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Got ResourceLaunchEvent in AzureBatchResourceLaunchHandler\"",
")",
";",
"this",
".",
"azureBatch... | This method is called when a new resource is requested.
@param resourceLaunchEvent resource launch event. | [
"This",
"method",
"is",
"called",
"when",
"a",
"new",
"resource",
"is",
"requested",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/driver/AzureBatchResourceLaunchHandler.java#L50-L54 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java | EvaluatorManager.fireEvaluatorAllocatedEvent | public synchronized void fireEvaluatorAllocatedEvent() {
if (this.stateManager.isAllocated() && this.allocationNotFired) {
final AllocatedEvaluator allocatedEvaluator =
new AllocatedEvaluatorImpl(this,
this.remoteManager.getMyIdentifier(),
this.configurationSerializer,
... | java | public synchronized void fireEvaluatorAllocatedEvent() {
if (this.stateManager.isAllocated() && this.allocationNotFired) {
final AllocatedEvaluator allocatedEvaluator =
new AllocatedEvaluatorImpl(this,
this.remoteManager.getMyIdentifier(),
this.configurationSerializer,
... | [
"public",
"synchronized",
"void",
"fireEvaluatorAllocatedEvent",
"(",
")",
"{",
"if",
"(",
"this",
".",
"stateManager",
".",
"isAllocated",
"(",
")",
"&&",
"this",
".",
"allocationNotFired",
")",
"{",
"final",
"AllocatedEvaluator",
"allocatedEvaluator",
"=",
"new"... | Fires the EvaluatorAllocatedEvent to the handlers. Can only be done once. | [
"Fires",
"the",
"EvaluatorAllocatedEvent",
"to",
"the",
"handlers",
".",
"Can",
"only",
"be",
"done",
"once",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java#L187-L207 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java | EvaluatorManager.onEvaluatorException | public void onEvaluatorException(final EvaluatorException exception) {
synchronized (this.evaluatorDescriptor) {
if (this.stateManager.isCompleted()) {
LOG.log(Level.FINE,
"Ignoring an exception received for Evaluator {0} which is already in state {1}.",
new Object[] {this.get... | java | public void onEvaluatorException(final EvaluatorException exception) {
synchronized (this.evaluatorDescriptor) {
if (this.stateManager.isCompleted()) {
LOG.log(Level.FINE,
"Ignoring an exception received for Evaluator {0} which is already in state {1}.",
new Object[] {this.get... | [
"public",
"void",
"onEvaluatorException",
"(",
"final",
"EvaluatorException",
"exception",
")",
"{",
"synchronized",
"(",
"this",
".",
"evaluatorDescriptor",
")",
"{",
"if",
"(",
"this",
".",
"stateManager",
".",
"isCompleted",
"(",
")",
")",
"{",
"LOG",
".",
... | EvaluatorException will trigger is FailedEvaluator and state transition to FAILED.
@param exception on the EvaluatorRuntime | [
"EvaluatorException",
"will",
"trigger",
"is",
"FailedEvaluator",
"and",
"state",
"transition",
"to",
"FAILED",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java#L334-L383 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java | EvaluatorManager.onEvaluatorHeartbeatMessage | public void onEvaluatorHeartbeatMessage(
final RemoteMessage<EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto> evaluatorHeartbeatProtoRemoteMessage) {
final EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto evaluatorHeartbeatProto =
evaluatorHeartbeatProtoRemoteMessage.getMessage();
LOG.log(Level... | java | public void onEvaluatorHeartbeatMessage(
final RemoteMessage<EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto> evaluatorHeartbeatProtoRemoteMessage) {
final EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto evaluatorHeartbeatProto =
evaluatorHeartbeatProtoRemoteMessage.getMessage();
LOG.log(Level... | [
"public",
"void",
"onEvaluatorHeartbeatMessage",
"(",
"final",
"RemoteMessage",
"<",
"EvaluatorRuntimeProtocol",
".",
"EvaluatorHeartbeatProto",
">",
"evaluatorHeartbeatProtoRemoteMessage",
")",
"{",
"final",
"EvaluatorRuntimeProtocol",
".",
"EvaluatorHeartbeatProto",
"evaluatorH... | Process an evaluator heartbeat message. | [
"Process",
"an",
"evaluator",
"heartbeat",
"message",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java#L388-L464 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java | EvaluatorManager.onEvaluatorStatusMessage | private synchronized void onEvaluatorStatusMessage(final EvaluatorStatusPOJO message) {
switch (message.getState()) {
case DONE:
this.onEvaluatorDone(message);
break;
case FAILED:
this.onEvaluatorFailed(message);
break;
case KILLED:
this.onEvaluatorKilled(message);
b... | java | private synchronized void onEvaluatorStatusMessage(final EvaluatorStatusPOJO message) {
switch (message.getState()) {
case DONE:
this.onEvaluatorDone(message);
break;
case FAILED:
this.onEvaluatorFailed(message);
break;
case KILLED:
this.onEvaluatorKilled(message);
b... | [
"private",
"synchronized",
"void",
"onEvaluatorStatusMessage",
"(",
"final",
"EvaluatorStatusPOJO",
"message",
")",
"{",
"switch",
"(",
"message",
".",
"getState",
"(",
")",
")",
"{",
"case",
"DONE",
":",
"this",
".",
"onEvaluatorDone",
"(",
"message",
")",
";... | Process a evaluator status message.
@param message | [
"Process",
"a",
"evaluator",
"status",
"message",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java#L471-L490 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java | EvaluatorManager.onEvaluatorDone | private synchronized void onEvaluatorDone(final EvaluatorStatusPOJO message) {
assert message.getState() == State.DONE;
LOG.log(Level.FINEST, "Evaluator {0} done.", getId());
// Send an ACK to the Evaluator.
sendEvaluatorControlMessage(
EvaluatorRuntimeProtocol.EvaluatorControlProto.newBuilde... | java | private synchronized void onEvaluatorDone(final EvaluatorStatusPOJO message) {
assert message.getState() == State.DONE;
LOG.log(Level.FINEST, "Evaluator {0} done.", getId());
// Send an ACK to the Evaluator.
sendEvaluatorControlMessage(
EvaluatorRuntimeProtocol.EvaluatorControlProto.newBuilde... | [
"private",
"synchronized",
"void",
"onEvaluatorDone",
"(",
"final",
"EvaluatorStatusPOJO",
"message",
")",
"{",
"assert",
"message",
".",
"getState",
"(",
")",
"==",
"State",
".",
"DONE",
";",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Evaluator... | Process an evaluator message that indicates that the evaluator shut down cleanly.
@param message | [
"Process",
"an",
"evaluator",
"message",
"that",
"indicates",
"that",
"the",
"evaluator",
"shut",
"down",
"cleanly",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java#L497-L515 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java | EvaluatorManager.onEvaluatorFailed | private synchronized void onEvaluatorFailed(final EvaluatorStatusPOJO evaluatorStatus) {
assert evaluatorStatus.getState() == State.FAILED;
final EvaluatorException evaluatorException;
if (evaluatorStatus.hasError()) {
final Optional<Throwable> exception =
this.exceptionCodec.fromBytes(e... | java | private synchronized void onEvaluatorFailed(final EvaluatorStatusPOJO evaluatorStatus) {
assert evaluatorStatus.getState() == State.FAILED;
final EvaluatorException evaluatorException;
if (evaluatorStatus.hasError()) {
final Optional<Throwable> exception =
this.exceptionCodec.fromBytes(e... | [
"private",
"synchronized",
"void",
"onEvaluatorFailed",
"(",
"final",
"EvaluatorStatusPOJO",
"evaluatorStatus",
")",
"{",
"assert",
"evaluatorStatus",
".",
"getState",
"(",
")",
"==",
"State",
".",
"FAILED",
";",
"final",
"EvaluatorException",
"evaluatorException",
";... | Process an evaluator message that indicates a crash.
@param evaluatorStatus | [
"Process",
"an",
"evaluator",
"message",
"that",
"indicates",
"a",
"crash",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java#L522-L541 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java | EvaluatorManager.onEvaluatorKilled | private synchronized void onEvaluatorKilled(final EvaluatorStatusPOJO message) {
assert message.getState() == State.KILLED;
assert this.stateManager.isClosing();
LOG.log(Level.WARNING, "Evaluator {0} killed completely.", getId());
this.stateManager.setKilled();
} | java | private synchronized void onEvaluatorKilled(final EvaluatorStatusPOJO message) {
assert message.getState() == State.KILLED;
assert this.stateManager.isClosing();
LOG.log(Level.WARNING, "Evaluator {0} killed completely.", getId());
this.stateManager.setKilled();
} | [
"private",
"synchronized",
"void",
"onEvaluatorKilled",
"(",
"final",
"EvaluatorStatusPOJO",
"message",
")",
"{",
"assert",
"message",
".",
"getState",
"(",
")",
"==",
"State",
".",
"KILLED",
";",
"assert",
"this",
".",
"stateManager",
".",
"isClosing",
"(",
"... | Process an evaluator message that indicates that the evaluator completed the unclean shut down request.
@param message | [
"Process",
"an",
"evaluator",
"message",
"that",
"indicates",
"that",
"the",
"evaluator",
"completed",
"the",
"unclean",
"shut",
"down",
"request",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java#L548-L556 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java | EvaluatorManager.sendContextControlMessage | public void sendContextControlMessage(final EvaluatorRuntimeProtocol.ContextControlProto contextControlProto) {
synchronized (this.evaluatorDescriptor) {
LOG.log(Level.FINEST, "Context control message to {0}", this.evaluatorId);
this.contextControlHandler.send(contextControlProto);
}
} | java | public void sendContextControlMessage(final EvaluatorRuntimeProtocol.ContextControlProto contextControlProto) {
synchronized (this.evaluatorDescriptor) {
LOG.log(Level.FINEST, "Context control message to {0}", this.evaluatorId);
this.contextControlHandler.send(contextControlProto);
}
} | [
"public",
"void",
"sendContextControlMessage",
"(",
"final",
"EvaluatorRuntimeProtocol",
".",
"ContextControlProto",
"contextControlProto",
")",
"{",
"synchronized",
"(",
"this",
".",
"evaluatorDescriptor",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
"... | Packages the ContextControlProto in an EvaluatorControlProto and forward it to the EvaluatorRuntime.
@param contextControlProto message contains context control info. | [
"Packages",
"the",
"ContextControlProto",
"in",
"an",
"EvaluatorControlProto",
"and",
"forward",
"it",
"to",
"the",
"EvaluatorRuntime",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java#L578-L583 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java | EvaluatorManager.onTaskStatusMessage | private void onTaskStatusMessage(final TaskStatusPOJO taskStatus) {
if (!(this.task.isPresent() && this.task.get().getId().equals(taskStatus.getTaskId()))) {
final State state = taskStatus.getState();
if (state.isRestartable() ||
this.driverRestartManager.getEvaluatorRestartState(this.evalua... | java | private void onTaskStatusMessage(final TaskStatusPOJO taskStatus) {
if (!(this.task.isPresent() && this.task.get().getId().equals(taskStatus.getTaskId()))) {
final State state = taskStatus.getState();
if (state.isRestartable() ||
this.driverRestartManager.getEvaluatorRestartState(this.evalua... | [
"private",
"void",
"onTaskStatusMessage",
"(",
"final",
"TaskStatusPOJO",
"taskStatus",
")",
"{",
"if",
"(",
"!",
"(",
"this",
".",
"task",
".",
"isPresent",
"(",
")",
"&&",
"this",
".",
"task",
".",
"get",
"(",
")",
".",
"getId",
"(",
")",
".",
"equ... | Handle task status messages.
@param taskStatus message contains the current task status. | [
"Handle",
"task",
"status",
"messages",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java#L601-L638 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/time/runtime/LogicalTimer.java | LogicalTimer.isReady | @Override
public boolean isReady(final long time) {
while (true) {
final long thisTs = this.current.get();
if (thisTs >= time || this.current.compareAndSet(thisTs, time)) {
return true;
}
}
} | java | @Override
public boolean isReady(final long time) {
while (true) {
final long thisTs = this.current.get();
if (thisTs >= time || this.current.compareAndSet(thisTs, time)) {
return true;
}
}
} | [
"@",
"Override",
"public",
"boolean",
"isReady",
"(",
"final",
"long",
"time",
")",
"{",
"while",
"(",
"true",
")",
"{",
"final",
"long",
"thisTs",
"=",
"this",
".",
"current",
".",
"get",
"(",
")",
";",
"if",
"(",
"thisTs",
">=",
"time",
"||",
"th... | Check if the event with a given timestamp has occurred, according to the timer.
This implementation always returns true and updates current timer's time to the timestamp
of the most distant future event.
@param time Timestamp in milliseconds.
@return Always returns true.
@deprecated [REEF-1532] Prefer passing Time obje... | [
"Check",
"if",
"the",
"event",
"with",
"a",
"given",
"timestamp",
"has",
"occurred",
"according",
"to",
"the",
"timer",
".",
"This",
"implementation",
"always",
"returns",
"true",
"and",
"updates",
"current",
"timer",
"s",
"time",
"to",
"the",
"timestamp",
"... | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/time/runtime/LogicalTimer.java#L97-L105 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/suspend/ObjectWritableCodec.java | ObjectWritableCodec.encode | @Override
public byte[] encode(final T writable) {
try (final ByteArrayOutputStream bos = new ByteArrayOutputStream();
final DataOutputStream dos = new DataOutputStream(bos)) {
writable.write(dos);
return bos.toByteArray();
} catch (final IOException ex) {
LOG.log(Level.SEVERE, "Can... | java | @Override
public byte[] encode(final T writable) {
try (final ByteArrayOutputStream bos = new ByteArrayOutputStream();
final DataOutputStream dos = new DataOutputStream(bos)) {
writable.write(dos);
return bos.toByteArray();
} catch (final IOException ex) {
LOG.log(Level.SEVERE, "Can... | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"encode",
"(",
"final",
"T",
"writable",
")",
"{",
"try",
"(",
"final",
"ByteArrayOutputStream",
"bos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"final",
"DataOutputStream",
"dos",
"=",
"new",
"DataOutp... | Encodes Hadoop Writable object into a byte array.
@param writable the object to encode.
@return serialized object as byte array.
@throws RemoteRuntimeException if serialization fails. | [
"Encodes",
"Hadoop",
"Writable",
"object",
"into",
"a",
"byte",
"array",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/suspend/ObjectWritableCodec.java#L62-L72 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/suspend/ObjectWritableCodec.java | ObjectWritableCodec.decode | @Override
public T decode(final byte[] buffer) {
try (final ByteArrayInputStream bis = new ByteArrayInputStream(buffer);
final DataInputStream dis = new DataInputStream(bis)) {
final T writable = this.writableClass.newInstance();
writable.readFields(dis);
return writable;
} catch (f... | java | @Override
public T decode(final byte[] buffer) {
try (final ByteArrayInputStream bis = new ByteArrayInputStream(buffer);
final DataInputStream dis = new DataInputStream(bis)) {
final T writable = this.writableClass.newInstance();
writable.readFields(dis);
return writable;
} catch (f... | [
"@",
"Override",
"public",
"T",
"decode",
"(",
"final",
"byte",
"[",
"]",
"buffer",
")",
"{",
"try",
"(",
"final",
"ByteArrayInputStream",
"bis",
"=",
"new",
"ByteArrayInputStream",
"(",
"buffer",
")",
";",
"final",
"DataInputStream",
"dis",
"=",
"new",
"D... | Decode Hadoop Writable object from a byte array.
@param buffer serialized version of the Writable object (as a byte array).
@return a Writable object.
@throws RemoteRuntimeException if deserialization fails. | [
"Decode",
"Hadoop",
"Writable",
"object",
"from",
"a",
"byte",
"array",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/suspend/ObjectWritableCodec.java#L81-L92 | train |
apache/reef | lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/batch/AzureBatchHelper.java | AzureBatchHelper.submitJob | public void submitJob(final String applicationId, final String storageContainerSAS, final URI jobJarUri,
final String command) throws IOException {
final ResourceFile jarResourceFile = new ResourceFile()
.withBlobSource(jobJarUri.toString())
.withFilePath(AzureBatchFileNames.... | java | public void submitJob(final String applicationId, final String storageContainerSAS, final URI jobJarUri,
final String command) throws IOException {
final ResourceFile jarResourceFile = new ResourceFile()
.withBlobSource(jobJarUri.toString())
.withFilePath(AzureBatchFileNames.... | [
"public",
"void",
"submitJob",
"(",
"final",
"String",
"applicationId",
",",
"final",
"String",
"storageContainerSAS",
",",
"final",
"URI",
"jobJarUri",
",",
"final",
"String",
"command",
")",
"throws",
"IOException",
"{",
"final",
"ResourceFile",
"jarResourceFile",... | Create a job on Azure Batch.
@param applicationId the ID of the application.
@param storageContainerSAS the publicly accessible uri to the job container.
@param jobJarUri the publicly accessible uri to the job jar directory.
@param command the commandline argument to execute... | [
"Create",
"a",
"job",
"on",
"Azure",
"Batch",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/batch/AzureBatchHelper.java#L88-L124 | train |
apache/reef | lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/batch/AzureBatchHelper.java | AzureBatchHelper.submitTask | public void submitTask(final String jobId, final String taskId, final URI jobJarUri,
final URI confUri, final String command)
throws IOException {
final List<ResourceFile> resources = new ArrayList<>();
final ResourceFile jarSourceFile = new ResourceFile()
.withBlobSourc... | java | public void submitTask(final String jobId, final String taskId, final URI jobJarUri,
final URI confUri, final String command)
throws IOException {
final List<ResourceFile> resources = new ArrayList<>();
final ResourceFile jarSourceFile = new ResourceFile()
.withBlobSourc... | [
"public",
"void",
"submitTask",
"(",
"final",
"String",
"jobId",
",",
"final",
"String",
"taskId",
",",
"final",
"URI",
"jobJarUri",
",",
"final",
"URI",
"confUri",
",",
"final",
"String",
"command",
")",
"throws",
"IOException",
"{",
"final",
"List",
"<",
... | Adds a single task to a job on Azure Batch.
@param jobId the ID of the job.
@param taskId the ID of the task.
@param jobJarUri the publicly accessible uri list to the job jar directory.
@param confUri the publicly accessible uri list to the job configuration directory.
@param command the commandline argumen... | [
"Adds",
"a",
"single",
"task",
"to",
"a",
"job",
"on",
"Azure",
"Batch",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/batch/AzureBatchHelper.java#L136-L166 | train |
apache/reef | lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/batch/AzureBatchHelper.java | AzureBatchHelper.getTaskStatusForJob | public List<CloudTask> getTaskStatusForJob(final String jobId) {
List<CloudTask> tasks = null;
try {
tasks = client.taskOperations().listTasks(jobId);
LOG.log(Level.INFO, "Task status for job: {0} returned {1} tasks", new Object[]{jobId, tasks.size()});
} catch (IOException | BatchErrorException... | java | public List<CloudTask> getTaskStatusForJob(final String jobId) {
List<CloudTask> tasks = null;
try {
tasks = client.taskOperations().listTasks(jobId);
LOG.log(Level.INFO, "Task status for job: {0} returned {1} tasks", new Object[]{jobId, tasks.size()});
} catch (IOException | BatchErrorException... | [
"public",
"List",
"<",
"CloudTask",
">",
"getTaskStatusForJob",
"(",
"final",
"String",
"jobId",
")",
"{",
"List",
"<",
"CloudTask",
">",
"tasks",
"=",
"null",
";",
"try",
"{",
"tasks",
"=",
"client",
".",
"taskOperations",
"(",
")",
".",
"listTasks",
"(... | List the tasks of the specified job.
@param jobId the ID of the job.
@return A list of CloudTask objects. | [
"List",
"the",
"tasks",
"of",
"the",
"specified",
"job",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/batch/AzureBatchHelper.java#L174-L185 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/serialization/NamingLookupRequestCodec.java | NamingLookupRequestCodec.encode | @Override
public byte[] encode(final NamingLookupRequest obj) {
final List<CharSequence> ids = new ArrayList<>();
for (final Identifier id : obj.getIdentifiers()) {
ids.add(id.toString());
}
return AvroUtils.toBytes(AvroNamingLookupRequest.newBuilder().setIds(ids).build(), AvroNamingLookupReques... | java | @Override
public byte[] encode(final NamingLookupRequest obj) {
final List<CharSequence> ids = new ArrayList<>();
for (final Identifier id : obj.getIdentifiers()) {
ids.add(id.toString());
}
return AvroUtils.toBytes(AvroNamingLookupRequest.newBuilder().setIds(ids).build(), AvroNamingLookupReques... | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"encode",
"(",
"final",
"NamingLookupRequest",
"obj",
")",
"{",
"final",
"List",
"<",
"CharSequence",
">",
"ids",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"Identifier",
"id",
":",
"... | Encodes the identifiers to bytes.
@param obj the naming lookup request
@return a byte array | [
"Encodes",
"the",
"identifiers",
"to",
"bytes",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/serialization/NamingLookupRequestCodec.java#L53-L60 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/serialization/NamingLookupRequestCodec.java | NamingLookupRequestCodec.decode | @Override
public NamingLookupRequest decode(final byte[] buf) {
final AvroNamingLookupRequest req = AvroUtils.fromBytes(buf, AvroNamingLookupRequest.class);
final List<Identifier> ids = new ArrayList<>(req.getIds().size());
for (final CharSequence s : req.getIds()) {
ids.add(factory.getNewInstance(... | java | @Override
public NamingLookupRequest decode(final byte[] buf) {
final AvroNamingLookupRequest req = AvroUtils.fromBytes(buf, AvroNamingLookupRequest.class);
final List<Identifier> ids = new ArrayList<>(req.getIds().size());
for (final CharSequence s : req.getIds()) {
ids.add(factory.getNewInstance(... | [
"@",
"Override",
"public",
"NamingLookupRequest",
"decode",
"(",
"final",
"byte",
"[",
"]",
"buf",
")",
"{",
"final",
"AvroNamingLookupRequest",
"req",
"=",
"AvroUtils",
".",
"fromBytes",
"(",
"buf",
",",
"AvroNamingLookupRequest",
".",
"class",
")",
";",
"fin... | Decodes the bytes to a naming lookup request.
@param buf the byte array
@return a naming lookup request | [
"Decodes",
"the",
"bytes",
"to",
"a",
"naming",
"lookup",
"request",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/serialization/NamingLookupRequestCodec.java#L68-L77 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/hello/HelloJVMOptionsREEF.java | HelloJVMOptionsREEF.main | public static void main(final String[] args) throws BindException, InjectionException {
final Configuration runtimeConf = getRuntimeConfiguration();
final Configuration driverConf = getDriverConfiguration();
final LauncherStatus status = DriverLauncher
.getLauncher(runtimeConf)
.run(driverC... | java | public static void main(final String[] args) throws BindException, InjectionException {
final Configuration runtimeConf = getRuntimeConfiguration();
final Configuration driverConf = getDriverConfiguration();
final LauncherStatus status = DriverLauncher
.getLauncher(runtimeConf)
.run(driverC... | [
"public",
"static",
"void",
"main",
"(",
"final",
"String",
"[",
"]",
"args",
")",
"throws",
"BindException",
",",
"InjectionException",
"{",
"final",
"Configuration",
"runtimeConf",
"=",
"getRuntimeConfiguration",
"(",
")",
";",
"final",
"Configuration",
"driverC... | Start HelloJVMOptions REEF job.
@param args command line parameters.
@throws BindException configuration error.
@throws InjectionException configuration error. | [
"Start",
"HelloJVMOptions",
"REEF",
"job",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hello/HelloJVMOptionsREEF.java#L78-L86 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorStatusManager.java | EvaluatorStatusManager.setState | private void setState(final EvaluatorState toState) {
while (true) {
final EvaluatorState fromState = this.state.get();
if (fromState == toState) {
break;
}
if (!fromState.isLegalTransition(toState)) {
LOG.log(Level.WARNING, "Illegal state transition: {0} -> {1}", new Objec... | java | private void setState(final EvaluatorState toState) {
while (true) {
final EvaluatorState fromState = this.state.get();
if (fromState == toState) {
break;
}
if (!fromState.isLegalTransition(toState)) {
LOG.log(Level.WARNING, "Illegal state transition: {0} -> {1}", new Objec... | [
"private",
"void",
"setState",
"(",
"final",
"EvaluatorState",
"toState",
")",
"{",
"while",
"(",
"true",
")",
"{",
"final",
"EvaluatorState",
"fromState",
"=",
"this",
".",
"state",
".",
"get",
"(",
")",
";",
"if",
"(",
"fromState",
"==",
"toState",
")"... | Transition to the new state of the evaluator, if possible.
@param toState New state of the evaluator.
@throws IllegalStateException if state transition is not valid. | [
"Transition",
"to",
"the",
"new",
"state",
"of",
"the",
"evaluator",
"if",
"possible",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorStatusManager.java#L172-L189 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/driver/TopologySerializer.java | TopologySerializer.encode | public static byte[] encode(final TaskNode root) {
try (final ByteArrayOutputStream bstream = new ByteArrayOutputStream();
final DataOutputStream dstream = new DataOutputStream(bstream)) {
encodeHelper(dstream, root);
return bstream.toByteArray();
} catch (final IOException e) {
thro... | java | public static byte[] encode(final TaskNode root) {
try (final ByteArrayOutputStream bstream = new ByteArrayOutputStream();
final DataOutputStream dstream = new DataOutputStream(bstream)) {
encodeHelper(dstream, root);
return bstream.toByteArray();
} catch (final IOException e) {
thro... | [
"public",
"static",
"byte",
"[",
"]",
"encode",
"(",
"final",
"TaskNode",
"root",
")",
"{",
"try",
"(",
"final",
"ByteArrayOutputStream",
"bstream",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"final",
"DataOutputStream",
"dstream",
"=",
"new",
"DataOu... | Recursively encode TaskNodes of a Topology into a byte array.
@param root the root node of the subtree to encode
@return encoded byte array | [
"Recursively",
"encode",
"TaskNodes",
"of",
"a",
"Topology",
"into",
"a",
"byte",
"array",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/driver/TopologySerializer.java#L47-L56 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/driver/TopologySerializer.java | TopologySerializer.decode | public static Pair<TopologySimpleNode, List<Identifier>> decode(
final byte[] data,
final IdentifierFactory ifac) {
try (final DataInputStream dstream = new DataInputStream(new ByteArrayInputStream(data))) {
final List<Identifier> activeSlaveTasks = new LinkedList<>();
final TopologySimpleN... | java | public static Pair<TopologySimpleNode, List<Identifier>> decode(
final byte[] data,
final IdentifierFactory ifac) {
try (final DataInputStream dstream = new DataInputStream(new ByteArrayInputStream(data))) {
final List<Identifier> activeSlaveTasks = new LinkedList<>();
final TopologySimpleN... | [
"public",
"static",
"Pair",
"<",
"TopologySimpleNode",
",",
"List",
"<",
"Identifier",
">",
">",
"decode",
"(",
"final",
"byte",
"[",
"]",
"data",
",",
"final",
"IdentifierFactory",
"ifac",
")",
"{",
"try",
"(",
"final",
"DataInputStream",
"dstream",
"=",
... | Recursively translate a byte array into a TopologySimpleNode and a list of task Identifiers.
@param data encoded byte array
@param ifac IdentifierFactory needed to generate Identifiers from String Ids
@return decoded TopologySimpleNode and a lexicographically sorted list of task Identifiers | [
"Recursively",
"translate",
"a",
"byte",
"array",
"into",
"a",
"TopologySimpleNode",
"and",
"a",
"list",
"of",
"task",
"Identifiers",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/driver/TopologySerializer.java#L74-L86 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/Scheduler.java | Scheduler.submitTask | public synchronized void submitTask(final ActiveContext context) {
final TaskEntity task = taskQueue.poll();
final Integer taskId = task.getId();
final String command = task.getCommand();
final Configuration taskConf = TaskConfiguration.CONF
.set(TaskConfiguration.TASK, ShellTask.class)
... | java | public synchronized void submitTask(final ActiveContext context) {
final TaskEntity task = taskQueue.poll();
final Integer taskId = task.getId();
final String command = task.getCommand();
final Configuration taskConf = TaskConfiguration.CONF
.set(TaskConfiguration.TASK, ShellTask.class)
... | [
"public",
"synchronized",
"void",
"submitTask",
"(",
"final",
"ActiveContext",
"context",
")",
"{",
"final",
"TaskEntity",
"task",
"=",
"taskQueue",
".",
"poll",
"(",
")",
";",
"final",
"Integer",
"taskId",
"=",
"task",
".",
"getId",
"(",
")",
";",
"final"... | Submit a task to the ActiveContext. | [
"Submit",
"a",
"task",
"to",
"the",
"ActiveContext",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/Scheduler.java#L73-L89 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/Scheduler.java | Scheduler.cancelTask | public synchronized int cancelTask(final int taskId) throws UnsuccessfulException, NotFoundException {
if (getTask(taskId, runningTasks) != null) {
throw new UnsuccessfulException("The task " + taskId + " is running");
} else if (getTask(taskId, finishedTasks) != null) {
throw new UnsuccessfulExcept... | java | public synchronized int cancelTask(final int taskId) throws UnsuccessfulException, NotFoundException {
if (getTask(taskId, runningTasks) != null) {
throw new UnsuccessfulException("The task " + taskId + " is running");
} else if (getTask(taskId, finishedTasks) != null) {
throw new UnsuccessfulExcept... | [
"public",
"synchronized",
"int",
"cancelTask",
"(",
"final",
"int",
"taskId",
")",
"throws",
"UnsuccessfulException",
",",
"NotFoundException",
"{",
"if",
"(",
"getTask",
"(",
"taskId",
",",
"runningTasks",
")",
"!=",
"null",
")",
"{",
"throw",
"new",
"Unsucce... | Update the record of task to mark it as canceled. | [
"Update",
"the",
"record",
"of",
"task",
"to",
"mark",
"it",
"as",
"canceled",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/Scheduler.java#L94-L111 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/Scheduler.java | Scheduler.clear | public synchronized int clear() {
final int count = taskQueue.size();
for (final TaskEntity task : taskQueue) {
canceledTasks.add(task);
}
taskQueue.clear();
return count;
} | java | public synchronized int clear() {
final int count = taskQueue.size();
for (final TaskEntity task : taskQueue) {
canceledTasks.add(task);
}
taskQueue.clear();
return count;
} | [
"public",
"synchronized",
"int",
"clear",
"(",
")",
"{",
"final",
"int",
"count",
"=",
"taskQueue",
".",
"size",
"(",
")",
";",
"for",
"(",
"final",
"TaskEntity",
"task",
":",
"taskQueue",
")",
"{",
"canceledTasks",
".",
"add",
"(",
"task",
")",
";",
... | Clear the pending list.
@return the number of removed tasks | [
"Clear",
"the",
"pending",
"list",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/Scheduler.java#L117-L124 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/Scheduler.java | Scheduler.getList | public synchronized Map<String, List<Integer>> getList() {
final Map<String, List<Integer>> tasks = new LinkedHashMap<>();
tasks.put("Running", getTaskIdList(runningTasks));
tasks.put("Waiting", getTaskIdList(taskQueue));
tasks.put("Finished", getTaskIdList(finishedTasks));
tasks.put("Canceled", ge... | java | public synchronized Map<String, List<Integer>> getList() {
final Map<String, List<Integer>> tasks = new LinkedHashMap<>();
tasks.put("Running", getTaskIdList(runningTasks));
tasks.put("Waiting", getTaskIdList(taskQueue));
tasks.put("Finished", getTaskIdList(finishedTasks));
tasks.put("Canceled", ge... | [
"public",
"synchronized",
"Map",
"<",
"String",
",",
"List",
"<",
"Integer",
">",
">",
"getList",
"(",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"List",
"<",
"Integer",
">",
">",
"tasks",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
"tasks",... | Get the list of Tasks, which are grouped by the states.
@return a Map grouped by task state, each with a List of taskIds. | [
"Get",
"the",
"list",
"of",
"Tasks",
"which",
"are",
"grouped",
"by",
"the",
"states",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/Scheduler.java#L130-L139 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/Scheduler.java | Scheduler.getTaskStatus | public synchronized String getTaskStatus(final int taskId) throws NotFoundException {
final TaskEntity running = getTask(taskId, runningTasks);
if (running != null) {
return "Running : " + running.toString();
}
final TaskEntity waiting = getTask(taskId, taskQueue);
if (waiting != null) {
... | java | public synchronized String getTaskStatus(final int taskId) throws NotFoundException {
final TaskEntity running = getTask(taskId, runningTasks);
if (running != null) {
return "Running : " + running.toString();
}
final TaskEntity waiting = getTask(taskId, taskQueue);
if (waiting != null) {
... | [
"public",
"synchronized",
"String",
"getTaskStatus",
"(",
"final",
"int",
"taskId",
")",
"throws",
"NotFoundException",
"{",
"final",
"TaskEntity",
"running",
"=",
"getTask",
"(",
"taskId",
",",
"runningTasks",
")",
";",
"if",
"(",
"running",
"!=",
"null",
")"... | Get the status of a Task.
@return the status of the Task. | [
"Get",
"the",
"status",
"of",
"a",
"Task",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/Scheduler.java#L145-L169 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/Scheduler.java | Scheduler.setFinished | public synchronized void setFinished(final int taskId) {
final TaskEntity task = getTask(taskId, runningTasks);
runningTasks.remove(task);
finishedTasks.add(task);
} | java | public synchronized void setFinished(final int taskId) {
final TaskEntity task = getTask(taskId, runningTasks);
runningTasks.remove(task);
finishedTasks.add(task);
} | [
"public",
"synchronized",
"void",
"setFinished",
"(",
"final",
"int",
"taskId",
")",
"{",
"final",
"TaskEntity",
"task",
"=",
"getTask",
"(",
"taskId",
",",
"runningTasks",
")",
";",
"runningTasks",
".",
"remove",
"(",
"task",
")",
";",
"finishedTasks",
".",... | Update the record of task to mark it as finished. | [
"Update",
"the",
"record",
"of",
"task",
"to",
"mark",
"it",
"as",
"finished",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/Scheduler.java#L202-L206 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/Scheduler.java | Scheduler.getTask | private static TaskEntity getTask(final int taskId, final Collection<TaskEntity> tasks) {
for (final TaskEntity task : tasks) {
if (taskId == task.getId()) {
return task;
}
}
return null;
} | java | private static TaskEntity getTask(final int taskId, final Collection<TaskEntity> tasks) {
for (final TaskEntity task : tasks) {
if (taskId == task.getId()) {
return task;
}
}
return null;
} | [
"private",
"static",
"TaskEntity",
"getTask",
"(",
"final",
"int",
"taskId",
",",
"final",
"Collection",
"<",
"TaskEntity",
">",
"tasks",
")",
"{",
"for",
"(",
"final",
"TaskEntity",
"task",
":",
"tasks",
")",
"{",
"if",
"(",
"taskId",
"==",
"task",
".",... | Iterate over the collection to find a TaskEntity with ID. | [
"Iterate",
"over",
"the",
"collection",
"to",
"find",
"a",
"TaskEntity",
"with",
"ID",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/driver/Scheduler.java#L222-L229 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/util/SingletonAsserter.java | SingletonAsserter.assertSingleton | public static synchronized boolean assertSingleton(final String scopeId, final Class clazz) {
ALL_CLASSES.add(clazz);
return SINGLETONS_SCOPED.add(new Tuple<>(scopeId, clazz)) && !SINGLETONS_GLOBAL.contains(clazz);
} | java | public static synchronized boolean assertSingleton(final String scopeId, final Class clazz) {
ALL_CLASSES.add(clazz);
return SINGLETONS_SCOPED.add(new Tuple<>(scopeId, clazz)) && !SINGLETONS_GLOBAL.contains(clazz);
} | [
"public",
"static",
"synchronized",
"boolean",
"assertSingleton",
"(",
"final",
"String",
"scopeId",
",",
"final",
"Class",
"clazz",
")",
"{",
"ALL_CLASSES",
".",
"add",
"(",
"clazz",
")",
";",
"return",
"SINGLETONS_SCOPED",
".",
"add",
"(",
"new",
"Tuple",
... | Check if given class is singleton within a particular environment or scope.
@param scopeId Environment id, e.g. Driver name or REEF job id.
@param clazz Class that must have no more than 1 instance in that environment.
@return true if the instance is unique within that particular environment, false otherwise. | [
"Check",
"if",
"given",
"class",
"is",
"singleton",
"within",
"a",
"particular",
"environment",
"or",
"scope",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/util/SingletonAsserter.java#L58-L61 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/REEFImplementation.java | REEFImplementation.createDriverConfiguration | private Configuration createDriverConfiguration(final Configuration driverConfiguration) {
final ConfigurationBuilder configurationBuilder = Tang.Factory.getTang()
.newConfigurationBuilder(driverConfiguration);
for (final ConfigurationProvider configurationProvider : this.configurationProviders) {
... | java | private Configuration createDriverConfiguration(final Configuration driverConfiguration) {
final ConfigurationBuilder configurationBuilder = Tang.Factory.getTang()
.newConfigurationBuilder(driverConfiguration);
for (final ConfigurationProvider configurationProvider : this.configurationProviders) {
... | [
"private",
"Configuration",
"createDriverConfiguration",
"(",
"final",
"Configuration",
"driverConfiguration",
")",
"{",
"final",
"ConfigurationBuilder",
"configurationBuilder",
"=",
"Tang",
".",
"Factory",
".",
"getTang",
"(",
")",
".",
"newConfigurationBuilder",
"(",
... | Assembles the final Driver Configuration by merging in all the Configurations provided by ConfigurationProviders.
@param driverConfiguration
@return | [
"Assembles",
"the",
"final",
"Driver",
"Configuration",
"by",
"merging",
"in",
"all",
"the",
"Configurations",
"provided",
"by",
"ConfigurationProviders",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/REEFImplementation.java#L147-L154 | train |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/AvroEvaluatorInfoSerializer.java | AvroEvaluatorInfoSerializer.toAvro | @Override
public AvroEvaluatorsInfo toAvro(
final List<String> ids, final Map<String, EvaluatorDescriptor> evaluators) {
final List<AvroEvaluatorInfo> evaluatorsInfo = new ArrayList<>();
for (final String id : ids) {
final EvaluatorDescriptor evaluatorDescriptor = evaluators.get(id);
Stri... | java | @Override
public AvroEvaluatorsInfo toAvro(
final List<String> ids, final Map<String, EvaluatorDescriptor> evaluators) {
final List<AvroEvaluatorInfo> evaluatorsInfo = new ArrayList<>();
for (final String id : ids) {
final EvaluatorDescriptor evaluatorDescriptor = evaluators.get(id);
Stri... | [
"@",
"Override",
"public",
"AvroEvaluatorsInfo",
"toAvro",
"(",
"final",
"List",
"<",
"String",
">",
"ids",
",",
"final",
"Map",
"<",
"String",
",",
"EvaluatorDescriptor",
">",
"evaluators",
")",
"{",
"final",
"List",
"<",
"AvroEvaluatorInfo",
">",
"evaluators... | Create AvroEvaluatorsInfo object. | [
"Create",
"AvroEvaluatorsInfo",
"object",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/AvroEvaluatorInfoSerializer.java#L48-L87 | train |
apache/reef | lang/java/reef-utils/src/main/java/org/apache/reef/util/cache/WrappedValue.java | WrappedValue.loadAndGet | public synchronized V loadAndGet() throws ExecutionException {
try {
value = Optional.ofNullable(valueFetcher.call());
} catch (final Exception e) {
throw new ExecutionException(e);
} finally {
writeTime = Optional.of(currentTime.now());
this.notifyAll();
}
if (!value.isPrese... | java | public synchronized V loadAndGet() throws ExecutionException {
try {
value = Optional.ofNullable(valueFetcher.call());
} catch (final Exception e) {
throw new ExecutionException(e);
} finally {
writeTime = Optional.of(currentTime.now());
this.notifyAll();
}
if (!value.isPrese... | [
"public",
"synchronized",
"V",
"loadAndGet",
"(",
")",
"throws",
"ExecutionException",
"{",
"try",
"{",
"value",
"=",
"Optional",
".",
"ofNullable",
"(",
"valueFetcher",
".",
"call",
"(",
")",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
... | Must only be called once, by the thread that created this WrappedValue.
@return The value returned by valueFetcher | [
"Must",
"only",
"be",
"called",
"once",
"by",
"the",
"thread",
"that",
"created",
"this",
"WrappedValue",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-utils/src/main/java/org/apache/reef/util/cache/WrappedValue.java#L66-L80 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/examples/matmul/RowMatrix.java | RowMatrix.deepCopy | private List<List<Double>> deepCopy(final List<List<Double>> original) {
final List<List<Double>> result = new ArrayList<>(original.size());
for (final List<Double> originalRow : original) {
final List<Double> row = new ArrayList<>(originalRow.size());
for (final double element : originalRow) {
... | java | private List<List<Double>> deepCopy(final List<List<Double>> original) {
final List<List<Double>> result = new ArrayList<>(original.size());
for (final List<Double> originalRow : original) {
final List<Double> row = new ArrayList<>(originalRow.size());
for (final double element : originalRow) {
... | [
"private",
"List",
"<",
"List",
"<",
"Double",
">",
">",
"deepCopy",
"(",
"final",
"List",
"<",
"List",
"<",
"Double",
">",
">",
"original",
")",
"{",
"final",
"List",
"<",
"List",
"<",
"Double",
">",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"... | Create a deep copy to make the matrix immutable.
@param original Original matrix.
@return Deep copy of the matrix. | [
"Create",
"a",
"deep",
"copy",
"to",
"make",
"the",
"matrix",
"immutable",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/examples/matmul/RowMatrix.java#L145-L155 | train |
apache/reef | lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/client/DriverClientClock.java | DriverClientClock.onNext | @Override
public void onNext(final String alarmId) {
LOG.log(Level.INFO, "Alarm {0} triggered", alarmId);
final ClientAlarm clientAlarm = this.alarmMap.remove(alarmId);
if (clientAlarm != null) {
clientAlarm.run();
} else {
LOG.log(Level.SEVERE, "Unknown alarm id {0}", alarmId);
}
} | java | @Override
public void onNext(final String alarmId) {
LOG.log(Level.INFO, "Alarm {0} triggered", alarmId);
final ClientAlarm clientAlarm = this.alarmMap.remove(alarmId);
if (clientAlarm != null) {
clientAlarm.run();
} else {
LOG.log(Level.SEVERE, "Unknown alarm id {0}", alarmId);
}
} | [
"@",
"Override",
"public",
"void",
"onNext",
"(",
"final",
"String",
"alarmId",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"Alarm {0} triggered\"",
",",
"alarmId",
")",
";",
"final",
"ClientAlarm",
"clientAlarm",
"=",
"this",
".",
"alar... | Alarm clock event handler.
@param alarmId alarm identifier | [
"Alarm",
"clock",
"event",
"handler",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/client/DriverClientClock.java#L122-L131 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/avro/impl/MessageDeserializerImpl.java | MessageDeserializerImpl.deserialize | public void deserialize(final BinaryDecoder decoder, final MultiObserver observer, final long sequence)
throws IOException, IllegalAccessException, InvocationTargetException {
final TMessage message = messageReader.read(null, decoder);
if (message != null) {
observer.onNext(sequence, message);
} ... | java | public void deserialize(final BinaryDecoder decoder, final MultiObserver observer, final long sequence)
throws IOException, IllegalAccessException, InvocationTargetException {
final TMessage message = messageReader.read(null, decoder);
if (message != null) {
observer.onNext(sequence, message);
} ... | [
"public",
"void",
"deserialize",
"(",
"final",
"BinaryDecoder",
"decoder",
",",
"final",
"MultiObserver",
"observer",
",",
"final",
"long",
"sequence",
")",
"throws",
"IOException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"final",
"TMessa... | Deserialize messages of type TMessage from input decoder.
@param decoder An Avro BinaryDecoder instance that is reading the input stream containing the message.
@param observer An instance of the MultiObserver class that will process the message.
@param sequence A long value which contains the sequence number of the me... | [
"Deserialize",
"messages",
"of",
"type",
"TMessage",
"from",
"input",
"decoder",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/avro/impl/MessageDeserializerImpl.java#L55-L64 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/ClientWireUp.java | ClientWireUp.close | synchronized void close() {
if (this.remoteManager.isPresent()) {
try {
this.remoteManager.get().close();
} catch (final Exception e) {
LOG.log(Level.WARNING, "Exception while shutting down the RemoteManager.", e);
}
}
} | java | synchronized void close() {
if (this.remoteManager.isPresent()) {
try {
this.remoteManager.get().close();
} catch (final Exception e) {
LOG.log(Level.WARNING, "Exception while shutting down the RemoteManager.", e);
}
}
} | [
"synchronized",
"void",
"close",
"(",
")",
"{",
"if",
"(",
"this",
".",
"remoteManager",
".",
"isPresent",
"(",
")",
")",
"{",
"try",
"{",
"this",
".",
"remoteManager",
".",
"get",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"final",
... | Closes the remote manager, if there was one. | [
"Closes",
"the",
"remote",
"manager",
"if",
"there",
"was",
"one",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/ClientWireUp.java#L95-L103 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/client/ClientManager.java | ClientManager.onNext | @Override
public synchronized void onNext(final ClientRuntimeProtocol.JobControlProto jobControlProto) {
if (jobControlProto.hasSignal()) {
if (jobControlProto.getSignal() == ClientRuntimeProtocol.Signal.SIG_TERMINATE) {
try {
if (jobControlProto.hasMessage()) {
getClientCloseW... | java | @Override
public synchronized void onNext(final ClientRuntimeProtocol.JobControlProto jobControlProto) {
if (jobControlProto.hasSignal()) {
if (jobControlProto.getSignal() == ClientRuntimeProtocol.Signal.SIG_TERMINATE) {
try {
if (jobControlProto.hasMessage()) {
getClientCloseW... | [
"@",
"Override",
"public",
"synchronized",
"void",
"onNext",
"(",
"final",
"ClientRuntimeProtocol",
".",
"JobControlProto",
"jobControlProto",
")",
"{",
"if",
"(",
"jobControlProto",
".",
"hasSignal",
"(",
")",
")",
"{",
"if",
"(",
"jobControlProto",
".",
"getSi... | This method reacts to control messages passed by the client to the driver. It will forward
messages related to the ClientObserver interface to the Driver. It will also initiate a shutdown
if the client indicates a close message.
@param jobControlProto contains the client initiated control message | [
"This",
"method",
"reacts",
"to",
"control",
"messages",
"passed",
"by",
"the",
"client",
"to",
"the",
"driver",
".",
"It",
"will",
"forward",
"messages",
"related",
"to",
"the",
"ClientObserver",
"interface",
"to",
"the",
"Driver",
".",
"It",
"will",
"also"... | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/client/ClientManager.java#L94-L113 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/ProxyEventHandler.java | ProxyEventHandler.onNext | @Override
public void onNext(final T event) {
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "remoteid: {0}\n{1}", new Object[]{remoteId.getSocketAddress(), event.toString()});
}
handler.onNext(new RemoteEvent<T>(myId.getSocketAddress(), remoteId.getSocketAddress(),
seqGen.getNextSeq(... | java | @Override
public void onNext(final T event) {
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "remoteid: {0}\n{1}", new Object[]{remoteId.getSocketAddress(), event.toString()});
}
handler.onNext(new RemoteEvent<T>(myId.getSocketAddress(), remoteId.getSocketAddress(),
seqGen.getNextSeq(... | [
"@",
"Override",
"public",
"void",
"onNext",
"(",
"final",
"T",
"event",
")",
"{",
"if",
"(",
"LOG",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"remoteid: {0}\\n{1}\"",
",",
"new"... | Sends the event to the event handler running remotely.
@param event the event | [
"Sends",
"the",
"event",
"to",
"the",
"event",
"handler",
"running",
"remotely",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/ProxyEventHandler.java#L70-L77 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/serialization/NamingRegisterRequestCodec.java | NamingRegisterRequestCodec.encode | @Override
public byte[] encode(final NamingRegisterRequest obj) {
final AvroNamingRegisterRequest result = AvroNamingRegisterRequest.newBuilder()
.setId(obj.getNameAssignment().getIdentifier().toString())
.setHost(obj.getNameAssignment().getAddress().getHostName())
.setPort(obj.getNameAssi... | java | @Override
public byte[] encode(final NamingRegisterRequest obj) {
final AvroNamingRegisterRequest result = AvroNamingRegisterRequest.newBuilder()
.setId(obj.getNameAssignment().getIdentifier().toString())
.setHost(obj.getNameAssignment().getAddress().getHostName())
.setPort(obj.getNameAssi... | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"encode",
"(",
"final",
"NamingRegisterRequest",
"obj",
")",
"{",
"final",
"AvroNamingRegisterRequest",
"result",
"=",
"AvroNamingRegisterRequest",
".",
"newBuilder",
"(",
")",
".",
"setId",
"(",
"obj",
".",
"getNameA... | Encodes the name assignment to bytes.
@param obj the naming registration request
@return a byte array | [
"Encodes",
"the",
"name",
"assignment",
"to",
"bytes",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/serialization/NamingRegisterRequestCodec.java#L50-L58 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/serialization/NamingRegisterRequestCodec.java | NamingRegisterRequestCodec.decode | @Override
public NamingRegisterRequest decode(final byte[] buf) {
final AvroNamingRegisterRequest avroNamingRegisterRequest =
AvroUtils.fromBytes(buf, AvroNamingRegisterRequest.class);
return new NamingRegisterRequest(
new NameAssignmentTuple(factory.getNewInstance(avroNamingRegisterRequest.ge... | java | @Override
public NamingRegisterRequest decode(final byte[] buf) {
final AvroNamingRegisterRequest avroNamingRegisterRequest =
AvroUtils.fromBytes(buf, AvroNamingRegisterRequest.class);
return new NamingRegisterRequest(
new NameAssignmentTuple(factory.getNewInstance(avroNamingRegisterRequest.ge... | [
"@",
"Override",
"public",
"NamingRegisterRequest",
"decode",
"(",
"final",
"byte",
"[",
"]",
"buf",
")",
"{",
"final",
"AvroNamingRegisterRequest",
"avroNamingRegisterRequest",
"=",
"AvroUtils",
".",
"fromBytes",
"(",
"buf",
",",
"AvroNamingRegisterRequest",
".",
"... | Decodes the bytes to a name assignment.
@param buf the byte array
@return a naming registration request
@throws org.apache.reef.io.network.naming.exception.NamingRuntimeException | [
"Decodes",
"the",
"bytes",
"to",
"a",
"name",
"assignment",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/serialization/NamingRegisterRequestCodec.java#L67-L75 | train |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerImpl.java | HttpServerImpl.addHttpHandler | @Override
public void addHttpHandler(final HttpHandler httpHandler) {
LOG.log(Level.INFO, "addHttpHandler: {0}", httpHandler.getUriSpecification());
jettyHandler.addHandler(httpHandler);
} | java | @Override
public void addHttpHandler(final HttpHandler httpHandler) {
LOG.log(Level.INFO, "addHttpHandler: {0}", httpHandler.getUriSpecification());
jettyHandler.addHandler(httpHandler);
} | [
"@",
"Override",
"public",
"void",
"addHttpHandler",
"(",
"final",
"HttpHandler",
"httpHandler",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"addHttpHandler: {0}\"",
",",
"httpHandler",
".",
"getUriSpecification",
"(",
")",
")",
";",
"jettyH... | Add a HttpHandler to Jetty Handler.
@param httpHandler | [
"Add",
"a",
"HttpHandler",
"to",
"Jetty",
"Handler",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerImpl.java#L170-L174 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/impl/NetworkConnectionServiceMessageCodec.java | NetworkConnectionServiceMessageCodec.encode | @Override
public byte[] encode(final NetworkConnectionServiceMessage obj) {
final Codec codec = connFactoryMap.get(obj.getConnectionFactoryId()).getCodec();
Boolean isStreamingCodec = isStreamingCodecMap.get(codec);
if (isStreamingCodec == null) {
isStreamingCodec = codec instanceof StreamingCodec;
... | java | @Override
public byte[] encode(final NetworkConnectionServiceMessage obj) {
final Codec codec = connFactoryMap.get(obj.getConnectionFactoryId()).getCodec();
Boolean isStreamingCodec = isStreamingCodecMap.get(codec);
if (isStreamingCodec == null) {
isStreamingCodec = codec instanceof StreamingCodec;
... | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"encode",
"(",
"final",
"NetworkConnectionServiceMessage",
"obj",
")",
"{",
"final",
"Codec",
"codec",
"=",
"connFactoryMap",
".",
"get",
"(",
"obj",
".",
"getConnectionFactoryId",
"(",
")",
")",
".",
"getCodec",
... | Encodes a network connection service message to bytes.
@param obj a message
@return bytes | [
"Encodes",
"a",
"network",
"connection",
"service",
"message",
"to",
"bytes",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/impl/NetworkConnectionServiceMessageCodec.java#L67-L100 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.