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-common/src/main/java/org/apache/reef/runtime/common/driver/resourcemanager/ResourceStatusHandler.java | ResourceStatusHandler.onNext | @Override
public void onNext(final ResourceStatusEvent resourceStatusEvent) {
final String id = resourceStatusEvent.getIdentifier();
final Optional<EvaluatorManager> evaluatorManager = this.evaluators.get(id);
LOG.log(Level.FINEST, "Evaluator {0} status: {1}",
new Object[] {evaluatorManager, res... | java | @Override
public void onNext(final ResourceStatusEvent resourceStatusEvent) {
final String id = resourceStatusEvent.getIdentifier();
final Optional<EvaluatorManager> evaluatorManager = this.evaluators.get(id);
LOG.log(Level.FINEST, "Evaluator {0} status: {1}",
new Object[] {evaluatorManager, res... | [
"@",
"Override",
"public",
"void",
"onNext",
"(",
"final",
"ResourceStatusEvent",
"resourceStatusEvent",
")",
"{",
"final",
"String",
"id",
"=",
"resourceStatusEvent",
".",
"getIdentifier",
"(",
")",
";",
"final",
"Optional",
"<",
"EvaluatorManager",
">",
"evaluat... | This resource status message comes from the ResourceManager layer, telling me what it thinks
about the state of the resource executing an Evaluator. This method simply passes the message
off to the referenced EvaluatorManager
@param resourceStatusEvent resource status message from the ResourceManager | [
"This",
"resource",
"status",
"message",
"comes",
"from",
"the",
"ResourceManager",
"layer",
"telling",
"me",
"what",
"it",
"thinks",
"about",
"the",
"state",
"of",
"the",
"resource",
"executing",
"an",
"Evaluator",
".",
"This",
"method",
"simply",
"passes",
"... | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/resourcemanager/ResourceStatusHandler.java#L62-L98 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/serialization/NamingLookupResponseCodec.java | NamingLookupResponseCodec.encode | @Override
public byte[] encode(final NamingLookupResponse obj) {
final List<AvroNamingAssignment> assignments = new ArrayList<>(obj.getNameAssignments().size());
for (final NameAssignment nameAssignment : obj.getNameAssignments()) {
assignments.add(AvroNamingAssignment.newBuilder()
.setId(name... | java | @Override
public byte[] encode(final NamingLookupResponse obj) {
final List<AvroNamingAssignment> assignments = new ArrayList<>(obj.getNameAssignments().size());
for (final NameAssignment nameAssignment : obj.getNameAssignments()) {
assignments.add(AvroNamingAssignment.newBuilder()
.setId(name... | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"encode",
"(",
"final",
"NamingLookupResponse",
"obj",
")",
"{",
"final",
"List",
"<",
"AvroNamingAssignment",
">",
"assignments",
"=",
"new",
"ArrayList",
"<>",
"(",
"obj",
".",
"getNameAssignments",
"(",
")",
".... | Encodes name assignments to bytes.
@param obj the naming lookup response
@return a byte array | [
"Encodes",
"name",
"assignments",
"to",
"bytes",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/serialization/NamingLookupResponseCodec.java#L56-L69 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/serialization/NamingLookupResponseCodec.java | NamingLookupResponseCodec.decode | @Override
public NamingLookupResponse decode(final byte[] buf) {
final AvroNamingLookupResponse avroResponse = AvroUtils.fromBytes(buf, AvroNamingLookupResponse.class);
final List<NameAssignment> nas = new ArrayList<>(avroResponse.getTuples().size());
for (final AvroNamingAssignment tuple : avroResponse.g... | java | @Override
public NamingLookupResponse decode(final byte[] buf) {
final AvroNamingLookupResponse avroResponse = AvroUtils.fromBytes(buf, AvroNamingLookupResponse.class);
final List<NameAssignment> nas = new ArrayList<>(avroResponse.getTuples().size());
for (final AvroNamingAssignment tuple : avroResponse.g... | [
"@",
"Override",
"public",
"NamingLookupResponse",
"decode",
"(",
"final",
"byte",
"[",
"]",
"buf",
")",
"{",
"final",
"AvroNamingLookupResponse",
"avroResponse",
"=",
"AvroUtils",
".",
"fromBytes",
"(",
"buf",
",",
"AvroNamingLookupResponse",
".",
"class",
")",
... | Decodes bytes to an iterable of name assignments.
@param buf the byte array
@return a naming lookup response
@throws org.apache.reef.io.network.naming.exception.NamingRuntimeException | [
"Decodes",
"bytes",
"to",
"an",
"iterable",
"of",
"name",
"assignments",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/serialization/NamingLookupResponseCodec.java#L78-L91 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/util/DeadlockInfo.java | DeadlockInfo.getMonitorLockedElements | public List<MonitorInfo> getMonitorLockedElements(final ThreadInfo threadInfo,
final StackTraceElement stackTraceElement) {
final Map<StackTraceElement, List<MonitorInfo>> elementMap = monitorLockedElements.get(threadInfo);
if (null == elementMap) {
retu... | java | public List<MonitorInfo> getMonitorLockedElements(final ThreadInfo threadInfo,
final StackTraceElement stackTraceElement) {
final Map<StackTraceElement, List<MonitorInfo>> elementMap = monitorLockedElements.get(threadInfo);
if (null == elementMap) {
retu... | [
"public",
"List",
"<",
"MonitorInfo",
">",
"getMonitorLockedElements",
"(",
"final",
"ThreadInfo",
"threadInfo",
",",
"final",
"StackTraceElement",
"stackTraceElement",
")",
"{",
"final",
"Map",
"<",
"StackTraceElement",
",",
"List",
"<",
"MonitorInfo",
">",
">",
... | Get a list of monitor locks that were acquired by this thread at this stack element.
@param threadInfo The thread that created the stack element
@param stackTraceElement The stack element
@return List of monitor locks that were acquired by this thread at this stack element
or an empty list if none were acquired | [
"Get",
"a",
"list",
"of",
"monitor",
"locks",
"that",
"were",
"acquired",
"by",
"this",
"thread",
"at",
"this",
"stack",
"element",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/util/DeadlockInfo.java#L71-L84 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/util/DeadlockInfo.java | DeadlockInfo.getWaitingLockString | @Nullable
public String getWaitingLockString(final ThreadInfo threadInfo) {
if (null == threadInfo.getLockInfo()) {
return null;
} else {
return threadInfo.getLockName() + " held by " + threadInfo.getLockOwnerName();
}
} | java | @Nullable
public String getWaitingLockString(final ThreadInfo threadInfo) {
if (null == threadInfo.getLockInfo()) {
return null;
} else {
return threadInfo.getLockName() + " held by " + threadInfo.getLockOwnerName();
}
} | [
"@",
"Nullable",
"public",
"String",
"getWaitingLockString",
"(",
"final",
"ThreadInfo",
"threadInfo",
")",
"{",
"if",
"(",
"null",
"==",
"threadInfo",
".",
"getLockInfo",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"threadInfo",
... | Get a string identifying the lock that this thread is waiting on.
@param threadInfo
@return A string identifying the lock that this thread is waiting on,
or null if the thread is not waiting on a lock | [
"Get",
"a",
"string",
"identifying",
"the",
"lock",
"that",
"this",
"thread",
"is",
"waiting",
"on",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/util/DeadlockInfo.java#L92-L99 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/group/broadcast/BroadcastREEF.java | BroadcastREEF.storeCommandLineArgs | private static void storeCommandLineArgs(
final Configuration commandLineConf) throws InjectionException {
final Injector injector = Tang.Factory.getTang().newInjector(commandLineConf);
local = injector.getNamedInstance(Local.class);
dimensions = injector.getNamedInstance(ModelDimensions.class);
n... | java | private static void storeCommandLineArgs(
final Configuration commandLineConf) throws InjectionException {
final Injector injector = Tang.Factory.getTang().newInjector(commandLineConf);
local = injector.getNamedInstance(Local.class);
dimensions = injector.getNamedInstance(ModelDimensions.class);
n... | [
"private",
"static",
"void",
"storeCommandLineArgs",
"(",
"final",
"Configuration",
"commandLineConf",
")",
"throws",
"InjectionException",
"{",
"final",
"Injector",
"injector",
"=",
"Tang",
".",
"Factory",
".",
"getTang",
"(",
")",
".",
"newInjector",
"(",
"comma... | copy the parameters from the command line required for the Client configuration. | [
"copy",
"the",
"parameters",
"from",
"the",
"command",
"line",
"required",
"for",
"the",
"Client",
"configuration",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/group/broadcast/BroadcastREEF.java#L93-L99 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/MultiEncoder.java | MultiEncoder.encode | @Override
public byte[] encode(final T obj) {
final Encoder<T> encoder = (Encoder<T>) clazzToEncoderMap.get(obj.getClass());
if (encoder == null) {
throw new RemoteRuntimeException("Encoder for " + obj.getClass() + " not known.");
}
final WakeTuplePBuf.Builder tupleBuilder = WakeTuplePBuf.newBu... | java | @Override
public byte[] encode(final T obj) {
final Encoder<T> encoder = (Encoder<T>) clazzToEncoderMap.get(obj.getClass());
if (encoder == null) {
throw new RemoteRuntimeException("Encoder for " + obj.getClass() + " not known.");
}
final WakeTuplePBuf.Builder tupleBuilder = WakeTuplePBuf.newBu... | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"encode",
"(",
"final",
"T",
"obj",
")",
"{",
"final",
"Encoder",
"<",
"T",
">",
"encoder",
"=",
"(",
"Encoder",
"<",
"T",
">",
")",
"clazzToEncoderMap",
".",
"get",
"(",
"obj",
".",
"getClass",
"(",
")"... | Encodes an object to a byte array.
@param obj an object to be encoded | [
"Encodes",
"an",
"object",
"to",
"a",
"byte",
"array",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/MultiEncoder.java#L52-L63 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/serialization/NamingUnregisterRequestCodec.java | NamingUnregisterRequestCodec.encode | @Override
public byte[] encode(final NamingUnregisterRequest obj) {
final AvroNamingUnRegisterRequest result = AvroNamingUnRegisterRequest.newBuilder()
.setId(obj.getIdentifier().toString())
.build();
return AvroUtils.toBytes(result, AvroNamingUnRegisterRequest.class);
} | java | @Override
public byte[] encode(final NamingUnregisterRequest obj) {
final AvroNamingUnRegisterRequest result = AvroNamingUnRegisterRequest.newBuilder()
.setId(obj.getIdentifier().toString())
.build();
return AvroUtils.toBytes(result, AvroNamingUnRegisterRequest.class);
} | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"encode",
"(",
"final",
"NamingUnregisterRequest",
"obj",
")",
"{",
"final",
"AvroNamingUnRegisterRequest",
"result",
"=",
"AvroNamingUnRegisterRequest",
".",
"newBuilder",
"(",
")",
".",
"setId",
"(",
"obj",
".",
"ge... | Encodes the naming un-registration request to bytes.
@param obj the naming un-registration request
@return a byte array | [
"Encodes",
"the",
"naming",
"un",
"-",
"registration",
"request",
"to",
"bytes",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/serialization/NamingUnregisterRequestCodec.java#L50-L56 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/serialization/NamingUnregisterRequestCodec.java | NamingUnregisterRequestCodec.decode | @Override
public NamingUnregisterRequest decode(final byte[] buf) {
final AvroNamingUnRegisterRequest result = AvroUtils.fromBytes(buf, AvroNamingUnRegisterRequest.class);
return new NamingUnregisterRequest(factory.getNewInstance(result.getId().toString()));
} | java | @Override
public NamingUnregisterRequest decode(final byte[] buf) {
final AvroNamingUnRegisterRequest result = AvroUtils.fromBytes(buf, AvroNamingUnRegisterRequest.class);
return new NamingUnregisterRequest(factory.getNewInstance(result.getId().toString()));
} | [
"@",
"Override",
"public",
"NamingUnregisterRequest",
"decode",
"(",
"final",
"byte",
"[",
"]",
"buf",
")",
"{",
"final",
"AvroNamingUnRegisterRequest",
"result",
"=",
"AvroUtils",
".",
"fromBytes",
"(",
"buf",
",",
"AvroNamingUnRegisterRequest",
".",
"class",
")"... | Decodes the bytes to a naming un-registration request.
@param buf the byte array
@return a naming un-registration request
@throws org.apache.reef.io.network.naming.exception.NamingRuntimeException | [
"Decodes",
"the",
"bytes",
"to",
"a",
"naming",
"un",
"-",
"registration",
"request",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/serialization/NamingUnregisterRequestCodec.java#L65-L69 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/HeartBeatManager.java | HeartBeatManager.sendTaskStatus | public synchronized void sendTaskStatus(final ReefServiceProtos.TaskStatusProto taskStatusProto) {
this.sendHeartBeat(this.getEvaluatorHeartbeatProto(
this.evaluatorRuntime.get().getEvaluatorStatus(),
this.contextManager.get().getContextStatusCollection(),
Optional.of(taskStatusProto)));
} | java | public synchronized void sendTaskStatus(final ReefServiceProtos.TaskStatusProto taskStatusProto) {
this.sendHeartBeat(this.getEvaluatorHeartbeatProto(
this.evaluatorRuntime.get().getEvaluatorStatus(),
this.contextManager.get().getContextStatusCollection(),
Optional.of(taskStatusProto)));
} | [
"public",
"synchronized",
"void",
"sendTaskStatus",
"(",
"final",
"ReefServiceProtos",
".",
"TaskStatusProto",
"taskStatusProto",
")",
"{",
"this",
".",
"sendHeartBeat",
"(",
"this",
".",
"getEvaluatorHeartbeatProto",
"(",
"this",
".",
"evaluatorRuntime",
".",
"get",
... | Called with a specific TaskStatus that must be delivered to the driver. | [
"Called",
"with",
"a",
"specific",
"TaskStatus",
"that",
"must",
"be",
"delivered",
"to",
"the",
"driver",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/HeartBeatManager.java#L82-L87 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/HeartBeatManager.java | HeartBeatManager.sendContextStatus | public synchronized void sendContextStatus(
final ReefServiceProtos.ContextStatusProto contextStatusProto) {
// TODO[JIRA REEF-833]: Write a test that verifies correct order of heartbeats.
final Collection<ReefServiceProtos.ContextStatusProto> contextStatusList = new ArrayList<>();
contextStatusList.... | java | public synchronized void sendContextStatus(
final ReefServiceProtos.ContextStatusProto contextStatusProto) {
// TODO[JIRA REEF-833]: Write a test that verifies correct order of heartbeats.
final Collection<ReefServiceProtos.ContextStatusProto> contextStatusList = new ArrayList<>();
contextStatusList.... | [
"public",
"synchronized",
"void",
"sendContextStatus",
"(",
"final",
"ReefServiceProtos",
".",
"ContextStatusProto",
"contextStatusProto",
")",
"{",
"// TODO[JIRA REEF-833]: Write a test that verifies correct order of heartbeats.",
"final",
"Collection",
"<",
"ReefServiceProtos",
"... | Called with a specific ContextStatus that must be delivered to the driver. | [
"Called",
"with",
"a",
"specific",
"ContextStatus",
"that",
"must",
"be",
"delivered",
"to",
"the",
"driver",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/HeartBeatManager.java#L92-L106 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/HeartBeatManager.java | HeartBeatManager.sendEvaluatorStatus | public synchronized void sendEvaluatorStatus(
final ReefServiceProtos.EvaluatorStatusProto evaluatorStatusProto) {
this.sendHeartBeat(EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto.newBuilder()
.setTimestamp(System.currentTimeMillis())
.setEvaluatorStatus(evaluatorStatusProto)
.build... | java | public synchronized void sendEvaluatorStatus(
final ReefServiceProtos.EvaluatorStatusProto evaluatorStatusProto) {
this.sendHeartBeat(EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto.newBuilder()
.setTimestamp(System.currentTimeMillis())
.setEvaluatorStatus(evaluatorStatusProto)
.build... | [
"public",
"synchronized",
"void",
"sendEvaluatorStatus",
"(",
"final",
"ReefServiceProtos",
".",
"EvaluatorStatusProto",
"evaluatorStatusProto",
")",
"{",
"this",
".",
"sendHeartBeat",
"(",
"EvaluatorRuntimeProtocol",
".",
"EvaluatorHeartbeatProto",
".",
"newBuilder",
"(",
... | Called with a specific EvaluatorStatus that must be delivered to the driver. | [
"Called",
"with",
"a",
"specific",
"EvaluatorStatus",
"that",
"must",
"be",
"delivered",
"to",
"the",
"driver",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/HeartBeatManager.java#L111-L117 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/HeartBeatManager.java | HeartBeatManager.sendHeartBeat | private synchronized void sendHeartBeat(
final EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto heartbeatProto) {
if (LOG.isLoggable(Level.FINEST)) {
LOG.log(Level.FINEST, "Heartbeat message:\n" + heartbeatProto, new Exception("Stack trace"));
}
this.evaluatorHeartbeatHandler.onNext(heartbeatPro... | java | private synchronized void sendHeartBeat(
final EvaluatorRuntimeProtocol.EvaluatorHeartbeatProto heartbeatProto) {
if (LOG.isLoggable(Level.FINEST)) {
LOG.log(Level.FINEST, "Heartbeat message:\n" + heartbeatProto, new Exception("Stack trace"));
}
this.evaluatorHeartbeatHandler.onNext(heartbeatPro... | [
"private",
"synchronized",
"void",
"sendHeartBeat",
"(",
"final",
"EvaluatorRuntimeProtocol",
".",
"EvaluatorHeartbeatProto",
"heartbeatProto",
")",
"{",
"if",
"(",
"LOG",
".",
"isLoggable",
"(",
"Level",
".",
"FINEST",
")",
")",
"{",
"LOG",
".",
"log",
"(",
"... | Sends the actual heartbeat out and logs it, if so desired.
@param heartbeatProto | [
"Sends",
"the",
"actual",
"heartbeat",
"out",
"and",
"logs",
"it",
"if",
"so",
"desired",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/HeartBeatManager.java#L124-L130 | train |
apache/reef | lang/java/reef-runtime-multi/src/main/java/org/apache/reef/runtime/multi/driver/RuntimesHost.java | RuntimesHost.initialize | private synchronized void initialize() {
if (this.runtimes != null) {
return;
}
this.runtimes = new HashMap<>();
for (final AvroRuntimeDefinition rd : runtimeDefinition.getRuntimes()) {
try {
// We need to create different injector for each runtime as they define conflicting bind... | java | private synchronized void initialize() {
if (this.runtimes != null) {
return;
}
this.runtimes = new HashMap<>();
for (final AvroRuntimeDefinition rd : runtimeDefinition.getRuntimes()) {
try {
// We need to create different injector for each runtime as they define conflicting bind... | [
"private",
"synchronized",
"void",
"initialize",
"(",
")",
"{",
"if",
"(",
"this",
".",
"runtimes",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"this",
".",
"runtimes",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"AvroRuntimeDefini... | Initializes the configured runtimes. | [
"Initializes",
"the",
"configured",
"runtimes",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-multi/src/main/java/org/apache/reef/runtime/multi/driver/RuntimesHost.java#L80-L116 | train |
apache/reef | lang/java/reef-runtime-multi/src/main/java/org/apache/reef/runtime/multi/driver/RuntimesHost.java | RuntimesHost.initializeInjector | private void initializeInjector(final Injector runtimeInjector) throws InjectionException {
copyEventHandler(runtimeInjector, RuntimeParameters.ResourceStatusHandler.class);
copyEventHandler(runtimeInjector, RuntimeParameters.NodeDescriptorHandler.class);
copyEventHandler(runtimeInjector, RuntimeParameters... | java | private void initializeInjector(final Injector runtimeInjector) throws InjectionException {
copyEventHandler(runtimeInjector, RuntimeParameters.ResourceStatusHandler.class);
copyEventHandler(runtimeInjector, RuntimeParameters.NodeDescriptorHandler.class);
copyEventHandler(runtimeInjector, RuntimeParameters... | [
"private",
"void",
"initializeInjector",
"(",
"final",
"Injector",
"runtimeInjector",
")",
"throws",
"InjectionException",
"{",
"copyEventHandler",
"(",
"runtimeInjector",
",",
"RuntimeParameters",
".",
"ResourceStatusHandler",
".",
"class",
")",
";",
"copyEventHandler",
... | Initializes injector by copying needed handlers.
@param runtimeInjector The injector to initialize
@throws InjectionException on configuration error. | [
"Initializes",
"injector",
"by",
"copying",
"needed",
"handlers",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-multi/src/main/java/org/apache/reef/runtime/multi/driver/RuntimesHost.java#L136-L149 | train |
apache/reef | lang/java/reef-runtime-multi/src/main/java/org/apache/reef/runtime/multi/driver/RuntimesHost.java | RuntimesHost.getRuntime | private Runtime getRuntime(final String requestedRuntimeName) {
final String runtimeName =
StringUtils.isBlank(requestedRuntimeName) ? this.defaultRuntimeName : requestedRuntimeName;
final Runtime runtime = this.runtimes.get(runtimeName);
Validate.notNull(runtime, "Couldn't find runtime for name "... | java | private Runtime getRuntime(final String requestedRuntimeName) {
final String runtimeName =
StringUtils.isBlank(requestedRuntimeName) ? this.defaultRuntimeName : requestedRuntimeName;
final Runtime runtime = this.runtimes.get(runtimeName);
Validate.notNull(runtime, "Couldn't find runtime for name "... | [
"private",
"Runtime",
"getRuntime",
"(",
"final",
"String",
"requestedRuntimeName",
")",
"{",
"final",
"String",
"runtimeName",
"=",
"StringUtils",
".",
"isBlank",
"(",
"requestedRuntimeName",
")",
"?",
"this",
".",
"defaultRuntimeName",
":",
"requestedRuntimeName",
... | Retrieves requested runtime, if requested name is empty a default runtime will be used.
@param requestedRuntimeName the requested runtime name
@return The runtime | [
"Retrieves",
"requested",
"runtime",
"if",
"requested",
"name",
"is",
"empty",
"a",
"default",
"runtime",
"will",
"be",
"used",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-multi/src/main/java/org/apache/reef/runtime/multi/driver/RuntimesHost.java#L156-L165 | train |
apache/reef | lang/java/reef-runtime-mock/src/main/java/org/apache/reef/mock/driver/runtime/MockClock.java | MockClock.advanceClock | public void advanceClock(final int offset) {
this.currentTime += offset;
final Iterator<Alarm> iter = this.alarmList.iterator();
while (iter.hasNext()) {
final Alarm alarm = iter.next();
if (alarm.getTimestamp() <= this.currentTime) {
alarm.run();
iter.remove();
}
}
} | java | public void advanceClock(final int offset) {
this.currentTime += offset;
final Iterator<Alarm> iter = this.alarmList.iterator();
while (iter.hasNext()) {
final Alarm alarm = iter.next();
if (alarm.getTimestamp() <= this.currentTime) {
alarm.run();
iter.remove();
}
}
} | [
"public",
"void",
"advanceClock",
"(",
"final",
"int",
"offset",
")",
"{",
"this",
".",
"currentTime",
"+=",
"offset",
";",
"final",
"Iterator",
"<",
"Alarm",
">",
"iter",
"=",
"this",
".",
"alarmList",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it... | Advances the clock by the offset amount.
@param offset amount to advance clock | [
"Advances",
"the",
"clock",
"by",
"the",
"offset",
"amount",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-mock/src/main/java/org/apache/reef/mock/driver/runtime/MockClock.java#L62-L72 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/library/ShellTask.java | ShellTask.call | @Override
public byte[] call(final byte[] memento) {
LOG.log(Level.INFO, "RUN: command: {0}", this.command);
final String result = CommandUtils.runCommand(this.command);
LOG.log(Level.INFO, "RUN: result: {0}", result);
return CODEC.encode(result);
} | java | @Override
public byte[] call(final byte[] memento) {
LOG.log(Level.INFO, "RUN: command: {0}", this.command);
final String result = CommandUtils.runCommand(this.command);
LOG.log(Level.INFO, "RUN: result: {0}", result);
return CODEC.encode(result);
} | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"call",
"(",
"final",
"byte",
"[",
"]",
"memento",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"RUN: command: {0}\"",
",",
"this",
".",
"command",
")",
";",
"final",
"String",
"result",
... | Execute the shell command and return the result, which is sent back to
the JobDriver and surfaced in the CompletedTask object.
@param memento ignored.
@return byte string containing the stdout from executing the shell command. | [
"Execute",
"the",
"shell",
"command",
"and",
"return",
"the",
"result",
"which",
"is",
"sent",
"back",
"to",
"the",
"JobDriver",
"and",
"surfaced",
"in",
"the",
"CompletedTask",
"object",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/library/ShellTask.java#L67-L73 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorControlHandler.java | EvaluatorControlHandler.send | public synchronized void send(final EvaluatorRuntimeProtocol.EvaluatorControlProto evaluatorControlProto) {
if (!this.wrapped.isPresent()) {
throw new IllegalStateException("Trying to send an EvaluatorControlProto before the Evaluator ID is set.");
}
if (!this.stateManager.isRunning()) {
LOG.log... | java | public synchronized void send(final EvaluatorRuntimeProtocol.EvaluatorControlProto evaluatorControlProto) {
if (!this.wrapped.isPresent()) {
throw new IllegalStateException("Trying to send an EvaluatorControlProto before the Evaluator ID is set.");
}
if (!this.stateManager.isRunning()) {
LOG.log... | [
"public",
"synchronized",
"void",
"send",
"(",
"final",
"EvaluatorRuntimeProtocol",
".",
"EvaluatorControlProto",
"evaluatorControlProto",
")",
"{",
"if",
"(",
"!",
"this",
".",
"wrapped",
".",
"isPresent",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateExceptio... | Send the evaluatorControlProto to the Evaluator.
@param evaluatorControlProto
@throws java.lang.IllegalStateException if the remote ID hasn't been set via setRemoteID() prior to this call
@throws java.lang.IllegalStateException if the Evaluator isn't running. | [
"Send",
"the",
"evaluatorControlProto",
"to",
"the",
"Evaluator",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorControlHandler.java#L67-L78 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorControlHandler.java | EvaluatorControlHandler.setRemoteID | synchronized void setRemoteID(final String evaluatorRID) {
if (this.wrapped.isPresent()) {
throw new IllegalStateException("Trying to reset the evaluator ID. This isn't supported.");
} else {
LOG.log(Level.FINE, "Registering remoteId [{0}] for Evaluator [{1}]", new Object[]{evaluatorRID, evaluatorId... | java | synchronized void setRemoteID(final String evaluatorRID) {
if (this.wrapped.isPresent()) {
throw new IllegalStateException("Trying to reset the evaluator ID. This isn't supported.");
} else {
LOG.log(Level.FINE, "Registering remoteId [{0}] for Evaluator [{1}]", new Object[]{evaluatorRID, evaluatorId... | [
"synchronized",
"void",
"setRemoteID",
"(",
"final",
"String",
"evaluatorRID",
")",
"{",
"if",
"(",
"this",
".",
"wrapped",
".",
"isPresent",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Trying to reset the evaluator ID. This isn't supported.\"... | Set the remote ID used to communicate with this Evaluator.
@param evaluatorRID
@throws java.lang.IllegalStateException if the remote ID has been set before. | [
"Set",
"the",
"remote",
"ID",
"used",
"to",
"communicate",
"with",
"this",
"Evaluator",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorControlHandler.java#L86-L94 | train |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/ReefEventStateManager.java | ReefEventStateManager.convertTime | private String convertTime(final long time) {
final Date date = new Date(time);
return FORMAT.format(date);
} | java | private String convertTime(final long time) {
final Date date = new Date(time);
return FORMAT.format(date);
} | [
"private",
"String",
"convertTime",
"(",
"final",
"long",
"time",
")",
"{",
"final",
"Date",
"date",
"=",
"new",
"Date",
"(",
"time",
")",
";",
"return",
"FORMAT",
".",
"format",
"(",
"date",
")",
";",
"}"
] | convert time from long to formatted string.
@param time
@return | [
"convert",
"time",
"from",
"long",
"to",
"formatted",
"string",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/ReefEventStateManager.java#L127-L130 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/uploader/JobUploader.java | JobUploader.createJobFolderWithApplicationId | public JobFolder createJobFolderWithApplicationId(final String applicationId) throws IOException {
final Path jobFolderPath = jobSubmissionDirectoryProvider.getJobSubmissionDirectoryPath(applicationId);
final String finalJobFolderPath = jobFolderPath.toString();
LOG.log(Level.FINE, "Final job submission Dir... | java | public JobFolder createJobFolderWithApplicationId(final String applicationId) throws IOException {
final Path jobFolderPath = jobSubmissionDirectoryProvider.getJobSubmissionDirectoryPath(applicationId);
final String finalJobFolderPath = jobFolderPath.toString();
LOG.log(Level.FINE, "Final job submission Dir... | [
"public",
"JobFolder",
"createJobFolderWithApplicationId",
"(",
"final",
"String",
"applicationId",
")",
"throws",
"IOException",
"{",
"final",
"Path",
"jobFolderPath",
"=",
"jobSubmissionDirectoryProvider",
".",
"getJobSubmissionDirectoryPath",
"(",
"applicationId",
")",
"... | Creates the Job folder on the DFS.
@param applicationId
@return a reference to the JobFolder that can be used to upload files to it.
@throws IOException | [
"Creates",
"the",
"Job",
"folder",
"on",
"the",
"DFS",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/uploader/JobUploader.java#L54-L59 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/uploader/JobUploader.java | JobUploader.createJobFolder | public JobFolder createJobFolder(final String finalJobFolderPath) throws IOException {
LOG.log(Level.FINE, "Final job submission Directory: " + finalJobFolderPath);
return new JobFolder(this.fileSystem, new Path(finalJobFolderPath));
} | java | public JobFolder createJobFolder(final String finalJobFolderPath) throws IOException {
LOG.log(Level.FINE, "Final job submission Directory: " + finalJobFolderPath);
return new JobFolder(this.fileSystem, new Path(finalJobFolderPath));
} | [
"public",
"JobFolder",
"createJobFolder",
"(",
"final",
"String",
"finalJobFolderPath",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"Final job submission Directory: \"",
"+",
"finalJobFolderPath",
")",
";",
"return",
"new"... | Convenience override for int ids.
@param finalJobFolderPath
@return
@throws IOException | [
"Convenience",
"override",
"for",
"int",
"ids",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/uploader/JobUploader.java#L69-L72 | train |
apache/reef | lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/evaluator/EvaluatorShim.java | EvaluatorShim.onNext | @Override
public void onNext(final RemoteMessage<EvaluatorShimProtocol.EvaluatorShimControlProto> remoteMessage) {
final EvaluatorShimProtocol.EvaluatorShimCommand command = remoteMessage.getMessage().getCommand();
switch (command) {
case LAUNCH_EVALUATOR:
LOG.log(Level.INFO, "Received a command to ... | java | @Override
public void onNext(final RemoteMessage<EvaluatorShimProtocol.EvaluatorShimControlProto> remoteMessage) {
final EvaluatorShimProtocol.EvaluatorShimCommand command = remoteMessage.getMessage().getCommand();
switch (command) {
case LAUNCH_EVALUATOR:
LOG.log(Level.INFO, "Received a command to ... | [
"@",
"Override",
"public",
"void",
"onNext",
"(",
"final",
"RemoteMessage",
"<",
"EvaluatorShimProtocol",
".",
"EvaluatorShimControlProto",
">",
"remoteMessage",
")",
"{",
"final",
"EvaluatorShimProtocol",
".",
"EvaluatorShimCommand",
"command",
"=",
"remoteMessage",
".... | This method is invoked by the Remote Manager when a command message from the Driver is received.
@param remoteMessage the message sent to the evaluator shim by the Driver. | [
"This",
"method",
"is",
"invoked",
"by",
"the",
"Remote",
"Manager",
"when",
"a",
"command",
"message",
"from",
"the",
"Driver",
"is",
"received",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/evaluator/EvaluatorShim.java#L134-L164 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/NameRegistryClient.java | NameRegistryClient.unregister | @Override
public void unregister(final Identifier id) throws IOException {
final Link<NamingMessage> link = transport.open(serverSocketAddr, codec,
new LoggingLinkListener<NamingMessage>());
link.write(new NamingUnregisterRequest(id));
} | java | @Override
public void unregister(final Identifier id) throws IOException {
final Link<NamingMessage> link = transport.open(serverSocketAddr, codec,
new LoggingLinkListener<NamingMessage>());
link.write(new NamingUnregisterRequest(id));
} | [
"@",
"Override",
"public",
"void",
"unregister",
"(",
"final",
"Identifier",
"id",
")",
"throws",
"IOException",
"{",
"final",
"Link",
"<",
"NamingMessage",
">",
"link",
"=",
"transport",
".",
"open",
"(",
"serverSocketAddr",
",",
"codec",
",",
"new",
"Loggi... | Unregisters an identifier.
@param id an identifier | [
"Unregisters",
"an",
"identifier",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/NameRegistryClient.java#L158-L163 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/uploader/JobFolder.java | JobFolder.upload | public Path upload(final File localFile) throws IOException {
if (!localFile.exists()) {
throw new FileNotFoundException(localFile.getAbsolutePath());
}
final Path source = new Path(localFile.getAbsolutePath());
final Path destination = new Path(this.path, localFile.getName());
try {
... | java | public Path upload(final File localFile) throws IOException {
if (!localFile.exists()) {
throw new FileNotFoundException(localFile.getAbsolutePath());
}
final Path source = new Path(localFile.getAbsolutePath());
final Path destination = new Path(this.path, localFile.getName());
try {
... | [
"public",
"Path",
"upload",
"(",
"final",
"File",
"localFile",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"localFile",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"FileNotFoundException",
"(",
"localFile",
".",
"getAbsolutePath",
"(",
")",
"... | Upload given file to the DFS.
@param localFile File on local FS to upload to the (remote) DFS.
@return the Path representing the file on the DFS.
@throws IOException if unable to upload the file or local file cannot be read. | [
"Upload",
"given",
"file",
"to",
"the",
"DFS",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/uploader/JobFolder.java#L65-L84 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/uploader/JobFolder.java | JobFolder.uploadAsLocalResource | public LocalResource uploadAsLocalResource(final File localFile, final LocalResourceType type) throws IOException {
final Path remoteFile = upload(localFile);
return getLocalResourceForPath(remoteFile, type);
} | java | public LocalResource uploadAsLocalResource(final File localFile, final LocalResourceType type) throws IOException {
final Path remoteFile = upload(localFile);
return getLocalResourceForPath(remoteFile, type);
} | [
"public",
"LocalResource",
"uploadAsLocalResource",
"(",
"final",
"File",
"localFile",
",",
"final",
"LocalResourceType",
"type",
")",
"throws",
"IOException",
"{",
"final",
"Path",
"remoteFile",
"=",
"upload",
"(",
"localFile",
")",
";",
"return",
"getLocalResource... | Shortcut to first upload the file and then form a LocalResource for the YARN submission.
@param localFile File on local FS to upload to the (remote) DFS.
@return an instance of a LocalResource on (remote) DFS.
@throws IOException if unable to upload the file or local file cannot be read. | [
"Shortcut",
"to",
"first",
"upload",
"the",
"file",
"and",
"then",
"form",
"a",
"LocalResource",
"for",
"the",
"YARN",
"submission",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/uploader/JobFolder.java#L92-L95 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/ObjectSerializableCodec.java | ObjectSerializableCodec.encode | @Override
public byte[] encode(final T obj) {
try (final ByteArrayOutputStream bos = new ByteArrayOutputStream();
final ObjectOutputStream out = new ObjectOutputStream(bos)) {
out.writeObject(obj);
return bos.toByteArray();
} catch (final IOException ex) {
throw new RemoteRuntimeExc... | java | @Override
public byte[] encode(final T obj) {
try (final ByteArrayOutputStream bos = new ByteArrayOutputStream();
final ObjectOutputStream out = new ObjectOutputStream(bos)) {
out.writeObject(obj);
return bos.toByteArray();
} catch (final IOException ex) {
throw new RemoteRuntimeExc... | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"encode",
"(",
"final",
"T",
"obj",
")",
"{",
"try",
"(",
"final",
"ByteArrayOutputStream",
"bos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"final",
"ObjectOutputStream",
"out",
"=",
"new",
"ObjectOutpu... | Encodes the object to bytes.
@param obj the object
@return bytes
@throws RemoteRuntimeException | [
"Encodes",
"the",
"object",
"to",
"bytes",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/ObjectSerializableCodec.java#L45-L54 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/ObjectSerializableCodec.java | ObjectSerializableCodec.decode | @SuppressWarnings("unchecked")
@Override
public T decode(final byte[] buf) {
try (final ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buf))) {
return (T) in.readObject();
} catch (final ClassNotFoundException | IOException ex) {
throw new RemoteRuntimeException(ex);
}... | java | @SuppressWarnings("unchecked")
@Override
public T decode(final byte[] buf) {
try (final ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buf))) {
return (T) in.readObject();
} catch (final ClassNotFoundException | IOException ex) {
throw new RemoteRuntimeException(ex);
}... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"public",
"T",
"decode",
"(",
"final",
"byte",
"[",
"]",
"buf",
")",
"{",
"try",
"(",
"final",
"ObjectInputStream",
"in",
"=",
"new",
"ObjectInputStream",
"(",
"new",
"ByteArrayInputStream",
... | Decodes an object from the bytes.
@param buf the bytes
@return an object
@throws RemoteRuntimeException | [
"Decodes",
"an",
"object",
"from",
"the",
"bytes",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/ObjectSerializableCodec.java#L63-L71 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/client/SchedulerREEFYarn.java | SchedulerREEFYarn.main | public static void main(final String[] args)
throws InjectionException, IOException, ParseException {
final Configuration runtimeConfiguration =
YarnClientConfiguration.CONF.build();
runTaskScheduler(runtimeConfiguration, args);
} | java | public static void main(final String[] args)
throws InjectionException, IOException, ParseException {
final Configuration runtimeConfiguration =
YarnClientConfiguration.CONF.build();
runTaskScheduler(runtimeConfiguration, args);
} | [
"public",
"static",
"void",
"main",
"(",
"final",
"String",
"[",
"]",
"args",
")",
"throws",
"InjectionException",
",",
"IOException",
",",
"ParseException",
"{",
"final",
"Configuration",
"runtimeConfiguration",
"=",
"YarnClientConfiguration",
".",
"CONF",
".",
"... | Launch the scheduler with YARN client configuration.
@param args
@throws InjectionException
@throws java.io.IOException | [
"Launch",
"the",
"scheduler",
"with",
"YARN",
"client",
"configuration",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/client/SchedulerREEFYarn.java#L40-L45 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/util/EnvironmentUtils.java | EnvironmentUtils.getAllClasspathJars | public static Set<String> getAllClasspathJars(final String... excludeEnv) {
final Set<String> jars = new HashSet<>();
final Set<Path> excludePaths = new HashSet<>();
for (final String env : excludeEnv) {
final String path = System.getenv(env);
if (null != path) {
final File file = new ... | java | public static Set<String> getAllClasspathJars(final String... excludeEnv) {
final Set<String> jars = new HashSet<>();
final Set<Path> excludePaths = new HashSet<>();
for (final String env : excludeEnv) {
final String path = System.getenv(env);
if (null != path) {
final File file = new ... | [
"public",
"static",
"Set",
"<",
"String",
">",
"getAllClasspathJars",
"(",
"final",
"String",
"...",
"excludeEnv",
")",
"{",
"final",
"Set",
"<",
"String",
">",
"jars",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"final",
"Set",
"<",
"Path",
">",
"excl... | Get a set of all classpath entries EXCEPT of those under excludeEnv directories.
Every excludeEnv entry is an environment variable name.
@param excludeEnv A set of environments to be excluded.
@return A set of classpath entries as strings. | [
"Get",
"a",
"set",
"of",
"all",
"classpath",
"entries",
"EXCEPT",
"of",
"those",
"under",
"excludeEnv",
"directories",
".",
"Every",
"excludeEnv",
"entry",
"is",
"an",
"environment",
"variable",
"name",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/util/EnvironmentUtils.java#L62-L98 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/idle/DriverIdleManager.java | DriverIdleManager.onPotentiallyIdle | public synchronized void onPotentiallyIdle(final IdleMessage reason) {
final DriverStatusManager driverStatusManagerImpl = this.driverStatusManager.get();
if (driverStatusManagerImpl.isClosing()) {
LOG.log(IDLE_REASONS_LEVEL, "Ignoring idle call from [{0}] for reason [{1}]",
new Object[] {reas... | java | public synchronized void onPotentiallyIdle(final IdleMessage reason) {
final DriverStatusManager driverStatusManagerImpl = this.driverStatusManager.get();
if (driverStatusManagerImpl.isClosing()) {
LOG.log(IDLE_REASONS_LEVEL, "Ignoring idle call from [{0}] for reason [{1}]",
new Object[] {reas... | [
"public",
"synchronized",
"void",
"onPotentiallyIdle",
"(",
"final",
"IdleMessage",
"reason",
")",
"{",
"final",
"DriverStatusManager",
"driverStatusManagerImpl",
"=",
"this",
".",
"driverStatusManager",
".",
"get",
"(",
")",
";",
"if",
"(",
"driverStatusManagerImpl",... | Check whether all Driver components are idle, and initiate driver shutdown if they are.
@param reason An indication whether the component is idle, along with a descriptive message. | [
"Check",
"whether",
"all",
"Driver",
"components",
"are",
"idle",
"and",
"initiate",
"driver",
"shutdown",
"if",
"they",
"are",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/idle/DriverIdleManager.java#L55-L86 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/implementation/protobuf/ProtocolBufferClassHierarchy.java | ProtocolBufferClassHierarchy.serialize | public static void serialize(final File file, final ClassHierarchy classHierarchy) throws IOException {
final ClassHierarchyProto.Node node = serializeNode(classHierarchy.getNamespace());
try (final FileOutputStream output = new FileOutputStream(file)) {
try (final DataOutputStream dos = new DataOutputStr... | java | public static void serialize(final File file, final ClassHierarchy classHierarchy) throws IOException {
final ClassHierarchyProto.Node node = serializeNode(classHierarchy.getNamespace());
try (final FileOutputStream output = new FileOutputStream(file)) {
try (final DataOutputStream dos = new DataOutputStr... | [
"public",
"static",
"void",
"serialize",
"(",
"final",
"File",
"file",
",",
"final",
"ClassHierarchy",
"classHierarchy",
")",
"throws",
"IOException",
"{",
"final",
"ClassHierarchyProto",
".",
"Node",
"node",
"=",
"serializeNode",
"(",
"classHierarchy",
".",
"getN... | serialize a class hierarchy into a file.
@param file
@param classHierarchy
@throws IOException
@deprecated in 0.12. Use AvroClassHierarchySerializer instead | [
"serialize",
"a",
"class",
"hierarchy",
"into",
"a",
"file",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/implementation/protobuf/ProtocolBufferClassHierarchy.java#L221-L228 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/FirstFitSchedulingPolicy.java | FirstFitSchedulingPolicy.trySchedule | @Override
public Optional<String> trySchedule(final Tasklet tasklet) {
for (int i = 0; i < idList.size(); i++) {
final int index = (nextIndex + i) % idList.size();
final String workerId = idList.get(index);
if (idLoadMap.get(workerId) < workerCapacity) {
nextIndex = (index + 1) % ... | java | @Override
public Optional<String> trySchedule(final Tasklet tasklet) {
for (int i = 0; i < idList.size(); i++) {
final int index = (nextIndex + i) % idList.size();
final String workerId = idList.get(index);
if (idLoadMap.get(workerId) < workerCapacity) {
nextIndex = (index + 1) % ... | [
"@",
"Override",
"public",
"Optional",
"<",
"String",
">",
"trySchedule",
"(",
"final",
"Tasklet",
"tasklet",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"idList",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"final",
"int",
"i... | Checking from nextIndex, choose the first worker that fits to schedule the tasklet onto.
@param tasklet to schedule
@return the next worker that has enough resources for the tasklet | [
"Checking",
"from",
"nextIndex",
"choose",
"the",
"first",
"worker",
"that",
"fits",
"to",
"schedule",
"the",
"tasklet",
"onto",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/FirstFitSchedulingPolicy.java#L66-L78 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/VortexLauncher.java | VortexLauncher.launchLocal | public static LauncherStatus launchLocal(final VortexJobConf vortexConf) {
final Configuration runtimeConf = LocalRuntimeConfiguration.CONF
.set(LocalRuntimeConfiguration.MAX_NUMBER_OF_EVALUATORS, MAX_NUMBER_OF_EVALUATORS)
.build();
return launch(runtimeConf, vortexConf.getConfiguration());
} | java | public static LauncherStatus launchLocal(final VortexJobConf vortexConf) {
final Configuration runtimeConf = LocalRuntimeConfiguration.CONF
.set(LocalRuntimeConfiguration.MAX_NUMBER_OF_EVALUATORS, MAX_NUMBER_OF_EVALUATORS)
.build();
return launch(runtimeConf, vortexConf.getConfiguration());
} | [
"public",
"static",
"LauncherStatus",
"launchLocal",
"(",
"final",
"VortexJobConf",
"vortexConf",
")",
"{",
"final",
"Configuration",
"runtimeConf",
"=",
"LocalRuntimeConfiguration",
".",
"CONF",
".",
"set",
"(",
"LocalRuntimeConfiguration",
".",
"MAX_NUMBER_OF_EVALUATORS... | Launch a Vortex job using the local runtime. | [
"Launch",
"a",
"Vortex",
"job",
"using",
"the",
"local",
"runtime",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/VortexLauncher.java#L41-L46 | train |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/JettyHandler.java | JettyHandler.handle | @Override
public void handle(
final String target,
final HttpServletRequest request,
final HttpServletResponse response,
final int i)
throws IOException, ServletException {
LOG.log(Level.INFO, "JettyHandler handle is entered with target: {0} ", target);
final Request baseRequest... | java | @Override
public void handle(
final String target,
final HttpServletRequest request,
final HttpServletResponse response,
final int i)
throws IOException, ServletException {
LOG.log(Level.INFO, "JettyHandler handle is entered with target: {0} ", target);
final Request baseRequest... | [
"@",
"Override",
"public",
"void",
"handle",
"(",
"final",
"String",
"target",
",",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
",",
"final",
"int",
"i",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"... | handle http request.
@param target
@param request
@param response
@param i
@throws IOException
@throws ServletException | [
"handle",
"http",
"request",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/JettyHandler.java#L73-L98 | train |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/JettyHandler.java | JettyHandler.validate | private HttpHandler validate(final HttpServletRequest request,
final HttpServletResponse response,
final ParsedHttpRequest parsedHttpRequest) throws IOException, ServletException {
final String specification = parsedHttpRequest.getTargetSpecification();
... | java | private HttpHandler validate(final HttpServletRequest request,
final HttpServletResponse response,
final ParsedHttpRequest parsedHttpRequest) throws IOException, ServletException {
final String specification = parsedHttpRequest.getTargetSpecification();
... | [
"private",
"HttpHandler",
"validate",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
",",
"final",
"ParsedHttpRequest",
"parsedHttpRequest",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"final",
"String",
"... | Validate request and get http handler for the request.
@param request
@param response
@return
@throws IOException
@throws ServletException | [
"Validate",
"request",
"and",
"get",
"http",
"handler",
"for",
"the",
"request",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/JettyHandler.java#L109-L132 | train |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/JettyHandler.java | JettyHandler.writeMessage | private void writeMessage(final HttpServletResponse response, final String message, final int status)
throws IOException {
response.getWriter().println(message);
response.setStatus(status);
} | java | private void writeMessage(final HttpServletResponse response, final String message, final int status)
throws IOException {
response.getWriter().println(message);
response.setStatus(status);
} | [
"private",
"void",
"writeMessage",
"(",
"final",
"HttpServletResponse",
"response",
",",
"final",
"String",
"message",
",",
"final",
"int",
"status",
")",
"throws",
"IOException",
"{",
"response",
".",
"getWriter",
"(",
")",
".",
"println",
"(",
"message",
")"... | process write message and status on the response.
@param response
@param message
@param status
@throws IOException | [
"process",
"write",
"message",
"and",
"status",
"on",
"the",
"response",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/JettyHandler.java#L142-L146 | train |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/JettyHandler.java | JettyHandler.addHandler | final void addHandler(final HttpHandler handler) {
if (handler != null) {
if (!eventHandlers.containsKey(handler.getUriSpecification().toLowerCase())) {
eventHandlers.put(handler.getUriSpecification().toLowerCase(), handler);
} else {
LOG.log(Level.WARNING, "JettyHandler handle is alread... | java | final void addHandler(final HttpHandler handler) {
if (handler != null) {
if (!eventHandlers.containsKey(handler.getUriSpecification().toLowerCase())) {
eventHandlers.put(handler.getUriSpecification().toLowerCase(), handler);
} else {
LOG.log(Level.WARNING, "JettyHandler handle is alread... | [
"final",
"void",
"addHandler",
"(",
"final",
"HttpHandler",
"handler",
")",
"{",
"if",
"(",
"handler",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"eventHandlers",
".",
"containsKey",
"(",
"handler",
".",
"getUriSpecification",
"(",
")",
".",
"toLowerCase",
"(... | Add a handler explicitly instead of through injection. This is for handlers created on the fly.
@param handler | [
"Add",
"a",
"handler",
"explicitly",
"instead",
"of",
"through",
"injection",
".",
"This",
"is",
"for",
"handlers",
"created",
"on",
"the",
"fly",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/JettyHandler.java#L153-L161 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/suspend/SuspendClient.java | SuspendClient.waitForCompletion | public void waitForCompletion() throws Exception {
LOG.info("Waiting for the Job Driver to complete.");
try {
synchronized (this) {
this.wait();
}
} catch (final InterruptedException ex) {
LOG.log(Level.WARNING, "Waiting for result interrupted.", ex);
}
this.reef.close();
... | java | public void waitForCompletion() throws Exception {
LOG.info("Waiting for the Job Driver to complete.");
try {
synchronized (this) {
this.wait();
}
} catch (final InterruptedException ex) {
LOG.log(Level.WARNING, "Waiting for result interrupted.", ex);
}
this.reef.close();
... | [
"public",
"void",
"waitForCompletion",
"(",
")",
"throws",
"Exception",
"{",
"LOG",
".",
"info",
"(",
"\"Waiting for the Job Driver to complete.\"",
")",
";",
"try",
"{",
"synchronized",
"(",
"this",
")",
"{",
"this",
".",
"wait",
"(",
")",
";",
"}",
"}",
... | Wait for the job to complete. | [
"Wait",
"for",
"the",
"job",
"to",
"complete",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/suspend/SuspendClient.java#L109-L120 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/RemoteSenderStage.java | RemoteSenderStage.getHandler | public <T> EventHandler<RemoteEvent<T>> getHandler() {
return new RemoteSenderEventHandler<T>(encoder, transport, executor);
} | java | public <T> EventHandler<RemoteEvent<T>> getHandler() {
return new RemoteSenderEventHandler<T>(encoder, transport, executor);
} | [
"public",
"<",
"T",
">",
"EventHandler",
"<",
"RemoteEvent",
"<",
"T",
">",
">",
"getHandler",
"(",
")",
"{",
"return",
"new",
"RemoteSenderEventHandler",
"<",
"T",
">",
"(",
"encoder",
",",
"transport",
",",
"executor",
")",
";",
"}"
] | Returns a new remote sender event handler.
@return a remote sender event handler | [
"Returns",
"a",
"new",
"remote",
"sender",
"event",
"handler",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/RemoteSenderStage.java#L68-L70 | train |
apache/reef | lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/storage/AzureStorageClient.java | AzureStorageClient.uploadFile | public URI uploadFile(final String jobFolder, final File file) throws IOException {
LOG.log(Level.INFO, "Uploading [{0}] to [{1}]", new Object[]{file, jobFolder});
try {
final CloudBlobClient cloudBlobClient = this.cloudBlobClientProvider.getCloudBlobClient();
final CloudBlobContainer container = ... | java | public URI uploadFile(final String jobFolder, final File file) throws IOException {
LOG.log(Level.INFO, "Uploading [{0}] to [{1}]", new Object[]{file, jobFolder});
try {
final CloudBlobClient cloudBlobClient = this.cloudBlobClientProvider.getCloudBlobClient();
final CloudBlobContainer container = ... | [
"public",
"URI",
"uploadFile",
"(",
"final",
"String",
"jobFolder",
",",
"final",
"File",
"file",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"Uploading [{0}] to [{1}]\"",
",",
"new",
"Object",
"[",
"]",
"{",
"fi... | Upload a file to the storage account.
@param jobFolder the path to the destination folder within storage container.
@param file the source file.
@return the SAS URI to the uploaded file.
@throws IOException | [
"Upload",
"a",
"file",
"to",
"the",
"storage",
"account",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/storage/AzureStorageClient.java#L97-L118 | train |
apache/reef | lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloCLR.java | HelloCLR.addAll | private static ConfigurationModule addAll(final ConfigurationModule conf,
final OptionalParameter<String> param,
final File folder) {
ConfigurationModule result = conf;
final File[] files = folder.listFiles();
if (files ... | java | private static ConfigurationModule addAll(final ConfigurationModule conf,
final OptionalParameter<String> param,
final File folder) {
ConfigurationModule result = conf;
final File[] files = folder.listFiles();
if (files ... | [
"private",
"static",
"ConfigurationModule",
"addAll",
"(",
"final",
"ConfigurationModule",
"conf",
",",
"final",
"OptionalParameter",
"<",
"String",
">",
"param",
",",
"final",
"File",
"folder",
")",
"{",
"ConfigurationModule",
"result",
"=",
"conf",
";",
"final",... | 1000 sec. | [
"1000",
"sec",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloCLR.java#L54-L67 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnDriverRuntimeRestartManager.java | YarnDriverRuntimeRestartManager.getResubmissionAttempts | @Override
public int getResubmissionAttempts() {
final String containerIdString = YarnUtilities.getContainerIdString();
final ApplicationAttemptId appAttemptID = YarnUtilities.getAppAttemptId(containerIdString);
if (containerIdString == null || appAttemptID == null) {
LOG.log(Level.WARNING, "Was no... | java | @Override
public int getResubmissionAttempts() {
final String containerIdString = YarnUtilities.getContainerIdString();
final ApplicationAttemptId appAttemptID = YarnUtilities.getAppAttemptId(containerIdString);
if (containerIdString == null || appAttemptID == null) {
LOG.log(Level.WARNING, "Was no... | [
"@",
"Override",
"public",
"int",
"getResubmissionAttempts",
"(",
")",
"{",
"final",
"String",
"containerIdString",
"=",
"YarnUtilities",
".",
"getContainerIdString",
"(",
")",
";",
"final",
"ApplicationAttemptId",
"appAttemptID",
"=",
"YarnUtilities",
".",
"getAppAtt... | Determines the number of times the Driver has been submitted based on the container ID environment
variable provided by YARN. If that fails, determine whether the application master is a restart
based on the number of previous containers reported by YARN. In the failure scenario, returns 1 if restart, 0
otherwise.
@ret... | [
"Determines",
"the",
"number",
"of",
"times",
"the",
"Driver",
"has",
"been",
"submitted",
"based",
"on",
"the",
"container",
"ID",
"environment",
"variable",
"provided",
"by",
"YARN",
".",
"If",
"that",
"fails",
"determine",
"whether",
"the",
"application",
"... | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnDriverRuntimeRestartManager.java#L91-L115 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnDriverRuntimeRestartManager.java | YarnDriverRuntimeRestartManager.initializeListOfPreviousContainers | private synchronized void initializeListOfPreviousContainers() {
if (this.previousContainers == null) {
final List<Container> yarnPrevContainers =
this.registration.getRegistration().getContainersFromPreviousAttempts();
// If it's still null, create an empty list to indicate that it's not a r... | java | private synchronized void initializeListOfPreviousContainers() {
if (this.previousContainers == null) {
final List<Container> yarnPrevContainers =
this.registration.getRegistration().getContainersFromPreviousAttempts();
// If it's still null, create an empty list to indicate that it's not a r... | [
"private",
"synchronized",
"void",
"initializeListOfPreviousContainers",
"(",
")",
"{",
"if",
"(",
"this",
".",
"previousContainers",
"==",
"null",
")",
"{",
"final",
"List",
"<",
"Container",
">",
"yarnPrevContainers",
"=",
"this",
".",
"registration",
".",
"ge... | Initializes the list of previous containers as reported by YARN. | [
"Initializes",
"the",
"list",
"of",
"previous",
"containers",
"as",
"reported",
"by",
"YARN",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnDriverRuntimeRestartManager.java#L130-L144 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnDriverRuntimeRestartManager.java | YarnDriverRuntimeRestartManager.informAboutEvaluatorFailures | @Override
public void informAboutEvaluatorFailures(final Set<String> evaluatorIds) {
for (String evaluatorId : evaluatorIds) {
LOG.log(Level.WARNING, "Container [" + evaluatorId +
"] has failed during driver restart process, FailedEvaluatorHandler will be triggered, but " +
"no additiona... | java | @Override
public void informAboutEvaluatorFailures(final Set<String> evaluatorIds) {
for (String evaluatorId : evaluatorIds) {
LOG.log(Level.WARNING, "Container [" + evaluatorId +
"] has failed during driver restart process, FailedEvaluatorHandler will be triggered, but " +
"no additiona... | [
"@",
"Override",
"public",
"void",
"informAboutEvaluatorFailures",
"(",
"final",
"Set",
"<",
"String",
">",
"evaluatorIds",
")",
"{",
"for",
"(",
"String",
"evaluatorId",
":",
"evaluatorIds",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
... | Calls the appropriate handler via REEFEventHandlers, which is a runtime specific implementation
of the YARN runtime.
@param evaluatorIds the set of evaluator IDs of failed evaluators during restart. | [
"Calls",
"the",
"appropriate",
"handler",
"via",
"REEFEventHandlers",
"which",
"is",
"a",
"runtime",
"specific",
"implementation",
"of",
"the",
"YARN",
"runtime",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnDriverRuntimeRestartManager.java#L223-L237 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/examples/hello/HelloVortexStart.java | HelloVortexStart.start | @Override
public void start(final VortexThreadPool vortexThreadPool) {
final VortexFuture future = vortexThreadPool.submit(new HelloVortexFunction(), null);
try {
future.get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
} | java | @Override
public void start(final VortexThreadPool vortexThreadPool) {
final VortexFuture future = vortexThreadPool.submit(new HelloVortexFunction(), null);
try {
future.get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
} | [
"@",
"Override",
"public",
"void",
"start",
"(",
"final",
"VortexThreadPool",
"vortexThreadPool",
")",
"{",
"final",
"VortexFuture",
"future",
"=",
"vortexThreadPool",
".",
"submit",
"(",
"new",
"HelloVortexFunction",
"(",
")",
",",
"null",
")",
";",
"try",
"{... | Run the function. | [
"Run",
"the",
"function",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/examples/hello/HelloVortexStart.java#L39-L47 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java | ContextRepresenters.getContext | public synchronized EvaluatorContext getContext(final String contextId) {
for (final EvaluatorContext context : this.contextStack) {
if (context.getId().equals(contextId)) {
return context;
}
}
throw new RuntimeException("Unknown evaluator context " + contextId);
} | java | public synchronized EvaluatorContext getContext(final String contextId) {
for (final EvaluatorContext context : this.contextStack) {
if (context.getId().equals(contextId)) {
return context;
}
}
throw new RuntimeException("Unknown evaluator context " + contextId);
} | [
"public",
"synchronized",
"EvaluatorContext",
"getContext",
"(",
"final",
"String",
"contextId",
")",
"{",
"for",
"(",
"final",
"EvaluatorContext",
"context",
":",
"this",
".",
"contextStack",
")",
"{",
"if",
"(",
"context",
".",
"getId",
"(",
")",
".",
"equ... | Fetch the context with the given ID.
@param contextId
@return | [
"Fetch",
"the",
"context",
"with",
"the",
"given",
"ID",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java#L74-L81 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java | ContextRepresenters.getFailedContextsForEvaluatorFailure | public synchronized List<FailedContext> getFailedContextsForEvaluatorFailure() {
final List<FailedContext> failedContextList = new ArrayList<>();
final List<EvaluatorContext> activeContexts = new ArrayList<>(this.contextStack);
Collections.reverse(activeContexts);
for (final EvaluatorContext context : ... | java | public synchronized List<FailedContext> getFailedContextsForEvaluatorFailure() {
final List<FailedContext> failedContextList = new ArrayList<>();
final List<EvaluatorContext> activeContexts = new ArrayList<>(this.contextStack);
Collections.reverse(activeContexts);
for (final EvaluatorContext context : ... | [
"public",
"synchronized",
"List",
"<",
"FailedContext",
">",
"getFailedContextsForEvaluatorFailure",
"(",
")",
"{",
"final",
"List",
"<",
"FailedContext",
">",
"failedContextList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"List",
"<",
"EvaluatorConte... | Create the failed contexts for a FailedEvaluator event.
@return | [
"Create",
"the",
"failed",
"contexts",
"for",
"a",
"FailedEvaluator",
"event",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java#L88-L97 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java | ContextRepresenters.onContextStatusMessages | public synchronized void onContextStatusMessages(final Iterable<ContextStatusPOJO>
contextStatusPOJOs,
final boolean notifyClientOnNewActiveContext) {
for (final ContextStatusPOJO contextStatus : contextStatusP... | java | public synchronized void onContextStatusMessages(final Iterable<ContextStatusPOJO>
contextStatusPOJOs,
final boolean notifyClientOnNewActiveContext) {
for (final ContextStatusPOJO contextStatus : contextStatusP... | [
"public",
"synchronized",
"void",
"onContextStatusMessages",
"(",
"final",
"Iterable",
"<",
"ContextStatusPOJO",
">",
"contextStatusPOJOs",
",",
"final",
"boolean",
"notifyClientOnNewActiveContext",
")",
"{",
"for",
"(",
"final",
"ContextStatusPOJO",
"contextStatus",
":",... | Process heartbeats from the contexts on an Evaluator.
@param contextStatusPOJOs
@param notifyClientOnNewActiveContext | [
"Process",
"heartbeats",
"from",
"the",
"contexts",
"on",
"an",
"Evaluator",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java#L105-L111 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java | ContextRepresenters.onContextStatusMessage | private synchronized void onContextStatusMessage(final ContextStatusPOJO contextStatus,
final boolean notifyClientOnNewActiveContext) {
LOG.log(Level.FINER, "Processing context status message for context {0}", contextStatus.getContextId());
switch (contextStat... | java | private synchronized void onContextStatusMessage(final ContextStatusPOJO contextStatus,
final boolean notifyClientOnNewActiveContext) {
LOG.log(Level.FINER, "Processing context status message for context {0}", contextStatus.getContextId());
switch (contextStat... | [
"private",
"synchronized",
"void",
"onContextStatusMessage",
"(",
"final",
"ContextStatusPOJO",
"contextStatus",
",",
"final",
"boolean",
"notifyClientOnNewActiveContext",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINER",
",",
"\"Processing context status message f... | Process a heartbeat from a context.
@param contextStatus
@param notifyClientOnNewActiveContext | [
"Process",
"a",
"heartbeat",
"from",
"a",
"context",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java#L120-L140 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java | ContextRepresenters.onContextReady | private synchronized void onContextReady(final ContextStatusPOJO contextStatus,
final boolean notifyClientOnNewActiveContext) {
assert ContextState.READY == contextStatus.getContextState();
final String contextID = contextStatus.getContextId();
// This could be the... | java | private synchronized void onContextReady(final ContextStatusPOJO contextStatus,
final boolean notifyClientOnNewActiveContext) {
assert ContextState.READY == contextStatus.getContextState();
final String contextID = contextStatus.getContextId();
// This could be the... | [
"private",
"synchronized",
"void",
"onContextReady",
"(",
"final",
"ContextStatusPOJO",
"contextStatus",
",",
"final",
"boolean",
"notifyClientOnNewActiveContext",
")",
"{",
"assert",
"ContextState",
".",
"READY",
"==",
"contextStatus",
".",
"getContextState",
"(",
")",... | Process a message with status READY from a context.
@param contextStatus
@param notifyClientOnNewActiveContext whether or not to inform the application when this in fact refers to a new
context. | [
"Process",
"a",
"message",
"with",
"status",
"READY",
"from",
"a",
"context",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java#L187-L205 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java | ContextRepresenters.onNewContext | private synchronized void onNewContext(final ContextStatusPOJO contextStatus,
final boolean notifyClientOnNewActiveContext) {
final String contextID = contextStatus.getContextId();
LOG.log(Level.FINE, "Adding new context {0}.", contextID);
final Optional<String> par... | java | private synchronized void onNewContext(final ContextStatusPOJO contextStatus,
final boolean notifyClientOnNewActiveContext) {
final String contextID = contextStatus.getContextId();
LOG.log(Level.FINE, "Adding new context {0}.", contextID);
final Optional<String> par... | [
"private",
"synchronized",
"void",
"onNewContext",
"(",
"final",
"ContextStatusPOJO",
"contextStatus",
",",
"final",
"boolean",
"notifyClientOnNewActiveContext",
")",
"{",
"final",
"String",
"contextID",
"=",
"contextStatus",
".",
"getContextId",
"(",
")",
";",
"LOG",... | Create and add a new context representer.
@param contextStatus the message to create the context from
@param notifyClientOnNewActiveContext whether or not to fire an event to the user. | [
"Create",
"and",
"add",
"a",
"new",
"context",
"representer",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java#L213-L232 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java | ContextRepresenters.addContext | private synchronized void addContext(final EvaluatorContext context) {
this.contextStack.add(context);
this.contextIds.add(context.getId());
} | java | private synchronized void addContext(final EvaluatorContext context) {
this.contextStack.add(context);
this.contextIds.add(context.getId());
} | [
"private",
"synchronized",
"void",
"addContext",
"(",
"final",
"EvaluatorContext",
"context",
")",
"{",
"this",
".",
"contextStack",
".",
"add",
"(",
"context",
")",
";",
"this",
".",
"contextIds",
".",
"add",
"(",
"context",
".",
"getId",
"(",
")",
")",
... | Add the given context to the data structures.
@param context | [
"Add",
"the",
"given",
"context",
"to",
"the",
"data",
"structures",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java#L239-L242 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java | ContextRepresenters.removeContext | private synchronized void removeContext(final EvaluatorContext context) {
this.contextStack.remove(context);
this.contextIds.remove(context.getId());
} | java | private synchronized void removeContext(final EvaluatorContext context) {
this.contextStack.remove(context);
this.contextIds.remove(context.getId());
} | [
"private",
"synchronized",
"void",
"removeContext",
"(",
"final",
"EvaluatorContext",
"context",
")",
"{",
"this",
".",
"contextStack",
".",
"remove",
"(",
"context",
")",
";",
"this",
".",
"contextIds",
".",
"remove",
"(",
"context",
".",
"getId",
"(",
")",... | Remove the given context from the data structures.
@param context | [
"Remove",
"the",
"given",
"context",
"from",
"the",
"data",
"structures",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/context/ContextRepresenters.java#L249-L252 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/impl/LoggingUtils.java | LoggingUtils.setLoggingLevel | public static void setLoggingLevel(final Level level) {
final Handler[] handlers = Logger.getLogger("").getHandlers();
ConsoleHandler ch = null;
for (final Handler h : handlers) {
if (h instanceof ConsoleHandler) {
ch = (ConsoleHandler) h;
break;
}
}
if (ch == null) {
... | java | public static void setLoggingLevel(final Level level) {
final Handler[] handlers = Logger.getLogger("").getHandlers();
ConsoleHandler ch = null;
for (final Handler h : handlers) {
if (h instanceof ConsoleHandler) {
ch = (ConsoleHandler) h;
break;
}
}
if (ch == null) {
... | [
"public",
"static",
"void",
"setLoggingLevel",
"(",
"final",
"Level",
"level",
")",
"{",
"final",
"Handler",
"[",
"]",
"handlers",
"=",
"Logger",
".",
"getLogger",
"(",
"\"\"",
")",
".",
"getHandlers",
"(",
")",
";",
"ConsoleHandler",
"ch",
"=",
"null",
... | Sets the logging level.
@param level the logging level | [
"Sets",
"the",
"logging",
"level",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/impl/LoggingUtils.java#L36-L51 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManagerFactory.java | EvaluatorManagerFactory.getNewEvaluatorManagerInstance | private EvaluatorManager getNewEvaluatorManagerInstance(final String id, final EvaluatorDescriptor desc) {
LOG.log(Level.FINEST, "Creating Evaluator Manager for Evaluator ID {0}", id);
final Injector child = this.injector.forkInjector();
try {
child.bindVolatileParameter(EvaluatorManager.EvaluatorIde... | java | private EvaluatorManager getNewEvaluatorManagerInstance(final String id, final EvaluatorDescriptor desc) {
LOG.log(Level.FINEST, "Creating Evaluator Manager for Evaluator ID {0}", id);
final Injector child = this.injector.forkInjector();
try {
child.bindVolatileParameter(EvaluatorManager.EvaluatorIde... | [
"private",
"EvaluatorManager",
"getNewEvaluatorManagerInstance",
"(",
"final",
"String",
"id",
",",
"final",
"EvaluatorDescriptor",
"desc",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Creating Evaluator Manager for Evaluator ID {0}\"",
",",
"id",
... | Helper method to create a new EvaluatorManager instance.
@param id identifier of the Evaluator
@param desc NodeDescriptor on which the Evaluator executes.
@return a new EvaluatorManager instance. | [
"Helper",
"method",
"to",
"create",
"a",
"new",
"EvaluatorManager",
"instance",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManagerFactory.java#L100-L118 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManagerFactory.java | EvaluatorManagerFactory.getNewEvaluatorManagerForNewEvaluator | public EvaluatorManager getNewEvaluatorManagerForNewEvaluator(
final ResourceAllocationEvent resourceAllocationEvent) {
final EvaluatorManager evaluatorManager = getNewEvaluatorManagerInstanceForResource(resourceAllocationEvent);
evaluatorManager.fireEvaluatorAllocatedEvent();
return evaluatorManager... | java | public EvaluatorManager getNewEvaluatorManagerForNewEvaluator(
final ResourceAllocationEvent resourceAllocationEvent) {
final EvaluatorManager evaluatorManager = getNewEvaluatorManagerInstanceForResource(resourceAllocationEvent);
evaluatorManager.fireEvaluatorAllocatedEvent();
return evaluatorManager... | [
"public",
"EvaluatorManager",
"getNewEvaluatorManagerForNewEvaluator",
"(",
"final",
"ResourceAllocationEvent",
"resourceAllocationEvent",
")",
"{",
"final",
"EvaluatorManager",
"evaluatorManager",
"=",
"getNewEvaluatorManagerInstanceForResource",
"(",
"resourceAllocationEvent",
")",... | Instantiates a new EvaluatorManager based on a resource allocation.
Fires the EvaluatorAllocatedEvent.
@param resourceAllocationEvent
@return an EvaluatorManager for the newly allocated Evaluator. | [
"Instantiates",
"a",
"new",
"EvaluatorManager",
"based",
"on",
"a",
"resource",
"allocation",
".",
"Fires",
"the",
"EvaluatorAllocatedEvent",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManagerFactory.java#L127-L133 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManagerFactory.java | EvaluatorManagerFactory.getNewEvaluatorManagerForEvaluatorFailedDuringDriverRestart | public EvaluatorManager getNewEvaluatorManagerForEvaluatorFailedDuringDriverRestart(
final ResourceStatusEvent resourceStatusEvent) {
return getNewEvaluatorManagerInstance(resourceStatusEvent.getIdentifier(),
this.evaluatorDescriptorBuilderFactory.newBuilder()
.setMemory(128)
.... | java | public EvaluatorManager getNewEvaluatorManagerForEvaluatorFailedDuringDriverRestart(
final ResourceStatusEvent resourceStatusEvent) {
return getNewEvaluatorManagerInstance(resourceStatusEvent.getIdentifier(),
this.evaluatorDescriptorBuilderFactory.newBuilder()
.setMemory(128)
.... | [
"public",
"EvaluatorManager",
"getNewEvaluatorManagerForEvaluatorFailedDuringDriverRestart",
"(",
"final",
"ResourceStatusEvent",
"resourceStatusEvent",
")",
"{",
"return",
"getNewEvaluatorManagerInstance",
"(",
"resourceStatusEvent",
".",
"getIdentifier",
"(",
")",
",",
"this",
... | Instantiates a new EvaluatorManager for a failed evaluator during driver restart.
Does not fire an EvaluatorAllocatedEvent.
@param resourceStatusEvent
@return an EvaluatorManager for the user to call fail on. | [
"Instantiates",
"a",
"new",
"EvaluatorManager",
"for",
"a",
"failed",
"evaluator",
"during",
"driver",
"restart",
".",
"Does",
"not",
"fire",
"an",
"EvaluatorAllocatedEvent",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManagerFactory.java#L141-L150 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizConfigVisitor.java | GraphvizConfigVisitor.getGraphvizString | public static String getGraphvizString(final Configuration config,
final boolean showImpl, final boolean showLegend) {
final GraphvizConfigVisitor visitor = new GraphvizConfigVisitor(config, showImpl, showLegend);
final Node root = config.getClassHierarchy().getNamespace... | java | public static String getGraphvizString(final Configuration config,
final boolean showImpl, final boolean showLegend) {
final GraphvizConfigVisitor visitor = new GraphvizConfigVisitor(config, showImpl, showLegend);
final Node root = config.getClassHierarchy().getNamespace... | [
"public",
"static",
"String",
"getGraphvizString",
"(",
"final",
"Configuration",
"config",
",",
"final",
"boolean",
"showImpl",
",",
"final",
"boolean",
"showLegend",
")",
"{",
"final",
"GraphvizConfigVisitor",
"visitor",
"=",
"new",
"GraphvizConfigVisitor",
"(",
"... | Produce a Graphviz DOT string for a given TANG configuration.
@param config TANG configuration object.
@param showImpl If true, plot IS-A edges for know implementations.
@param showLegend If true, add legend to the plot.
@return configuration graph represented as a string in Graphviz DOT format. | [
"Produce",
"a",
"Graphviz",
"DOT",
"string",
"for",
"a",
"given",
"TANG",
"configuration",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizConfigVisitor.java#L105-L111 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizConfigVisitor.java | GraphvizConfigVisitor.visit | @Override
public boolean visit(final ClassNode<?> node) {
this.graphStr
.append(" ")
.append(node.getName())
.append(" [label=\"")
.append(node.getName())
.append("\", shape=box")
// .append(config.isSingleton(node) ? ", style=filled" : "")
.append("];\... | java | @Override
public boolean visit(final ClassNode<?> node) {
this.graphStr
.append(" ")
.append(node.getName())
.append(" [label=\"")
.append(node.getName())
.append("\", shape=box")
// .append(config.isSingleton(node) ? ", style=filled" : "")
.append("];\... | [
"@",
"Override",
"public",
"boolean",
"visit",
"(",
"final",
"ClassNode",
"<",
"?",
">",
"node",
")",
"{",
"this",
".",
"graphStr",
".",
"append",
"(",
"\" \"",
")",
".",
"append",
"(",
"node",
".",
"getName",
"(",
")",
")",
".",
"append",
"(",
"\... | Process current class configuration node.
@param node Current configuration node.
@return true to proceed with the next node, false to cancel. | [
"Process",
"current",
"class",
"configuration",
"node",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizConfigVisitor.java#L127-L165 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizConfigVisitor.java | GraphvizConfigVisitor.visit | @Override
public boolean visit(final PackageNode node) {
if (!node.getName().isEmpty()) {
this.graphStr
.append(" ")
.append(node.getName())
.append(" [label=\"")
.append(node.getFullName())
.append("\", shape=folder];\n");
}
return true;
} | java | @Override
public boolean visit(final PackageNode node) {
if (!node.getName().isEmpty()) {
this.graphStr
.append(" ")
.append(node.getName())
.append(" [label=\"")
.append(node.getFullName())
.append("\", shape=folder];\n");
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"visit",
"(",
"final",
"PackageNode",
"node",
")",
"{",
"if",
"(",
"!",
"node",
".",
"getName",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"this",
".",
"graphStr",
".",
"append",
"(",
"\" \"",
")",
".",
"ap... | Process current package configuration node.
@param node Current configuration node.
@return true to proceed with the next node, false to cancel. | [
"Process",
"current",
"package",
"configuration",
"node",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizConfigVisitor.java#L173-L184 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizConfigVisitor.java | GraphvizConfigVisitor.visit | @Override
public boolean visit(final NamedParameterNode<?> node) {
this.graphStr
.append(" ")
.append(node.getName())
.append(" [label=\"")
.append(node.getSimpleArgName()) // parameter type, e.g. "Integer"
.append("\\n")
.append(node.getName()) ... | java | @Override
public boolean visit(final NamedParameterNode<?> node) {
this.graphStr
.append(" ")
.append(node.getName())
.append(" [label=\"")
.append(node.getSimpleArgName()) // parameter type, e.g. "Integer"
.append("\\n")
.append(node.getName()) ... | [
"@",
"Override",
"public",
"boolean",
"visit",
"(",
"final",
"NamedParameterNode",
"<",
"?",
">",
"node",
")",
"{",
"this",
".",
"graphStr",
".",
"append",
"(",
"\" \"",
")",
".",
"append",
"(",
"node",
".",
"getName",
"(",
")",
")",
".",
"append",
... | Process current configuration node for the named parameter.
@param node Current configuration node.
@return true to proceed with the next node, false to cancel. | [
"Process",
"current",
"configuration",
"node",
"for",
"the",
"named",
"parameter",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizConfigVisitor.java#L192-L207 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizConfigVisitor.java | GraphvizConfigVisitor.visit | @Override
public boolean visit(final Node nodeFrom, final Node nodeTo) {
if (!nodeFrom.getName().isEmpty()) {
this.graphStr
.append(" ")
.append(nodeFrom.getName())
.append(" -> ")
.append(nodeTo.getName())
.append(" [style=solid, dir=back, arrowtail=diamon... | java | @Override
public boolean visit(final Node nodeFrom, final Node nodeTo) {
if (!nodeFrom.getName().isEmpty()) {
this.graphStr
.append(" ")
.append(nodeFrom.getName())
.append(" -> ")
.append(nodeTo.getName())
.append(" [style=solid, dir=back, arrowtail=diamon... | [
"@",
"Override",
"public",
"boolean",
"visit",
"(",
"final",
"Node",
"nodeFrom",
",",
"final",
"Node",
"nodeTo",
")",
"{",
"if",
"(",
"!",
"nodeFrom",
".",
"getName",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"this",
".",
"graphStr",
".",
"append... | Process current edge of the configuration graph.
@param nodeFrom Current configuration node.
@param nodeTo Destination configuration node.
@return true to proceed with the next node, false to cancel. | [
"Process",
"current",
"edge",
"of",
"the",
"configuration",
"graph",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizConfigVisitor.java#L232-L243 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/data/loading/impl/AbstractEvaluatorToPartitionStrategy.java | AbstractEvaluatorToPartitionStrategy.init | private void init(final Map<DistributedDataSetPartition, InputSplit[]> splitsPerPartition) {
final Pair<InputSplit[], DistributedDataSetPartition[]>
splitsAndPartitions = getSplitsAndPartitions(splitsPerPartition);
final InputSplit[] splits = splitsAndPartitions.getFirst();... | java | private void init(final Map<DistributedDataSetPartition, InputSplit[]> splitsPerPartition) {
final Pair<InputSplit[], DistributedDataSetPartition[]>
splitsAndPartitions = getSplitsAndPartitions(splitsPerPartition);
final InputSplit[] splits = splitsAndPartitions.getFirst();... | [
"private",
"void",
"init",
"(",
"final",
"Map",
"<",
"DistributedDataSetPartition",
",",
"InputSplit",
"[",
"]",
">",
"splitsPerPartition",
")",
"{",
"final",
"Pair",
"<",
"InputSplit",
"[",
"]",
",",
"DistributedDataSetPartition",
"[",
"]",
">",
"splitsAndParti... | Initializes the locations of the splits where we'd like to be loaded into.
Sets all the splits to unallocated
@param splitsPerPartition
a map containing the input splits per data partition | [
"Initializes",
"the",
"locations",
"of",
"the",
"splits",
"where",
"we",
"d",
"like",
"to",
"be",
"loaded",
"into",
".",
"Sets",
"all",
"the",
"splits",
"to",
"unallocated"
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/data/loading/impl/AbstractEvaluatorToPartitionStrategy.java#L106-L125 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/data/loading/impl/AbstractEvaluatorToPartitionStrategy.java | AbstractEvaluatorToPartitionStrategy.allocateSplit | protected NumberedSplit<InputSplit> allocateSplit(final String evaluatorId,
final BlockingQueue<NumberedSplit<InputSplit>> value) {
if (value == null) {
LOG.log(Level.FINE, "Queue of splits can't be empty. Returning null");
return null;
}
while (true) {
final NumberedSplit<InputSplit... | java | protected NumberedSplit<InputSplit> allocateSplit(final String evaluatorId,
final BlockingQueue<NumberedSplit<InputSplit>> value) {
if (value == null) {
LOG.log(Level.FINE, "Queue of splits can't be empty. Returning null");
return null;
}
while (true) {
final NumberedSplit<InputSplit... | [
"protected",
"NumberedSplit",
"<",
"InputSplit",
">",
"allocateSplit",
"(",
"final",
"String",
"evaluatorId",
",",
"final",
"BlockingQueue",
"<",
"NumberedSplit",
"<",
"InputSplit",
">",
">",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"LO... | Allocates the first available split into the evaluator.
@param evaluatorId
the evaluator id
@param value
the queue of splits
@return a numberedSplit or null if it cannot find one | [
"Allocates",
"the",
"first",
"available",
"split",
"into",
"the",
"evaluator",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/data/loading/impl/AbstractEvaluatorToPartitionStrategy.java#L231-L253 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/resourcemanager/ResourceManagerStatus.java | ResourceManagerStatus.getIdleStatus | @Override
public synchronized IdleMessage getIdleStatus() {
if (this.isIdle()) {
return IDLE_MESSAGE;
}
final String message = String.format(
"There are %d outstanding container requests and %d allocated containers",
this.outstandingContainerRequests, this.containerAllocationCount)... | java | @Override
public synchronized IdleMessage getIdleStatus() {
if (this.isIdle()) {
return IDLE_MESSAGE;
}
final String message = String.format(
"There are %d outstanding container requests and %d allocated containers",
this.outstandingContainerRequests, this.containerAllocationCount)... | [
"@",
"Override",
"public",
"synchronized",
"IdleMessage",
"getIdleStatus",
"(",
")",
"{",
"if",
"(",
"this",
".",
"isIdle",
"(",
")",
")",
"{",
"return",
"IDLE_MESSAGE",
";",
"}",
"final",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"There ar... | Driver is idle if, regardless of status, it has no evaluators allocated
and no pending container requests. This method is used in the DriverIdleManager.
If all DriverIdlenessSource components are idle, DriverIdleManager will initiate Driver shutdown.
@return idle, if there are no outstanding requests or allocations. No... | [
"Driver",
"is",
"idle",
"if",
"regardless",
"of",
"status",
"it",
"has",
"no",
"evaluators",
"allocated",
"and",
"no",
"pending",
"container",
"requests",
".",
"This",
"method",
"is",
"used",
"in",
"the",
"DriverIdleManager",
".",
"If",
"all",
"DriverIdlenessS... | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/resourcemanager/ResourceManagerStatus.java#L127-L139 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/hello/HelloREEFEnvironment.java | HelloREEFEnvironment.main | public static void main(final String[] args) throws InjectionException {
try (final REEFEnvironment reef = REEFEnvironment.fromConfiguration(
LOCAL_DRIVER_MODULE, DRIVER_CONFIG, ENVIRONMENT_CONFIG)) {
reef.run();
final ReefServiceProtos.JobStatusProto status = reef.getLastStatus();
LOG.lo... | java | public static void main(final String[] args) throws InjectionException {
try (final REEFEnvironment reef = REEFEnvironment.fromConfiguration(
LOCAL_DRIVER_MODULE, DRIVER_CONFIG, ENVIRONMENT_CONFIG)) {
reef.run();
final ReefServiceProtos.JobStatusProto status = reef.getLastStatus();
LOG.lo... | [
"public",
"static",
"void",
"main",
"(",
"final",
"String",
"[",
"]",
"args",
")",
"throws",
"InjectionException",
"{",
"try",
"(",
"final",
"REEFEnvironment",
"reef",
"=",
"REEFEnvironment",
".",
"fromConfiguration",
"(",
"LOCAL_DRIVER_MODULE",
",",
"DRIVER_CONFI... | Start Hello REEF job with Driver and Client sharing the same process.
@param args command line parameters - not used.
@throws InjectionException configuration error. | [
"Start",
"Hello",
"REEF",
"job",
"with",
"Driver",
"and",
"Client",
"sharing",
"the",
"same",
"process",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hello/HelloREEFEnvironment.java#L72-L80 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/RemoteEventEncoder.java | RemoteEventEncoder.encode | @Override
public byte[] encode(final RemoteEvent<T> obj) {
if (obj.getEvent() == null) {
throw new RemoteRuntimeException("Event is null");
}
final WakeMessagePBuf.Builder builder = WakeMessagePBuf.newBuilder();
builder.setSeq(obj.getSeq());
builder.setData(ByteString.copyFrom(encoder.encod... | java | @Override
public byte[] encode(final RemoteEvent<T> obj) {
if (obj.getEvent() == null) {
throw new RemoteRuntimeException("Event is null");
}
final WakeMessagePBuf.Builder builder = WakeMessagePBuf.newBuilder();
builder.setSeq(obj.getSeq());
builder.setData(ByteString.copyFrom(encoder.encod... | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"encode",
"(",
"final",
"RemoteEvent",
"<",
"T",
">",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"getEvent",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"RemoteRuntimeException",
"(",
"\"Event is null\"",
... | Encodes the remote event object to bytes.
@param obj the remote event
@return bytes
@throws RemoteRuntimeException | [
"Encodes",
"the",
"remote",
"event",
"object",
"to",
"bytes",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/RemoteEventEncoder.java#L51-L62 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/data/loading/impl/AvroEvaluatorRequestSerializer.java | AvroEvaluatorRequestSerializer.fromString | public static EvaluatorRequest fromString(final String serializedRequest) {
try {
final Decoder decoder =
DecoderFactory.get().jsonDecoder(AvroEvaluatorRequest.getClassSchema(), serializedRequest);
final SpecificDatumReader<AvroEvaluatorRequest> reader = new SpecificDatumReader<>(AvroEvaluator... | java | public static EvaluatorRequest fromString(final String serializedRequest) {
try {
final Decoder decoder =
DecoderFactory.get().jsonDecoder(AvroEvaluatorRequest.getClassSchema(), serializedRequest);
final SpecificDatumReader<AvroEvaluatorRequest> reader = new SpecificDatumReader<>(AvroEvaluator... | [
"public",
"static",
"EvaluatorRequest",
"fromString",
"(",
"final",
"String",
"serializedRequest",
")",
"{",
"try",
"{",
"final",
"Decoder",
"decoder",
"=",
"DecoderFactory",
".",
"get",
"(",
")",
".",
"jsonDecoder",
"(",
"AvroEvaluatorRequest",
".",
"getClassSche... | Deserialize EvaluatorRequest. | [
"Deserialize",
"EvaluatorRequest",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/data/loading/impl/AvroEvaluatorRequestSerializer.java#L93-L102 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/examples/hello/HelloVortexFunction.java | HelloVortexFunction.call | @Override
public Void call(final Void input) throws Exception {
System.out.println("Hello, Vortex!");
return null;
} | java | @Override
public Void call(final Void input) throws Exception {
System.out.println("Hello, Vortex!");
return null;
} | [
"@",
"Override",
"public",
"Void",
"call",
"(",
"final",
"Void",
"input",
")",
"throws",
"Exception",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Hello, Vortex!\"",
")",
";",
"return",
"null",
";",
"}"
] | Prints to stdout. | [
"Prints",
"to",
"stdout",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/examples/hello/HelloVortexFunction.java#L30-L34 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/impl/DefaultThreadFactory.java | DefaultThreadFactory.newThread | @Override
public Thread newThread(final Runnable r) {
final Thread t = new Thread(this.group, r,
String.format("%s:thread-%03d", this.prefix, this.threadNumber.getAndIncrement()), 0);
if (t.isDaemon()) {
t.setDaemon(false);
}
if (t.getPriority() != Thread.NORM_PRIORITY) {
t.setP... | java | @Override
public Thread newThread(final Runnable r) {
final Thread t = new Thread(this.group, r,
String.format("%s:thread-%03d", this.prefix, this.threadNumber.getAndIncrement()), 0);
if (t.isDaemon()) {
t.setDaemon(false);
}
if (t.getPriority() != Thread.NORM_PRIORITY) {
t.setP... | [
"@",
"Override",
"public",
"Thread",
"newThread",
"(",
"final",
"Runnable",
"r",
")",
"{",
"final",
"Thread",
"t",
"=",
"new",
"Thread",
"(",
"this",
".",
"group",
",",
"r",
",",
"String",
".",
"format",
"(",
"\"%s:thread-%03d\"",
",",
"this",
".",
"pr... | Creates a new thread.
@param r the runnable | [
"Creates",
"a",
"new",
"thread",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/impl/DefaultThreadFactory.java#L73-L92 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/io/TcpPortConfigurationProvider.java | TcpPortConfigurationProvider.getConfiguration | @Override
public Configuration getConfiguration() {
return Tang.Factory.getTang().newConfigurationBuilder()
.bindNamedParameter(TcpPortRangeBegin.class, String.valueOf(portRangeBegin))
.bindNamedParameter(TcpPortRangeCount.class, String.valueOf(portRangeCount))
.bindNamedParameter(TcpPortR... | java | @Override
public Configuration getConfiguration() {
return Tang.Factory.getTang().newConfigurationBuilder()
.bindNamedParameter(TcpPortRangeBegin.class, String.valueOf(portRangeBegin))
.bindNamedParameter(TcpPortRangeCount.class, String.valueOf(portRangeCount))
.bindNamedParameter(TcpPortR... | [
"@",
"Override",
"public",
"Configuration",
"getConfiguration",
"(",
")",
"{",
"return",
"Tang",
".",
"Factory",
".",
"getTang",
"(",
")",
".",
"newConfigurationBuilder",
"(",
")",
".",
"bindNamedParameter",
"(",
"TcpPortRangeBegin",
".",
"class",
",",
"String",... | returns a configuration for the class that implements TcpPortProvider so that class can be instantiated.
somewhere else
@return Configuration. | [
"returns",
"a",
"configuration",
"for",
"the",
"class",
"that",
"implements",
"TcpPortProvider",
"so",
"that",
"class",
"can",
"be",
"instantiated",
".",
"somewhere",
"else"
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/io/TcpPortConfigurationProvider.java#L59-L67 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/DriverStatusManager.java | DriverStatusManager.onInit | public synchronized void onInit() {
LOG.entering(CLASS_NAME, "onInit");
this.clientConnection.send(this.getInitMessage());
this.setStatus(DriverStatus.INIT);
LOG.exiting(CLASS_NAME, "onInit");
} | java | public synchronized void onInit() {
LOG.entering(CLASS_NAME, "onInit");
this.clientConnection.send(this.getInitMessage());
this.setStatus(DriverStatus.INIT);
LOG.exiting(CLASS_NAME, "onInit");
} | [
"public",
"synchronized",
"void",
"onInit",
"(",
")",
"{",
"LOG",
".",
"entering",
"(",
"CLASS_NAME",
",",
"\"onInit\"",
")",
";",
"this",
".",
"clientConnection",
".",
"send",
"(",
"this",
".",
"getInitMessage",
"(",
")",
")",
";",
"this",
".",
"setStat... | Changes the driver status to INIT and sends message to the client about the transition. | [
"Changes",
"the",
"driver",
"status",
"to",
"INIT",
"and",
"sends",
"message",
"to",
"the",
"client",
"about",
"the",
"transition",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/DriverStatusManager.java#L81-L89 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/DriverStatusManager.java | DriverStatusManager.onError | public synchronized void onError(final Throwable exception) {
LOG.entering(CLASS_NAME, "onError", exception);
if (this.isClosing()) {
LOG.log(Level.WARNING, "Received an exception while already in shutdown.", exception);
} else {
LOG.log(Level.WARNING, "Shutting down the Driver with an excepti... | java | public synchronized void onError(final Throwable exception) {
LOG.entering(CLASS_NAME, "onError", exception);
if (this.isClosing()) {
LOG.log(Level.WARNING, "Received an exception while already in shutdown.", exception);
} else {
LOG.log(Level.WARNING, "Shutting down the Driver with an excepti... | [
"public",
"synchronized",
"void",
"onError",
"(",
"final",
"Throwable",
"exception",
")",
"{",
"LOG",
".",
"entering",
"(",
"CLASS_NAME",
",",
"\"onError\"",
",",
"exception",
")",
";",
"if",
"(",
"this",
".",
"isClosing",
"(",
")",
")",
"{",
"LOG",
".",... | End the Driver with an exception.
@param exception Exception that causes the driver shutdown. | [
"End",
"the",
"Driver",
"with",
"an",
"exception",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/DriverStatusManager.java#L113-L127 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/DriverStatusManager.java | DriverStatusManager.onComplete | public synchronized void onComplete() {
LOG.entering(CLASS_NAME, "onComplete");
if (this.isClosing()) {
LOG.log(Level.WARNING, "Ignoring second call to onComplete()",
new Exception("Dummy exception to get the call stack"));
} else {
LOG.log(Level.INFO, "Clean shutdown of the Driver.... | java | public synchronized void onComplete() {
LOG.entering(CLASS_NAME, "onComplete");
if (this.isClosing()) {
LOG.log(Level.WARNING, "Ignoring second call to onComplete()",
new Exception("Dummy exception to get the call stack"));
} else {
LOG.log(Level.INFO, "Clean shutdown of the Driver.... | [
"public",
"synchronized",
"void",
"onComplete",
"(",
")",
"{",
"LOG",
".",
"entering",
"(",
"CLASS_NAME",
",",
"\"onComplete\"",
")",
";",
"if",
"(",
"this",
".",
"isClosing",
"(",
")",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
... | Perform a clean shutdown of the Driver. | [
"Perform",
"a",
"clean",
"shutdown",
"of",
"the",
"Driver",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/DriverStatusManager.java#L132-L153 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/DriverStatusManager.java | DriverStatusManager.setStatus | private synchronized void setStatus(final DriverStatus toStatus) {
if (this.driverStatus.isLegalTransition(toStatus)) {
this.driverStatus = toStatus;
} else {
LOG.log(Level.WARNING, "Illegal state transition: {0} -> {1}", new Object[] {this.driverStatus, toStatus});
}
} | java | private synchronized void setStatus(final DriverStatus toStatus) {
if (this.driverStatus.isLegalTransition(toStatus)) {
this.driverStatus = toStatus;
} else {
LOG.log(Level.WARNING, "Illegal state transition: {0} -> {1}", new Object[] {this.driverStatus, toStatus});
}
} | [
"private",
"synchronized",
"void",
"setStatus",
"(",
"final",
"DriverStatus",
"toStatus",
")",
"{",
"if",
"(",
"this",
".",
"driverStatus",
".",
"isLegalTransition",
"(",
"toStatus",
")",
")",
"{",
"this",
".",
"driverStatus",
"=",
"toStatus",
";",
"}",
"els... | Helper method to set the status.
This also checks whether the transition from the current status to the new one is legal.
@param toStatus Driver status to transition to. | [
"Helper",
"method",
"to",
"set",
"the",
"status",
".",
"This",
"also",
"checks",
"whether",
"the",
"transition",
"from",
"the",
"current",
"status",
"to",
"the",
"new",
"one",
"is",
"legal",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/DriverStatusManager.java#L226-L232 | train |
apache/reef | lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/batch/TokenBatchCredentialProvider.java | TokenBatchCredentialProvider.getCredentials | @Override
public BatchCredentials getCredentials() {
final TokenCredentials tokenCredentials = new TokenCredentials(null, System.getenv(AZ_BATCH_AUTH_TOKEN_ENV));
return new BatchCredentials() {
@Override
public String baseUrl() {
return azureBatchAccountUri;
}
@Override
... | java | @Override
public BatchCredentials getCredentials() {
final TokenCredentials tokenCredentials = new TokenCredentials(null, System.getenv(AZ_BATCH_AUTH_TOKEN_ENV));
return new BatchCredentials() {
@Override
public String baseUrl() {
return azureBatchAccountUri;
}
@Override
... | [
"@",
"Override",
"public",
"BatchCredentials",
"getCredentials",
"(",
")",
"{",
"final",
"TokenCredentials",
"tokenCredentials",
"=",
"new",
"TokenCredentials",
"(",
"null",
",",
"System",
".",
"getenv",
"(",
"AZ_BATCH_AUTH_TOKEN_ENV",
")",
")",
";",
"return",
"ne... | Returns credentials for Azure Batch account.
@return an implementation of {@link BatchCredentials} which is based on the token provided by Azure Batch. | [
"Returns",
"credentials",
"for",
"Azure",
"Batch",
"account",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/batch/TokenBatchCredentialProvider.java#L52-L68 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/impl/NetworkConnectionServiceImpl.java | NetworkConnectionServiceImpl.openLink | <T> Link<NetworkConnectionServiceMessage<T>> openLink(
final Identifier connectionFactoryId, final Identifier remoteEndPointId) throws NetworkException {
final Identifier remoteId = getEndPointIdWithConnectionFactoryId(connectionFactoryId, remoteEndPointId);
try {
final SocketAddress address = nameR... | java | <T> Link<NetworkConnectionServiceMessage<T>> openLink(
final Identifier connectionFactoryId, final Identifier remoteEndPointId) throws NetworkException {
final Identifier remoteId = getEndPointIdWithConnectionFactoryId(connectionFactoryId, remoteEndPointId);
try {
final SocketAddress address = nameR... | [
"<",
"T",
">",
"Link",
"<",
"NetworkConnectionServiceMessage",
"<",
"T",
">",
">",
"openLink",
"(",
"final",
"Identifier",
"connectionFactoryId",
",",
"final",
"Identifier",
"remoteEndPointId",
")",
"throws",
"NetworkException",
"{",
"final",
"Identifier",
"remoteId... | Open a channel for destination identifier of NetworkConnectionService.
@param connectionFactoryId
@param remoteEndPointId
@throws NetworkException | [
"Open",
"a",
"channel",
"for",
"destination",
"identifier",
"of",
"NetworkConnectionService",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/impl/NetworkConnectionServiceImpl.java#L212-L224 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/impl/NetworkConnectionServiceImpl.java | NetworkConnectionServiceImpl.getConnectionFactory | @Override
public <T> ConnectionFactory<T> getConnectionFactory(final Identifier connFactoryId) {
final ConnectionFactory<T> connFactory = connFactoryMap.get(connFactoryId.toString());
if (connFactory == null) {
throw new RuntimeException("Cannot find ConnectionFactory of " + connFactoryId + ".");
}
... | java | @Override
public <T> ConnectionFactory<T> getConnectionFactory(final Identifier connFactoryId) {
final ConnectionFactory<T> connFactory = connFactoryMap.get(connFactoryId.toString());
if (connFactory == null) {
throw new RuntimeException("Cannot find ConnectionFactory of " + connFactoryId + ".");
}
... | [
"@",
"Override",
"public",
"<",
"T",
">",
"ConnectionFactory",
"<",
"T",
">",
"getConnectionFactory",
"(",
"final",
"Identifier",
"connFactoryId",
")",
"{",
"final",
"ConnectionFactory",
"<",
"T",
">",
"connFactory",
"=",
"connFactoryMap",
".",
"get",
"(",
"co... | Gets a ConnectionFactory.
@param connFactoryId the identifier of the ConnectionFactory | [
"Gets",
"a",
"ConnectionFactory",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/impl/NetworkConnectionServiceImpl.java#L237-L244 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/DefaultVortexMaster.java | DefaultVortexMaster.enqueueTasklet | @Override
public <TInput, TOutput> VortexFuture<TOutput>
enqueueTasklet(final VortexFunction<TInput, TOutput> function, final TInput input,
final Optional<FutureCallback<TOutput>> callback) {
// TODO[REEF-500]: Simple duplicate Vortex Tasklet launch.
final VortexFuture<TOutput> vort... | java | @Override
public <TInput, TOutput> VortexFuture<TOutput>
enqueueTasklet(final VortexFunction<TInput, TOutput> function, final TInput input,
final Optional<FutureCallback<TOutput>> callback) {
// TODO[REEF-500]: Simple duplicate Vortex Tasklet launch.
final VortexFuture<TOutput> vort... | [
"@",
"Override",
"public",
"<",
"TInput",
",",
"TOutput",
">",
"VortexFuture",
"<",
"TOutput",
">",
"enqueueTasklet",
"(",
"final",
"VortexFunction",
"<",
"TInput",
",",
"TOutput",
">",
"function",
",",
"final",
"TInput",
"input",
",",
"final",
"Optional",
"... | Add a new tasklet to pendingTasklets. | [
"Add",
"a",
"new",
"tasklet",
"to",
"pendingTasklets",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/DefaultVortexMaster.java#L66-L84 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/DefaultVortexMaster.java | DefaultVortexMaster.enqueueTasklets | @Override
public <TInput, TOutput> VortexAggregateFuture<TInput, TOutput>
enqueueTasklets(final VortexAggregateFunction<TOutput> aggregateFunction,
final VortexFunction<TInput, TOutput> vortexFunction,
final VortexAggregatePolicy policy,
final Li... | java | @Override
public <TInput, TOutput> VortexAggregateFuture<TInput, TOutput>
enqueueTasklets(final VortexAggregateFunction<TOutput> aggregateFunction,
final VortexFunction<TInput, TOutput> vortexFunction,
final VortexAggregatePolicy policy,
final Li... | [
"@",
"Override",
"public",
"<",
"TInput",
",",
"TOutput",
">",
"VortexAggregateFuture",
"<",
"TInput",
",",
"TOutput",
">",
"enqueueTasklets",
"(",
"final",
"VortexAggregateFunction",
"<",
"TOutput",
">",
"aggregateFunction",
",",
"final",
"VortexFunction",
"<",
"... | Add aggregate-able Tasklets to pendingTasklets. | [
"Add",
"aggregate",
"-",
"able",
"Tasklets",
"to",
"pendingTasklets",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/DefaultVortexMaster.java#L89-L121 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/DefaultVortexMaster.java | DefaultVortexMaster.workerPreempted | @Override
public void workerPreempted(final String id) {
final Optional<Collection<Tasklet>> preemptedTasklets = runningWorkers.removeWorker(id);
if (preemptedTasklets.isPresent()) {
for (final Tasklet tasklet : preemptedTasklets.get()) {
pendingTasklets.addFirst(tasklet);
}
}
} | java | @Override
public void workerPreempted(final String id) {
final Optional<Collection<Tasklet>> preemptedTasklets = runningWorkers.removeWorker(id);
if (preemptedTasklets.isPresent()) {
for (final Tasklet tasklet : preemptedTasklets.get()) {
pendingTasklets.addFirst(tasklet);
}
}
} | [
"@",
"Override",
"public",
"void",
"workerPreempted",
"(",
"final",
"String",
"id",
")",
"{",
"final",
"Optional",
"<",
"Collection",
"<",
"Tasklet",
">",
">",
"preemptedTasklets",
"=",
"runningWorkers",
".",
"removeWorker",
"(",
"id",
")",
";",
"if",
"(",
... | Remove the worker from runningWorkers and add back the lost tasklets to pendingTasklets. | [
"Remove",
"the",
"worker",
"from",
"runningWorkers",
"and",
"add",
"back",
"the",
"lost",
"tasklets",
"to",
"pendingTasklets",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/DefaultVortexMaster.java#L142-L150 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/DefaultVortexMaster.java | DefaultVortexMaster.putDelegate | private synchronized void putDelegate(final List<Tasklet> tasklets, final VortexFutureDelegate delegate) {
for (final Tasklet tasklet : tasklets) {
taskletFutureMap.put(tasklet.getId(), delegate);
}
} | java | private synchronized void putDelegate(final List<Tasklet> tasklets, final VortexFutureDelegate delegate) {
for (final Tasklet tasklet : tasklets) {
taskletFutureMap.put(tasklet.getId(), delegate);
}
} | [
"private",
"synchronized",
"void",
"putDelegate",
"(",
"final",
"List",
"<",
"Tasklet",
">",
"tasklets",
",",
"final",
"VortexFutureDelegate",
"delegate",
")",
"{",
"for",
"(",
"final",
"Tasklet",
"tasklet",
":",
"tasklets",
")",
"{",
"taskletFutureMap",
".",
... | Puts a delegate to associate with a Tasklet. | [
"Puts",
"a",
"delegate",
"to",
"associate",
"with",
"a",
"Tasklet",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/DefaultVortexMaster.java#L217-L221 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/DefaultVortexMaster.java | DefaultVortexMaster.fetchDelegate | private synchronized VortexFutureDelegate fetchDelegate(final List<Integer> taskletIds) {
VortexFutureDelegate delegate = null;
for (final int taskletId : taskletIds) {
final VortexFutureDelegate currDelegate = taskletFutureMap.remove(taskletId);
if (currDelegate == null) {
// TODO[JIRA REEF... | java | private synchronized VortexFutureDelegate fetchDelegate(final List<Integer> taskletIds) {
VortexFutureDelegate delegate = null;
for (final int taskletId : taskletIds) {
final VortexFutureDelegate currDelegate = taskletFutureMap.remove(taskletId);
if (currDelegate == null) {
// TODO[JIRA REEF... | [
"private",
"synchronized",
"VortexFutureDelegate",
"fetchDelegate",
"(",
"final",
"List",
"<",
"Integer",
">",
"taskletIds",
")",
"{",
"VortexFutureDelegate",
"delegate",
"=",
"null",
";",
"for",
"(",
"final",
"int",
"taskletId",
":",
"taskletIds",
")",
"{",
"fi... | Fetches a delegate that maps to the list of Tasklets. | [
"Fetches",
"a",
"delegate",
"that",
"maps",
"to",
"the",
"list",
"of",
"Tasklets",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/DefaultVortexMaster.java#L226-L243 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/GlobalJarUploader.java | GlobalJarUploader.makeGlobalJar | private File makeGlobalJar() throws IOException {
final File jarFile = new File(this.fileNames.getGlobalFolderName() + this.fileNames.getJarFileSuffix());
new JARFileMaker(jarFile).addChildren(this.fileNames.getGlobalFolder()).close();
return jarFile;
} | java | private File makeGlobalJar() throws IOException {
final File jarFile = new File(this.fileNames.getGlobalFolderName() + this.fileNames.getJarFileSuffix());
new JARFileMaker(jarFile).addChildren(this.fileNames.getGlobalFolder()).close();
return jarFile;
} | [
"private",
"File",
"makeGlobalJar",
"(",
")",
"throws",
"IOException",
"{",
"final",
"File",
"jarFile",
"=",
"new",
"File",
"(",
"this",
".",
"fileNames",
".",
"getGlobalFolderName",
"(",
")",
"+",
"this",
".",
"fileNames",
".",
"getJarFileSuffix",
"(",
")",... | Creates the JAR file for upload.
@return
@throws IOException | [
"Creates",
"the",
"JAR",
"file",
"for",
"upload",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/GlobalJarUploader.java#L115-L119 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/util/CollectionUtils.java | CollectionUtils.nullToEmpty | @SuppressWarnings("unchecked")
public static <T> T[] nullToEmpty(final T[] array) {
return array == null ? (T[])EMPTY_ARRAY : array;
} | java | @SuppressWarnings("unchecked")
public static <T> T[] nullToEmpty(final T[] array) {
return array == null ? (T[])EMPTY_ARRAY : array;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"nullToEmpty",
"(",
"final",
"T",
"[",
"]",
"array",
")",
"{",
"return",
"array",
"==",
"null",
"?",
"(",
"T",
"[",
"]",
")",
"EMPTY_ARRAY",
":",
... | Return an empty array if input is null; works as identity function otherwise.
This function is useful in `for` statements if the iterable can be null.
@param array Input array. Can be null.
@param <T> Type of the elements of the array.
@return A reference to the input array if it is not null, an empty array otherwise. | [
"Return",
"an",
"empty",
"array",
"if",
"input",
"is",
"null",
";",
"works",
"as",
"identity",
"function",
"otherwise",
".",
"This",
"function",
"is",
"useful",
"in",
"for",
"statements",
"if",
"the",
"iterable",
"can",
"be",
"null",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/util/CollectionUtils.java#L61-L64 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/defaults/DefaultUserCredentials.java | DefaultUserCredentials.set | @Override
public void set(final String name, final UserCredentials other) throws IOException {
throw new RuntimeException("Not implemented! Attempt to set user " + name + " from: " + other);
} | java | @Override
public void set(final String name, final UserCredentials other) throws IOException {
throw new RuntimeException("Not implemented! Attempt to set user " + name + " from: " + other);
} | [
"@",
"Override",
"public",
"void",
"set",
"(",
"final",
"String",
"name",
",",
"final",
"UserCredentials",
"other",
")",
"throws",
"IOException",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Not implemented! Attempt to set user \"",
"+",
"name",
"+",
"\" from: \... | Copy credentials from another existing user.
This method can be called only once per instance.
This default implementation should never be called.
@param name Name of the new user.
@param other Credentials of another user.
@throws RuntimeException always throws. | [
"Copy",
"credentials",
"from",
"another",
"existing",
"user",
".",
"This",
"method",
"can",
"be",
"called",
"only",
"once",
"per",
"instance",
".",
"This",
"default",
"implementation",
"should",
"never",
"be",
"called",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/defaults/DefaultUserCredentials.java#L49-L52 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/time/runtime/RuntimeClock.java | RuntimeClock.scheduleAlarm | @Override
public Time scheduleAlarm(final int offset, final EventHandler<Alarm> handler) {
final Time alarm = new ClientAlarm(this.timer.getCurrent() + offset, handler);
if (LOG.isLoggable(Level.FINEST)) {
final int eventQueueLen;
synchronized (this.schedule) {
eventQueueLen = this.numC... | java | @Override
public Time scheduleAlarm(final int offset, final EventHandler<Alarm> handler) {
final Time alarm = new ClientAlarm(this.timer.getCurrent() + offset, handler);
if (LOG.isLoggable(Level.FINEST)) {
final int eventQueueLen;
synchronized (this.schedule) {
eventQueueLen = this.numC... | [
"@",
"Override",
"public",
"Time",
"scheduleAlarm",
"(",
"final",
"int",
"offset",
",",
"final",
"EventHandler",
"<",
"Alarm",
">",
"handler",
")",
"{",
"final",
"Time",
"alarm",
"=",
"new",
"ClientAlarm",
"(",
"this",
".",
"timer",
".",
"getCurrent",
"(",... | Schedule a new Alarm event in `offset` milliseconds into the future,
and supply an event handler to be called at that time.
@param offset Number of milliseconds into the future relative to current time.
@param handler Event handler to be invoked.
@return Newly scheduled alarm.
@throws IllegalStateException if the clock... | [
"Schedule",
"a",
"new",
"Alarm",
"event",
"in",
"offset",
"milliseconds",
"into",
"the",
"future",
"and",
"supply",
"an",
"event",
"handler",
"to",
"be",
"called",
"at",
"that",
"time",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/time/runtime/RuntimeClock.java#L121-L156 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/time/runtime/RuntimeClock.java | RuntimeClock.stop | @Override
public void stop(final Throwable exception) {
LOG.entering(CLASS_NAME, "stop");
synchronized (this.schedule) {
if (this.isClosed) {
LOG.log(Level.FINEST, "Clock has already been closed");
return;
}
this.isClosed = true;
this.exceptionCausedStop = exception... | java | @Override
public void stop(final Throwable exception) {
LOG.entering(CLASS_NAME, "stop");
synchronized (this.schedule) {
if (this.isClosed) {
LOG.log(Level.FINEST, "Clock has already been closed");
return;
}
this.isClosed = true;
this.exceptionCausedStop = exception... | [
"@",
"Override",
"public",
"void",
"stop",
"(",
"final",
"Throwable",
"exception",
")",
"{",
"LOG",
".",
"entering",
"(",
"CLASS_NAME",
",",
"\"stop\"",
")",
";",
"synchronized",
"(",
"this",
".",
"schedule",
")",
"{",
"if",
"(",
"this",
".",
"isClosed",... | Stop the clock on exception.
Remove all other events from the schedule and fire StopTimer event immediately.
@param exception Exception that is the cause for the stop. Can be null. | [
"Stop",
"the",
"clock",
"on",
"exception",
".",
"Remove",
"all",
"other",
"events",
"from",
"the",
"schedule",
"and",
"fire",
"StopTimer",
"event",
"immediately",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/time/runtime/RuntimeClock.java#L173-L202 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/time/runtime/RuntimeClock.java | RuntimeClock.close | @Override
public void close() {
LOG.entering(CLASS_NAME, "close");
synchronized (this.schedule) {
if (this.isClosed) {
LOG.exiting(CLASS_NAME, "close", "Clock has already been closed");
return;
}
this.isClosed = true;
final Time stopEvent = new StopTime(Math.max(th... | java | @Override
public void close() {
LOG.entering(CLASS_NAME, "close");
synchronized (this.schedule) {
if (this.isClosed) {
LOG.exiting(CLASS_NAME, "close", "Clock has already been closed");
return;
}
this.isClosed = true;
final Time stopEvent = new StopTime(Math.max(th... | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"{",
"LOG",
".",
"entering",
"(",
"CLASS_NAME",
",",
"\"close\"",
")",
";",
"synchronized",
"(",
"this",
".",
"schedule",
")",
"{",
"if",
"(",
"this",
".",
"isClosed",
")",
"{",
"LOG",
".",
"exiti... | Wait for all client alarms to finish executing and gracefully shutdown the clock. | [
"Wait",
"for",
"all",
"client",
"alarms",
"to",
"finish",
"executing",
"and",
"gracefully",
"shutdown",
"the",
"clock",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/time/runtime/RuntimeClock.java#L207-L231 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/time/runtime/RuntimeClock.java | RuntimeClock.subscribe | @SuppressWarnings("checkstyle:hiddenfield")
private <T extends Time> void subscribe(final Class<T> eventClass, final Set<EventHandler<T>> handlers) {
for (final EventHandler<T> handler : handlers) {
LOG.log(Level.FINEST, "Subscribe: event {0} handler {1}", new Object[] {eventClass.getName(), handler});
... | java | @SuppressWarnings("checkstyle:hiddenfield")
private <T extends Time> void subscribe(final Class<T> eventClass, final Set<EventHandler<T>> handlers) {
for (final EventHandler<T> handler : handlers) {
LOG.log(Level.FINEST, "Subscribe: event {0} handler {1}", new Object[] {eventClass.getName(), handler});
... | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:hiddenfield\"",
")",
"private",
"<",
"T",
"extends",
"Time",
">",
"void",
"subscribe",
"(",
"final",
"Class",
"<",
"T",
">",
"eventClass",
",",
"final",
"Set",
"<",
"EventHandler",
"<",
"T",
">",
">",
"handlers",
... | Register event handlers for the given event class.
@param eventClass Event type to handle. Must be derived from Time.
@param handlers One or many event handlers that can process given event type.
@param <T> Event type - must be derived from class Time. (i.e. contain a timestamp). | [
"Register",
"event",
"handlers",
"for",
"the",
"given",
"event",
"class",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/time/runtime/RuntimeClock.java#L264-L270 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java | YarnContainerManager.release | void release(final String containerId) {
LOG.log(Level.FINE, "Release container: {0}", containerId);
final Container container = this.containers.removeAndGet(containerId);
this.resourceManager.releaseAssignedContainer(container.getId());
updateRuntimeStatus();
} | java | void release(final String containerId) {
LOG.log(Level.FINE, "Release container: {0}", containerId);
final Container container = this.containers.removeAndGet(containerId);
this.resourceManager.releaseAssignedContainer(container.getId());
updateRuntimeStatus();
} | [
"void",
"release",
"(",
"final",
"String",
"containerId",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"Release container: {0}\"",
",",
"containerId",
")",
";",
"final",
"Container",
"container",
"=",
"this",
".",
"containers",
".",
"remove... | Release the given container. | [
"Release",
"the",
"given",
"container",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java#L307-L312 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java | YarnContainerManager.onStart | void onStart() {
LOG.log(Level.FINEST, "YARN registration: begin");
this.nodeManager.init(this.yarnConf);
this.nodeManager.start();
try {
this.yarnProxyUser.doAs(
new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws Exception {
... | java | void onStart() {
LOG.log(Level.FINEST, "YARN registration: begin");
this.nodeManager.init(this.yarnConf);
this.nodeManager.start();
try {
this.yarnProxyUser.doAs(
new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws Exception {
... | [
"void",
"onStart",
"(",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"YARN registration: begin\"",
")",
";",
"this",
".",
"nodeManager",
".",
"init",
"(",
"this",
".",
"yarnConf",
")",
";",
"this",
".",
"nodeManager",
".",
"start",
... | Start the YARN container manager.
This method is called from DriverRuntimeStartHandler via YARNRuntimeStartHandler. | [
"Start",
"the",
"YARN",
"container",
"manager",
".",
"This",
"method",
"is",
"called",
"from",
"DriverRuntimeStartHandler",
"via",
"YARNRuntimeStartHandler",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java#L318-L358 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java | YarnContainerManager.onStop | void onStop(final Throwable exception) {
LOG.log(Level.FINE, "Stop Runtime: RM status {0}", this.resourceManager.getServiceState());
if (this.resourceManager.getServiceState() == Service.STATE.STARTED) {
// invariant: if RM is still running then we declare success.
try {
this.reefEventHa... | java | void onStop(final Throwable exception) {
LOG.log(Level.FINE, "Stop Runtime: RM status {0}", this.resourceManager.getServiceState());
if (this.resourceManager.getServiceState() == Service.STATE.STARTED) {
// invariant: if RM is still running then we declare success.
try {
this.reefEventHa... | [
"void",
"onStop",
"(",
"final",
"Throwable",
"exception",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"Stop Runtime: RM status {0}\"",
",",
"this",
".",
"resourceManager",
".",
"getServiceState",
"(",
")",
")",
";",
"if",
"(",
"this",
".... | Shut down YARN container manager.
This method is called from DriverRuntimeStopHandler via YARNRuntimeStopHandler.
@param exception Exception that caused driver to stop. Can be null if there was no error. | [
"Shut",
"down",
"YARN",
"container",
"manager",
".",
"This",
"method",
"is",
"called",
"from",
"DriverRuntimeStopHandler",
"via",
"YARNRuntimeStopHandler",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java#L365-L409 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java | YarnContainerManager.onContainerStatus | private void onContainerStatus(final ContainerStatus value) {
final String containerId = value.getContainerId().toString();
final boolean hasContainer = this.containers.hasContainer(containerId);
if (hasContainer) {
LOG.log(Level.FINE, "Received container status: {0}", containerId);
final Res... | java | private void onContainerStatus(final ContainerStatus value) {
final String containerId = value.getContainerId().toString();
final boolean hasContainer = this.containers.hasContainer(containerId);
if (hasContainer) {
LOG.log(Level.FINE, "Received container status: {0}", containerId);
final Res... | [
"private",
"void",
"onContainerStatus",
"(",
"final",
"ContainerStatus",
"value",
")",
"{",
"final",
"String",
"containerId",
"=",
"value",
".",
"getContainerId",
"(",
")",
".",
"toString",
"(",
")",
";",
"final",
"boolean",
"hasContainer",
"=",
"this",
".",
... | Handles container status reports. Calls come from YARN.
@param value containing the container status. | [
"Handles",
"container",
"status",
"reports",
".",
"Calls",
"come",
"from",
"YARN",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java#L441-L480 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java | YarnContainerManager.handleNewContainer | private void handleNewContainer(final Container container) {
LOG.log(Level.FINE, "allocated container: id[ {0} ]", container.getId());
synchronized (this) {
if (!matchContainerWithPendingRequest(container)) {
LOG.log(Level.WARNING, "Got an extra container {0} that doesn't match, releasing...", ... | java | private void handleNewContainer(final Container container) {
LOG.log(Level.FINE, "allocated container: id[ {0} ]", container.getId());
synchronized (this) {
if (!matchContainerWithPendingRequest(container)) {
LOG.log(Level.WARNING, "Got an extra container {0} that doesn't match, releasing...", ... | [
"private",
"void",
"handleNewContainer",
"(",
"final",
"Container",
"container",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"allocated container: id[ {0} ]\"",
",",
"container",
".",
"getId",
"(",
")",
")",
";",
"synchronized",
"(",
"this",... | Handles new container allocations. Calls come from YARN.
@param container newly allocated YARN container. | [
"Handles",
"new",
"container",
"allocations",
".",
"Calls",
"come",
"from",
"YARN",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java#L497-L549 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java | YarnContainerManager.matchContainerWithPendingRequest | private boolean matchContainerWithPendingRequest(final Container container) {
if (this.requestsAfterSentToRM.isEmpty()) {
return false;
}
final AMRMClient.ContainerRequest request = this.requestsAfterSentToRM.peek();
final boolean resourceCondition = container.getResource().getMemory() >= reque... | java | private boolean matchContainerWithPendingRequest(final Container container) {
if (this.requestsAfterSentToRM.isEmpty()) {
return false;
}
final AMRMClient.ContainerRequest request = this.requestsAfterSentToRM.peek();
final boolean resourceCondition = container.getResource().getMemory() >= reque... | [
"private",
"boolean",
"matchContainerWithPendingRequest",
"(",
"final",
"Container",
"container",
")",
"{",
"if",
"(",
"this",
".",
"requestsAfterSentToRM",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"final",
"AMRMClient",
".",
"ContainerRe... | Match to see whether the container satisfies the request.
We take into consideration that RM has some freedom in rounding
up the allocation and in placing containers on other machines. | [
"Match",
"to",
"see",
"whether",
"the",
"container",
"satisfies",
"the",
"request",
".",
"We",
"take",
"into",
"consideration",
"that",
"RM",
"has",
"some",
"freedom",
"in",
"rounding",
"up",
"the",
"allocation",
"and",
"in",
"placing",
"containers",
"on",
"... | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java#L580-L598 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java | YarnContainerManager.updateRuntimeStatus | private void updateRuntimeStatus() {
final RuntimeStatusEventImpl.Builder builder = RuntimeStatusEventImpl.newBuilder()
.setName(RUNTIME_NAME)
.setState(State.RUNNING)
.setOutstandingContainerRequests(this.containerRequestCounter.get());
for (final String allocatedContainerId : this.co... | java | private void updateRuntimeStatus() {
final RuntimeStatusEventImpl.Builder builder = RuntimeStatusEventImpl.newBuilder()
.setName(RUNTIME_NAME)
.setState(State.RUNNING)
.setOutstandingContainerRequests(this.containerRequestCounter.get());
for (final String allocatedContainerId : this.co... | [
"private",
"void",
"updateRuntimeStatus",
"(",
")",
"{",
"final",
"RuntimeStatusEventImpl",
".",
"Builder",
"builder",
"=",
"RuntimeStatusEventImpl",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"RUNTIME_NAME",
")",
".",
"setState",
"(",
"State",
".",
"RUNN... | Update the driver with my current status. | [
"Update",
"the",
"driver",
"with",
"my",
"current",
"status",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java#L603-L615 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/task/OperatorTopologyImpl.java | OperatorTopologyImpl.refreshEffectiveTopology | private void refreshEffectiveTopology() throws ParentDeadException {
LOG.entering("OperatorTopologyImpl", "refreshEffectiveTopology", getQualifiedName());
LOG.finest(getQualifiedName() + "Waiting to acquire topoLock");
synchronized (topologyLock) {
LOG.finest(getQualifiedName() + "Acquired topoLock");... | java | private void refreshEffectiveTopology() throws ParentDeadException {
LOG.entering("OperatorTopologyImpl", "refreshEffectiveTopology", getQualifiedName());
LOG.finest(getQualifiedName() + "Waiting to acquire topoLock");
synchronized (topologyLock) {
LOG.finest(getQualifiedName() + "Acquired topoLock");... | [
"private",
"void",
"refreshEffectiveTopology",
"(",
")",
"throws",
"ParentDeadException",
"{",
"LOG",
".",
"entering",
"(",
"\"OperatorTopologyImpl\"",
",",
"\"refreshEffectiveTopology\"",
",",
"getQualifiedName",
"(",
")",
")",
";",
"LOG",
".",
"finest",
"(",
"getQ... | Only refreshes the effective topology with deletion msgs from.
deletionDeltas queue
@throws ParentDeadException | [
"Only",
"refreshes",
"the",
"effective",
"topology",
"with",
"deletion",
"msgs",
"from",
".",
"deletionDeltas",
"queue"
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/task/OperatorTopologyImpl.java#L266-L282 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.