_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q22100 | StreamletImpl.map | train | @Override
public <T> Streamlet<T> map(SerializableFunction<R, ? extends T> mapFn) {
checkNotNull(mapFn, "mapFn cannot be null");
MapStreamlet<R, T> retval = new MapStreamlet<>(this, mapFn);
addChild(retval);
return retval;
} | java | {
"resource": ""
} |
q22101 | StreamletImpl.flatMap | train | @Override
public <T> Streamlet<T> flatMap(
SerializableFunction<R, ? extends Iterable<? extends T>> flatMapFn) {
checkNotNull(flatMapFn, "flatMapFn cannot be null");
FlatMapStreamlet<R, T> retval = new FlatMapStreamlet<>(this, flatMapFn);
addChild(retval);
return retval;
} | java | {
"resource": ""
} |
q22102 | StreamletImpl.filter | train | @Override
public Streamlet<R> filter(SerializablePredicate<R> filterFn) {
checkNotNull(filterFn, "filterFn cannot be null");
FilterStreamlet<R> retval = new FilterStreamlet<>(this, filterFn);
addChild(retval);
return retval;
} | java | {
"resource": ""
} |
q22103 | StreamletImpl.repartition | train | @Override
public Streamlet<R> repartition(int numPartitions,
SerializableBiFunction<R, Integer, List<Integer>> partitionFn) {
checkNotNull(partitionFn, "partitionFn cannot be null");
RemapStreamlet<R> retval = new RemapStreamlet<>(this, partitionFn);
retval.setNumPartitions(num... | java | {
"resource": ""
} |
q22104 | StreamletImpl.reduceByKeyAndWindow | train | @Override
public <K, T> KVStreamlet<KeyedWindow<K>, T> reduceByKeyAndWindow(
SerializableFunction<R, K> keyExtractor, SerializableFunction<R, T> valueExtractor,
WindowConfig windowCfg, SerializableBinaryOperator<T> reduceFn) {
checkNotNull(keyExtractor, "keyExtractor cannot be null");
checkNotNull... | java | {
"resource": ""
} |
q22105 | StreamletImpl.reduceByKeyAndWindow | train | @Override
public <K, T> KVStreamlet<KeyedWindow<K>, T> reduceByKeyAndWindow(
SerializableFunction<R, K> keyExtractor, WindowConfig windowCfg,
T identity, SerializableBiFunction<T, R, ? extends T> reduceFn) {
checkNotNull(keyExtractor, "keyExtractor cannot be null");
checkNotNull(windowCfg, "window... | java | {
"resource": ""
} |
q22106 | StreamletImpl.consume | train | @Override
public void consume(SerializableConsumer<R> consumer) {
checkNotNull(consumer, "consumer cannot be null");
ConsumerStreamlet<R> consumerStreamlet = new ConsumerStreamlet<>(this, consumer);
addChild(consumerStreamlet);
} | java | {
"resource": ""
} |
q22107 | StreamletImpl.toSink | train | @Override
public void toSink(Sink<R> sink) {
checkNotNull(sink, "sink cannot be null");
SinkStreamlet<R> sinkStreamlet = new SinkStreamlet<>(this, sink);
addChild(sinkStreamlet);
} | java | {
"resource": ""
} |
q22108 | StreamletImpl.split | train | @Override
public Streamlet<R> split(Map<String, SerializablePredicate<R>> splitFns) {
// Make sure map and stream ids are not empty
require(splitFns.size() > 0, "At least one entry is required");
require(splitFns.keySet().stream().allMatch(stream -> StringUtils.isNotBlank(stream)),
"Stream Id ... | java | {
"resource": ""
} |
q22109 | RotatingMap.rotate | train | public void rotate() {
Map<Long, Long> m = buckets.removeLast();
buckets.addFirst(new HashMap<Long, Long>());
} | java | {
"resource": ""
} |
q22110 | RotatingMap.anchor | train | public boolean anchor(long key, long value) {
for (Map<Long, Long> m : buckets) {
if (m.containsKey(key)) {
long currentValue = m.get(key);
long newValue = currentValue ^ value;
m.put(key, newValue);
return newValue == 0;
}
}
return false;
} | java | {
"resource": ""
} |
q22111 | RotatingMap.remove | train | public boolean remove(long key) {
for (Map<Long, Long> m : buckets) {
if (m.remove(key) != null) {
return true;
}
}
return false;
} | java | {
"resource": ""
} |
q22112 | AbstractWebSink.startHttpServer | train | protected void startHttpServer(String path, int port) {
try {
httpServer = HttpServer.create(new InetSocketAddress(port), 0);
httpServer.createContext(path, httpExchange -> {
byte[] response = generateResponse();
httpExchange.sendResponseHeaders(HTTP_STATUS_OK, response.length);
... | java | {
"resource": ""
} |
q22113 | AbstractWebSink.createCache | train | <K, V> Cache<K, V> createCache() {
return CacheBuilder.newBuilder()
.maximumSize(cacheMaxSize)
.expireAfterWrite(cacheTtlSeconds, TimeUnit.SECONDS)
.ticker(cacheTicker)
.build();
} | java | {
"resource": ""
} |
q22114 | GrowingWaitQueueDetector.detect | train | @Override
public Collection<Symptom> detect(Collection<Measurement> measurements) {
Collection<Symptom> result = new ArrayList<>();
MeasurementsTable waitQueueMetrics
= MeasurementsTable.of(measurements).type(METRIC_WAIT_Q_SIZE.text());
for (String component : waitQueueMetrics.uniqueComponents()... | java | {
"resource": ""
} |
q22115 | WebSink.processMetrics | train | static Map<String, Double> processMetrics(String prefix, Iterable<MetricsInfo> metrics) {
Map<String, Double> map = new HashMap<>();
for (MetricsInfo r : metrics) {
try {
map.put(prefix + r.getName(), Double.valueOf(r.getValue()));
} catch (NumberFormatException ne) {
LOG.log(Level.S... | java | {
"resource": ""
} |
q22116 | WireRequestsTopology.fraudDetect | train | private static boolean fraudDetect(WireRequest request) {
String logMessage;
boolean fraudulent = FRAUDULENT_CUSTOMERS.contains(request.getCustomerId());
if (fraudulent) {
logMessage = String.format("Rejected fraudulent customer %s",
request.getCustomerId());
LOG.warning(logMessage);... | java | {
"resource": ""
} |
q22117 | Container.add | train | void add(PackingPlan.InstancePlan instancePlan) {
if (this.instances.contains(instancePlan)) {
throw new PackingException(String.format(
"Instance %s already exists in container %s", instancePlan, toString()));
}
this.instances.add(instancePlan);
} | java | {
"resource": ""
} |
q22118 | Container.removeAnyInstanceOfComponent | train | Optional<PackingPlan.InstancePlan> removeAnyInstanceOfComponent(String component) {
Optional<PackingPlan.InstancePlan> instancePlan = getAnyInstanceOfComponent(component);
if (instancePlan.isPresent()) {
PackingPlan.InstancePlan plan = instancePlan.get();
this.instances.remove(plan);
return in... | java | {
"resource": ""
} |
q22119 | Container.getAnyInstanceOfComponent | train | private Optional<PackingPlan.InstancePlan> getAnyInstanceOfComponent(String componentName) {
for (PackingPlan.InstancePlan instancePlan : this.instances) {
if (instancePlan.getComponentName().equals(componentName)) {
return Optional.of(instancePlan);
}
}
return Optional.absent();
} | java | {
"resource": ""
} |
q22120 | Container.getInstance | train | Optional<PackingPlan.InstancePlan> getInstance(String componentName, int componentIndex) {
for (PackingPlan.InstancePlan instancePlan : this.instances) {
if (instancePlan.getComponentName().equals(componentName)
&& instancePlan.getComponentIndex() == componentIndex) {
return Optional.of(inst... | java | {
"resource": ""
} |
q22121 | Container.getInstance | train | Optional<PackingPlan.InstancePlan> getInstance(int taskId) {
for (PackingPlan.InstancePlan instancePlan : this.instances) {
if (instancePlan.getTaskId() == taskId) {
return Optional.of(instancePlan);
}
}
return Optional.absent();
} | java | {
"resource": ""
} |
q22122 | Container.getTotalUsedResources | train | public Resource getTotalUsedResources() {
return getInstances().stream()
.map(PackingPlan.InstancePlan::getResource)
.reduce(Resource.EMPTY_RESOURCE, Resource::plus)
.plus(getPadding());
} | java | {
"resource": ""
} |
q22123 | BufferSizeSensor.fetch | train | @Override
public Collection<Measurement> fetch() {
Collection<Measurement> result = new ArrayList<>();
Instant now = context.checkpoint();
List<String> boltComponents = physicalPlanProvider.getBoltNames();
Duration duration = getDuration();
for (String component : boltComponents) {
String[... | java | {
"resource": ""
} |
q22124 | ConfigLoader.loadConfig | train | public static Config loadConfig(String heronHome, String configPath,
String releaseFile, String overrideConfigFile) {
Config defaultConfig = loadDefaults(heronHome, configPath);
Config localConfig = Config.toLocalMode(defaultConfig); //to token-substitute the conf paths
Co... | java | {
"resource": ""
} |
q22125 | ConfigLoader.loadClusterConfig | train | public static Config loadClusterConfig() {
Config defaultConfig = loadDefaults(
Key.HERON_CLUSTER_HOME.getDefaultString(), Key.HERON_CLUSTER_CONF.getDefaultString());
Config clusterConfig = Config.toClusterMode(defaultConfig); //to token-substitute the conf paths
Config.Builder cb = Config.newBuild... | java | {
"resource": ""
} |
q22126 | StatefulWindowedBoltExecutor.initState | train | @Override
public void initState(State state) {
this.state = state;
// initalize internal windowing state
super.initState(this.state);
// initialize user defined state
if (!this.state.containsKey(USER_STATE)) {
this.state.put(USER_STATE, new HashMapState<K, V>());
}
this.statefulWindo... | java | {
"resource": ""
} |
q22127 | ErrorReportLoggingHandler.publish | train | @Override
public void publish(LogRecord record) {
// Convert Log
Throwable throwable = record.getThrown();
if (throwable != null) {
synchronized (ExceptionRepositoryAsMetrics.INSTANCE) {
// We would not include the message if already exceeded the exceptions limit
if (ExceptionReposit... | java | {
"resource": ""
} |
q22128 | SchedulerStateManagerAdaptor.setExecutionState | train | public Boolean setExecutionState(
ExecutionEnvironment.ExecutionState executionState, String topologyName) {
return awaitResult(delegate.setExecutionState(executionState, topologyName));
} | java | {
"resource": ""
} |
q22129 | SchedulerStateManagerAdaptor.setTopology | train | public Boolean setTopology(TopologyAPI.Topology topology, String topologyName) {
return awaitResult(delegate.setTopology(topology, topologyName));
} | java | {
"resource": ""
} |
q22130 | SchedulerStateManagerAdaptor.updateTopology | train | public Boolean updateTopology(TopologyAPI.Topology topology, String topologyName) {
if (getTopology(topologyName) != null) {
deleteTopology(topologyName);
}
return setTopology(topology, topologyName);
} | java | {
"resource": ""
} |
q22131 | SchedulerStateManagerAdaptor.setSchedulerLocation | train | public Boolean setSchedulerLocation(
Scheduler.SchedulerLocation location,
String topologyName) {
return awaitResult(delegate.setSchedulerLocation(location, topologyName));
} | java | {
"resource": ""
} |
q22132 | SchedulerStateManagerAdaptor.setPackingPlan | train | public Boolean setPackingPlan(PackingPlans.PackingPlan packingPlan, String topologyName) {
return awaitResult(delegate.setPackingPlan(packingPlan, topologyName));
} | java | {
"resource": ""
} |
q22133 | SchedulerStateManagerAdaptor.updatePackingPlan | train | public Boolean updatePackingPlan(PackingPlans.PackingPlan packingPlan, String topologyName) {
if (getPackingPlan(topologyName) != null) {
deletePackingPlan(topologyName);
}
return setPackingPlan(packingPlan, topologyName);
} | java | {
"resource": ""
} |
q22134 | SchedulerStateManagerAdaptor.getTMasterLocation | train | public TopologyMaster.TMasterLocation getTMasterLocation(String topologyName) {
return awaitResult(delegate.getTMasterLocation(null, topologyName));
} | java | {
"resource": ""
} |
q22135 | SchedulerStateManagerAdaptor.getSchedulerLocation | train | public Scheduler.SchedulerLocation getSchedulerLocation(String topologyName) {
return awaitResult(delegate.getSchedulerLocation(null, topologyName));
} | java | {
"resource": ""
} |
q22136 | SchedulerStateManagerAdaptor.getMetricsCacheLocation | train | public TopologyMaster.MetricsCacheLocation getMetricsCacheLocation(String topologyName) {
return awaitResult(delegate.getMetricsCacheLocation(null, topologyName));
} | java | {
"resource": ""
} |
q22137 | SchedulerStateManagerAdaptor.getTopology | train | public TopologyAPI.Topology getTopology(String topologyName) {
return awaitResult(delegate.getTopology(null, topologyName));
} | java | {
"resource": ""
} |
q22138 | SchedulerStateManagerAdaptor.getExecutionState | train | public ExecutionEnvironment.ExecutionState getExecutionState(String topologyName) {
return awaitResult(delegate.getExecutionState(null, topologyName));
} | java | {
"resource": ""
} |
q22139 | SchedulerStateManagerAdaptor.getPhysicalPlan | train | public PhysicalPlans.PhysicalPlan getPhysicalPlan(String topologyName) {
return awaitResult(delegate.getPhysicalPlan(null, topologyName));
} | java | {
"resource": ""
} |
q22140 | SchedulerStateManagerAdaptor.getPackingPlan | train | public PackingPlans.PackingPlan getPackingPlan(String topologyName) {
return awaitResult(delegate.getPackingPlan(null, topologyName));
} | java | {
"resource": ""
} |
q22141 | OutgoingTupleCollection.sendOutState | train | public void sendOutState(State<Serializable, Serializable> state,
String checkpointId,
boolean spillState,
String location) {
lock.lock();
try {
// flush all the current data before sending the state
flushRemaining();
... | java | {
"resource": ""
} |
q22142 | OutgoingTupleCollection.clear | train | public void clear() {
lock.lock();
try {
currentControlTuple = null;
currentDataTuple = null;
outQueue.clear();
} finally {
lock.unlock();
}
} | java | {
"resource": ""
} |
q22143 | KubernetesScheduler.addContainers | train | @Override
public Set<PackingPlan.ContainerPlan>
addContainers(Set<PackingPlan.ContainerPlan> containersToAdd) {
controller.addContainers(containersToAdd);
return containersToAdd;
} | java | {
"resource": ""
} |
q22144 | XORManager.anchor | train | public boolean anchor(int taskId, long key, long value) {
return spoutTasksToRotatingMap.get(taskId).anchor(key, value);
} | java | {
"resource": ""
} |
q22145 | XORManager.rotate | train | protected void rotate() {
for (RotatingMap map : spoutTasksToRotatingMap.values()) {
map.rotate();
}
Runnable r = new Runnable() {
@Override
public void run() {
rotate();
}
};
looper.registerTimerEvent(rotateInterval, r);
} | java | {
"resource": ""
} |
q22146 | BackPressureDetector.detect | train | @Override
public Collection<Symptom> detect(Collection<Measurement> measurements) {
publishingMetrics.executeDetectorIncr(BACK_PRESSURE_DETECTOR);
Collection<Symptom> result = new ArrayList<>();
Instant now = context.checkpoint();
MeasurementsTable bpMetrics
= MeasurementsTable.of(measuremen... | java | {
"resource": ""
} |
q22147 | AuroraScheduler.getController | train | protected AuroraController getController()
throws ClassNotFoundException, InstantiationException, IllegalAccessException {
Boolean cliController = config.getBooleanValue(Key.AURORA_CONTROLLER_CLASS);
Config localConfig = Config.toLocalMode(this.config);
if (cliController) {
return new AuroraCLIC... | java | {
"resource": ""
} |
q22148 | HDFSStorage.createDir | train | protected void createDir(String dir) throws StatefulStorageException {
Path path = new Path(dir);
try {
fileSystem.mkdirs(path);
if (!fileSystem.exists(path)) {
throw new StatefulStorageException("Failed to create dir: " + dir);
}
} catch (IOException e) {
throw new Stateful... | java | {
"resource": ""
} |
q22149 | MetricsFilter.filter | train | public Iterable<MetricsInfo> filter(Iterable<MetricsInfo> metricsInfos) {
List<MetricsInfo> metricsFiltered = new ArrayList<MetricsInfo>();
for (MetricsInfo metricsInfo : metricsInfos) {
if (contains(metricsInfo.getName())) {
metricsFiltered.add(metricsInfo);
}
}
return metricsFilte... | java | {
"resource": ""
} |
q22150 | MarathonScheduler.getContainer | train | protected ObjectNode getContainer(ObjectMapper mapper) {
ObjectNode containerNode = mapper.createObjectNode();
containerNode.put(MarathonConstants.CONTAINER_TYPE, "DOCKER");
containerNode.set("docker", getDockerContainer(mapper));
return containerNode;
} | java | {
"resource": ""
} |
q22151 | HttpServiceSchedulerClient.requestSchedulerService | train | protected boolean requestSchedulerService(Command command, byte[] data) {
String endpoint = getCommandEndpoint(schedulerHttpEndpoint, command);
final HttpURLConnection connection = NetworkUtils.getHttpConnection(endpoint);
if (connection == null) {
LOG.severe("Scheduler not found.");
return fals... | java | {
"resource": ""
} |
q22152 | HttpServiceSchedulerClient.getCommandEndpoint | train | protected String getCommandEndpoint(String schedulerEndpoint, Command command) {
// Currently the server side receives command request in lower case
return String.format("http://%s/%s", schedulerEndpoint, command.name().toLowerCase());
} | java | {
"resource": ""
} |
q22153 | LauncherUtils.createPackingPlan | train | public PackingPlan createPackingPlan(final Config config, final Config runtime)
throws PackingException {
// Create an instance of the packing class
String packingClass = Context.packingClass(config);
IPacking packing;
try {
// create an instance of the packing class
packing = Reflection... | java | {
"resource": ""
} |
q22154 | LauncherUtils.getSchedulerInstance | train | public IScheduler getSchedulerInstance(Config config, Config runtime)
throws SchedulerException {
String schedulerClass = Context.schedulerClass(config);
IScheduler scheduler;
try {
// create an instance of scheduler
scheduler = ReflectionUtils.newInstance(schedulerClass);
} catch (Ill... | java | {
"resource": ""
} |
q22155 | LauncherUtils.createPrimaryRuntime | train | public Config createPrimaryRuntime(TopologyAPI.Topology topology) {
return Config.newBuilder()
.put(Key.TOPOLOGY_ID, topology.getId())
.put(Key.TOPOLOGY_NAME, topology.getName())
.put(Key.TOPOLOGY_DEFINITION, topology)
.put(Key.NUM_CONTAINERS, 1 + TopologyUtils.getNumContainers(topol... | java | {
"resource": ""
} |
q22156 | LauncherUtils.createAdaptorRuntime | train | public Config createAdaptorRuntime(SchedulerStateManagerAdaptor adaptor) {
return Config.newBuilder()
.put(Key.SCHEDULER_STATE_MANAGER_ADAPTOR, adaptor).build();
} | java | {
"resource": ""
} |
q22157 | LauncherUtils.createConfigWithPackingDetails | train | public Config createConfigWithPackingDetails(Config runtime, PackingPlan packing) {
return Config.newBuilder()
.putAll(runtime)
.put(Key.COMPONENT_RAMMAP, packing.getComponentRamDistribution())
.put(Key.NUM_CONTAINERS, 1 + packing.getContainers().size())
.build();
} | java | {
"resource": ""
} |
q22158 | StatefulRandomIntSpout.preSave | train | @Override
public void preSave(String checkpointId) {
System.out.println(String.format("Saving spout state at checkpoint %s", checkpointId));
} | java | {
"resource": ""
} |
q22159 | StatefulRandomIntSpout.open | train | @Override
public void open(Map<String, Object> map, TopologyContext ctx, SpoutOutputCollector collector) {
spoutOutputCollector = collector;
} | java | {
"resource": ""
} |
q22160 | ShellUtils.runSyncProcess | train | private static int runSyncProcess(
boolean isVerbose, boolean isInheritIO, String[] cmdline,
StringBuilder outputBuilder, File workingDirectory, Map<String, String> envs) {
final StringBuilder builder = outputBuilder == null ? new StringBuilder() : outputBuilder;
// Log the command for debugging
... | java | {
"resource": ""
} |
q22161 | ShellUtils.splitTokens | train | protected static String[] splitTokens(String command) {
if (command.length() == 0) {
throw new IllegalArgumentException("Empty command");
}
StringTokenizer st = new StringTokenizer(command);
String[] cmdarray = new String[st.countTokens()];
for (int i = 0; st.hasMoreTokens(); i++) {
cmd... | java | {
"resource": ""
} |
q22162 | ShellUtils.curlPackage | train | public static boolean curlPackage(
String uri, String destination, boolean isVerbose, boolean isInheritIO) {
// get the directory containing the target file
File parentDirectory = Paths.get(destination).getParent().toFile();
// using curl copy the url to the target file
String cmd = String.forma... | java | {
"resource": ""
} |
q22163 | ShellUtils.extractPackage | train | public static boolean extractPackage(
String packageName, String targetFolder, boolean isVerbose, boolean isInheritIO) {
String cmd = String.format("tar -xvf %s", packageName);
int ret = runSyncProcess(isVerbose, isInheritIO,
splitTokens(cmd), new StringBuilder(), new File(targetFolder));
re... | java | {
"resource": ""
} |
q22164 | CacheCore.startPurge | train | public void startPurge(WakeableLooper wakeableLooper) {
synchronized (CacheCore.class) {
if (looper == null) {
looper = wakeableLooper;
}
looper.registerTimerEvent(interval, new Runnable() {
@Override
public void run() {
purge();
}
});
}
} | java | {
"resource": ""
} |
q22165 | StreamManagerClient.sendRegisterRequest | train | private void sendRegisterRequest() {
StreamManager.RegisterInstanceRequest request =
StreamManager.RegisterInstanceRequest.newBuilder().
setInstance(instance).setTopologyName(topologyName).setTopologyId(topologyId).
build();
// The timeout would be the reconnect-interval-seconds... | java | {
"resource": ""
} |
q22166 | MesosFramework.createJob | train | public boolean createJob(Map<Integer, BaseContainer> jobDefinition) {
synchronized (this) {
if (isTerminated) {
LOG.severe("Job has been killed");
return false;
}
// Record the jobDefinition
containersInfo.putAll(jobDefinition);
// To scheduler them with 0 attempt
... | java | {
"resource": ""
} |
q22167 | MesosFramework.killJob | train | public boolean killJob() {
synchronized (this) {
if (isTerminated) {
LOG.info("Job has been killed");
return false;
}
isTerminated = true;
LOG.info(String.format("Kill job: %s", Context.topologyName(heronConfig)));
LOG.info("Remove all tasks to schedule");
toSche... | java | {
"resource": ""
} |
q22168 | MesosFramework.restartJob | train | public boolean restartJob(int containerIndex) {
synchronized (this) {
if (isTerminated) {
LOG.severe("Job has been killed");
return false;
}
// List of tasks to restart
List<String> tasksToRestart = new ArrayList<>();
if (containerIndex == -1) {
// Restart all ... | java | {
"resource": ""
} |
q22169 | MesosFramework.waitForRegistered | train | public boolean waitForRegistered(long timeout, TimeUnit unit) {
try {
if (this.registeredLatch.await(timeout, unit)) {
return true;
}
} catch (InterruptedException e) {
LOG.severe("Failed to wait for mesos framework got registered");
return false;
}
return false;
} | java | {
"resource": ""
} |
q22170 | MesosFramework.handleMesosFailure | train | protected void handleMesosFailure(String taskId) {
int attempt = TaskUtils.getAttemptForTaskId(taskId);
BaseContainer container = containersInfo.get(TaskUtils.getContainerIndexForTaskId(taskId));
boolean hasAttemptsLeft = attempt < container.retries;
if (hasAttemptsLeft) {
LOG.warning(String.for... | java | {
"resource": ""
} |
q22171 | MesosFramework.scheduleNewTask | train | protected boolean scheduleNewTask(String taskId) {
// Put it to the pending start queue
LOG.info(String.format("We are to schedule task: [%s]", taskId));
// Update the tasksId
int containerIndex = TaskUtils.getContainerIndexForTaskId(taskId);
tasksId.put(containerIndex, taskId);
// Re-schedule... | java | {
"resource": ""
} |
q22172 | MesosFramework.generateLaunchableTasks | train | protected List<LaunchableTask> generateLaunchableTasks(
Map<Protos.Offer, TaskResources> offerResources) {
List<LaunchableTask> tasks = new LinkedList<>();
if (isTerminated) {
LOG.info("Job has been killed");
return tasks;
}
while (!toScheduleTasks.isEmpty()) {
String taskId = ... | java | {
"resource": ""
} |
q22173 | SchedulerMain.setupLogging | train | private static void setupLogging(Config config) throws IOException {
String systemConfigFilename = Context.systemConfigFile(config);
SystemConfig systemConfig = SystemConfig.newBuilder(true)
.putAll(systemConfigFilename, true)
.build();
// Init the logging setting and redirect the stdout a... | java | {
"resource": ""
} |
q22174 | SchedulerMain.getServer | train | protected SchedulerServer getServer(
Config runtime, IScheduler scheduler, int port) throws IOException {
// create an instance of the server using scheduler class and port
return new SchedulerServer(runtime, scheduler, port);
} | java | {
"resource": ""
} |
q22175 | SpoutInstance.addSpoutsTasks | train | private void addSpoutsTasks() {
// Register spoutTasks
Runnable spoutTasks = new Runnable() {
@Override
public void run() {
spoutMetrics.updateTaskRunCount();
// Check whether we should produce more tuples
if (isProduceTuple()) {
spoutMetrics.updateProduceTupleCoun... | java | {
"resource": ""
} |
q22176 | Config.lazyCreateConfig | train | private Config lazyCreateConfig(Mode newMode) {
if (newMode == this.mode) {
return this;
}
// this is here so that we don't keep cascading deeper into object creation so:
// localConfig == toLocalMode(toClusterMode(localConfig))
Config newRawConfig = this.rawConfig;
Config newLocalConfig ... | java | {
"resource": ""
} |
q22177 | LoggingHelper.loggerInit | train | public static void loggerInit(Level level, boolean isRedirectStdOutErr, String format)
throws IOException {
// Set the java util logging format
setLoggingFormat(format);
// Configure the root logger and its handlers so that all the
// derived loggers will inherit the properties
Logger rootLog... | java | {
"resource": ""
} |
q22178 | SinkExecutor.addSinkTasks | train | private void addSinkTasks() {
Runnable sinkTasks = new Runnable() {
@Override
public void run() {
while (!metricsInSinkQueue.isEmpty()) {
metricsSink.processRecord(metricsInSinkQueue.poll());
}
}
};
slaveLooper.addTasksOnWakeup(sinkTasks);
} | java | {
"resource": ""
} |
q22179 | ResourceCompliantRRPacking.getResourceCompliantRRAllocation | train | private PackingPlanBuilder getResourceCompliantRRAllocation(
PackingPlanBuilder planBuilder, Map<String, Integer> componentChanges)
throws ConstraintViolationException {
Map<String, Integer> componentsToScaleDown =
PackingUtils.getComponentsToScale(componentChanges, PackingUtils.ScalingDirectio... | java | {
"resource": ""
} |
q22180 | ResourceCompliantRRPacking.assignInstancesToContainers | train | private void assignInstancesToContainers(PackingPlanBuilder planBuilder,
Map<String, Integer> parallelismMap,
PolicyType policyType)
throws ConstraintViolationException {
for (String componentName : parallelismMap.keySet()) ... | java | {
"resource": ""
} |
q22181 | ResourceCompliantRRPacking.strictRRpolicy | train | private void strictRRpolicy(PackingPlanBuilder planBuilder,
String componentName) throws ConstraintViolationException {
planBuilder.addInstance(this.containerId, componentName);
this.containerId = nextContainerId(this.containerId);
} | java | {
"resource": ""
} |
q22182 | ResourceCompliantRRPacking.flexibleRRpolicy | train | private void flexibleRRpolicy(PackingPlanBuilder planBuilder,
String componentName) throws ResourceExceededException {
// If there is not enough space on containerId look at other containers in a RR fashion
// starting from containerId.
ContainerIdScorer scorer = new Containe... | java | {
"resource": ""
} |
q22183 | ResourceCompliantRRPacking.removeRRInstance | train | private void removeRRInstance(PackingPlanBuilder packingPlanBuilder,
String componentName) throws RuntimeException {
List<Scorer<Container>> scorers = new ArrayList<>();
scorers.add(new HomogeneityScorer(componentName, true)); // all-same-component containers first
scorers.a... | java | {
"resource": ""
} |
q22184 | TopologyContextImpl.invokeHookSpoutAck | train | public void invokeHookSpoutAck(Object messageId, Duration completeLatency) {
if (taskHooks.size() != 0) {
SpoutAckInfo ackInfo = new SpoutAckInfo(messageId, getThisTaskId(), completeLatency);
for (ITaskHook taskHook : taskHooks) {
taskHook.spoutAck(ackInfo);
}
}
} | java | {
"resource": ""
} |
q22185 | TopologyContextImpl.invokeHookSpoutFail | train | public void invokeHookSpoutFail(Object messageId, Duration failLatency) {
if (taskHooks.size() != 0) {
SpoutFailInfo failInfo = new SpoutFailInfo(messageId, getThisTaskId(), failLatency);
for (ITaskHook taskHook : taskHooks) {
taskHook.spoutFail(failInfo);
}
}
} | java | {
"resource": ""
} |
q22186 | TopologyContextImpl.invokeHookBoltExecute | train | public void invokeHookBoltExecute(Tuple tuple, Duration executeLatency) {
if (taskHooks.size() != 0) {
BoltExecuteInfo executeInfo = new BoltExecuteInfo(tuple, getThisTaskId(), executeLatency);
for (ITaskHook taskHook : taskHooks) {
taskHook.boltExecute(executeInfo);
}
}
} | java | {
"resource": ""
} |
q22187 | TopologyContextImpl.invokeHookBoltAck | train | public void invokeHookBoltAck(Tuple tuple, Duration processLatency) {
if (taskHooks.size() != 0) {
BoltAckInfo ackInfo = new BoltAckInfo(tuple, getThisTaskId(), processLatency);
for (ITaskHook taskHook : taskHooks) {
taskHook.boltAck(ackInfo);
}
}
} | java | {
"resource": ""
} |
q22188 | TopologyContextImpl.invokeHookBoltFail | train | public void invokeHookBoltFail(Tuple tuple, Duration failLatency) {
if (taskHooks.size() != 0) {
BoltFailInfo failInfo = new BoltFailInfo(tuple, getThisTaskId(), failLatency);
for (ITaskHook taskHook : taskHooks) {
taskHook.boltFail(failInfo);
}
}
} | java | {
"resource": ""
} |
q22189 | FileHelper.writeToFile | train | public static void writeToFile(InputStream uploadedInputStream,
String uploadedFileLocation) throws IOException {
File file = new File(uploadedFileLocation);
file.getParentFile().mkdirs();
int read = 0;
byte[] bytes = new byte[1024];
try (OutputStream out = new Fil... | java | {
"resource": ""
} |
q22190 | FileResource.uploadFile | train | @POST
@Path("/upload")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response uploadFile(
@FormDataParam("file") InputStream uploadedInputStream,
@FormDataParam("file") FormDataContentDisposition fileDetail) {
Config config = createConfig();
if (uploadedInputStream == null) {
String ... | java | {
"resource": ""
} |
q22191 | FileResource.downloadFile | train | @GET
@Path("/download/{file}")
public Response downloadFile(final @PathParam("file") String file) {
Config config = createConfig();
String uploadDir = config.getStringValue(FILE_SYSTEM_DIRECTORY);
String filePath = uploadDir + "/" + file;
return getResponseByFile(filePath);
} | java | {
"resource": ""
} |
q22192 | MarathonController.submitTopology | train | public boolean submitTopology(String appConf) {
if (this.isVerbose) {
LOG.log(Level.INFO, "Topology conf is: " + appConf);
}
// Marathon atleast till 1.4.x does not allow upper case jobids
if (!this.topologyName.equals(this.topologyName.toLowerCase())) {
LOG.log(Level.SEVERE, "Marathon sche... | java | {
"resource": ""
} |
q22193 | MetricsCacheSink.startMetricsCacheChecker | train | private void startMetricsCacheChecker() {
final int checkIntervalSec =
TypeUtils.getInteger(sinkConfig.get(KEY_TMASTER_LOCATION_CHECK_INTERVAL_SEC));
Runnable runnable = new Runnable() {
@Override
public void run() {
TopologyMaster.MetricsCacheLocation location =
(Topolo... | java | {
"resource": ""
} |
q22194 | ConfigReader.loadFile | train | @SuppressWarnings("unchecked") // when we cast yaml.load(fin)
public static Map<String, Object> loadFile(String fileName) {
Map<String, Object> props = new HashMap<>();
if (fileName == null) {
LOG.warning("Config file name cannot be null");
return props;
} else if (fileName.isEmpty()) {
... | java | {
"resource": ""
} |
q22195 | ConfigReader.loadStream | train | @SuppressWarnings("unchecked") // yaml.load API returns raw Map
public static Map<String, Object> loadStream(InputStream inputStream) {
LOG.fine("Reading config stream");
Yaml yaml = new Yaml();
Map<Object, Object> propsYaml = (Map<Object, Object>) yaml.load(inputStream);
LOG.fine("Successfully read ... | java | {
"resource": ""
} |
q22196 | Communicator.poll | train | public E poll() {
E result = buffer.poll();
if (producer != null) {
producer.wakeUp();
}
return result;
} | java | {
"resource": ""
} |
q22197 | Communicator.offer | train | public boolean offer(E e) {
buffer.offer(e);
if (consumer != null) {
consumer.wakeUp();
}
return true;
} | java | {
"resource": ""
} |
q22198 | Communicator.drainTo | train | public int drainTo(Collection<? super E> c) {
int result = buffer.drainTo(c);
if (producer != null) {
producer.wakeUp();
}
return result;
} | java | {
"resource": ""
} |
q22199 | NomadScheduler.getTaskSpecDockerDriver | train | Task getTaskSpecDockerDriver(Task task, String taskName, int containerIndex) {
String executorBinary = Context.executorBinary(this.clusterConfig);
// get arguments for heron executor command
String[] executorArgs = SchedulerUtils.executorCommandArgs(
this.clusterConfig, this.runtimeConfig, NomadCon... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.