Search in sources :

Example 1 with PartitionChannel

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);
    }
}
Also used : PartitionChannel(org.apache.hyracks.api.comm.PartitionChannel) PartitionId(org.apache.hyracks.api.partitions.PartitionId) IInputChannel(org.apache.hyracks.api.channels.IInputChannel)

Example 2 with PartitionChannel

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;
}
Also used : PartitionChannel(org.apache.hyracks.api.comm.PartitionChannel) NetworkAddress(org.apache.hyracks.api.comm.NetworkAddress) InetSocketAddress(java.net.InetSocketAddress) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) PartitionId(org.apache.hyracks.api.partitions.PartitionId) NetworkInputChannel(org.apache.hyracks.comm.channels.NetworkInputChannel)

Example 3 with PartitionChannel

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);
    }
}
Also used : PartitionChannel(org.apache.hyracks.api.comm.PartitionChannel) InetSocketAddress(java.net.InetSocketAddress) NetworkInputChannel(org.apache.hyracks.comm.channels.NetworkInputChannel) JobId(org.apache.hyracks.api.job.JobId) Joblet(org.apache.hyracks.control.nc.Joblet)

Example 4 with PartitionChannel

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);
    }
}
Also used : PartitionChannel(org.apache.hyracks.api.comm.PartitionChannel)

Aggregations

PartitionChannel (org.apache.hyracks.api.comm.PartitionChannel)4 InetSocketAddress (java.net.InetSocketAddress)2 PartitionId (org.apache.hyracks.api.partitions.PartitionId)2 NetworkInputChannel (org.apache.hyracks.comm.channels.NetworkInputChannel)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 IInputChannel (org.apache.hyracks.api.channels.IInputChannel)1 NetworkAddress (org.apache.hyracks.api.comm.NetworkAddress)1 JobId (org.apache.hyracks.api.job.JobId)1 Joblet (org.apache.hyracks.control.nc.Joblet)1