use of org.apache.hyracks.api.comm.PartitionChannel in project asterixdb by apache.
the class PartitionCollector method addPartitions.
@Override
public void addPartitions(Collection<PartitionChannel> partitions) throws HyracksException {
for (PartitionChannel pc : partitions) {
PartitionId pid = pc.getPartitionId();
IInputChannel channel = pc.getInputChannel();
pa.addPartition(pid, channel);
channel.open(ctx);
}
}
use of org.apache.hyracks.api.comm.PartitionChannel in project asterixdb by apache.
the class StartTasksWork method createInputChannels.
/**
* Create a list of known channels for each input connector
*
* @param td
* the task attempt id
* @param inputs
* the input connector descriptors
* @return a list of known channels, one for each connector
* @throws UnknownHostException
*/
private List<List<PartitionChannel>> createInputChannels(TaskAttemptDescriptor td, List<IConnectorDescriptor> inputs) throws UnknownHostException {
NetworkAddress[][] inputAddresses = td.getInputPartitionLocations();
List<List<PartitionChannel>> channelsForInputConnectors = new ArrayList<>();
if (inputAddresses != null) {
for (int i = 0; i < inputAddresses.length; i++) {
List<PartitionChannel> channels = new ArrayList<>();
if (inputAddresses[i] != null) {
for (int j = 0; j < inputAddresses[i].length; j++) {
NetworkAddress networkAddress = inputAddresses[i][j];
PartitionId pid = new PartitionId(jobId, inputs.get(i).getConnectorId(), j, td.getTaskAttemptId().getTaskId().getPartition());
PartitionChannel channel = new PartitionChannel(pid, new NetworkInputChannel(ncs.getNetworkManager(), new InetSocketAddress(InetAddress.getByAddress(networkAddress.lookupIpAddress()), networkAddress.getPort()), pid, 5));
channels.add(channel);
}
}
channelsForInputConnectors.add(channels);
}
}
return channelsForInputConnectors;
}
use of org.apache.hyracks.api.comm.PartitionChannel in project asterixdb by apache.
the class ReportPartitionAvailabilityWork method run.
@Override
public void run() {
try {
Map<JobId, Joblet> jobletMap = ncs.getJobletMap();
Joblet ji = jobletMap.get(pid.getJobId());
if (ji != null) {
PartitionChannel channel = new PartitionChannel(pid, new NetworkInputChannel(ncs.getNetworkManager(), new InetSocketAddress(InetAddress.getByAddress(networkAddress.lookupIpAddress()), networkAddress.getPort()), pid, 5));
ji.reportPartitionAvailability(channel);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.apache.hyracks.api.comm.PartitionChannel in project asterixdb by apache.
the class ReceiveSideMaterializingCollector method addPartitions.
@Override
public void addPartitions(Collection<PartitionChannel> partitions) throws HyracksException {
for (final PartitionChannel pc : partitions) {
PartitionWriter writer = new PartitionWriter(pc);
executor.execute(writer);
}
}
Aggregations