Package org.apache.hama.bsp

Examples of org.apache.hama.bsp.TaskAttemptID


    final PeerSyncClient syncClient = SyncServiceFactory
        .getPeerSyncClient(conf);
    assertTrue(syncClient instanceof ZooKeeperSyncClientImpl);
    BSPJobID jobId = new BSPJobID("abc", 1);
    TaskAttemptID taskId = new TaskAttemptID(new TaskID(jobId, 1), 1);
    syncClient.init(conf, jobId, taskId);

    Runtime.getRuntime().addShutdownHook(new Thread() {
      @Override
      public void run() {
View Full Code Here


        TreeMap<TaskAttemptID, String> taskAttemptSortedMap = new TreeMap<TaskAttemptID, String>();
        for (String s : allPeers) {
          byte[] data = zk.getData(constructKey(taskId.getJobID(), "peers", s),
              this, null);
          TaskAttemptID thatTask = new TaskAttemptID();
          boolean result = getValueFromBytes(data, thatTask);

          if (result) {
            taskAttemptSortedMap.put(thatTask, s);
          }
        }
        for (Map.Entry<TaskAttemptID, String> entry : taskAttemptSortedMap
            .entrySet()) {
          TaskAttemptID thatTask = entry.getKey();
          String s = entry.getValue();
          LOG.debug("TASK mapping from zookeeper: " + thatTask + " ID:"
              + thatTask.getTaskID().getId() + " : " + s);
          sortedMap.put(thatTask.getTaskID().getId(), s);
        }
      } catch (Exception e) {
        LOG.error(e);
        throw new RuntimeException("All peer names could not be retrieved!");
      }
View Full Code Here

        }
      }
    }

    // wrap the command in a stdout/stderr capture
    TaskAttemptID taskid = peer.getTaskId();
    File stdout = TaskLog.getTaskLogFile(taskid, TaskLog.LogName.STDOUT);
    File stderr = TaskLog.getTaskLogFile(taskid, TaskLog.LogName.STDERR);
    // Get the desired maximum length of task's logs.
    long logLength = TaskLog.getTaskLogLength(peer.getConfiguration());
    if (!streamingEnabled) {
View Full Code Here

    }
    queue.close();
  }

  public DiskQueue<IntWritable> getQueue() {
    TaskAttemptID id = new TaskAttemptID(new TaskID("123", 1, 2), 0);
    DiskQueue<IntWritable> queue = new DiskQueue<IntWritable>();
    // normally this is injected via reflection
    queue.setConf(conf);
    queue.init(conf, id);
    return queue;
View Full Code Here

    InetSocketAddress peer = new InetSocketAddress(
        BSPNetUtils.getCanonicalHostname(), BSPNetUtils.getFreePort());

    BSPPeer<?, ?, ?, ?, Writable> dummyPeer = new BSPPeerImpl<NullWritable, NullWritable, NullWritable, NullWritable, Writable>(
        conf, FileSystem.get(conf), new Counters());
    TaskAttemptID id = new TaskAttemptID("1", 1, 1, 1);
    messageManager.init(id, dummyPeer, conf, peer);

    messageManager.transfer(peer, randomBundle);

    messageManager.clearOutgoingQueues();
View Full Code Here

    InetSocketAddress peer = new InetSocketAddress(
        BSPNetUtils.getCanonicalHostname(), BSPNetUtils.getFreePort()
            + (increment++));
    BSPPeer<?, ?, ?, ?, IntWritable> dummyPeer = new BSPPeerImpl<NullWritable, NullWritable, NullWritable, NullWritable, IntWritable>(
        conf, FileSystem.get(conf), new Counters());
    TaskAttemptID id = new TaskAttemptID("1", 1, 1, 1);
    messageManager.init(id, dummyPeer, conf, peer);
    String peerName = peer.getHostName() + ":" + peer.getPort();

    messageManager.send(peerName, new IntWritable(1337));
View Full Code Here

    final PeerSyncClient syncClient = SyncServiceFactory
        .getPeerSyncClient(conf);
    assertTrue(syncClient instanceof ZooKeeperSyncClientImpl);
    BSPJobID jobId = new BSPJobID("abc", 1);
    TaskAttemptID taskId = new TaskAttemptID(new TaskID(jobId, 1), 1);
    syncClient.init(conf, jobId, taskId);

    Runtime.getRuntime().addShutdownHook(new Thread() {
      @Override
      public void run() {
View Full Code Here

            this).toArray(new String[0]);

        for (String s : allPeers) {
          byte[] data = zk.getData(constructKey(taskId.getJobID(), "peers", s),
              this, null);
          TaskAttemptID thatTask = new TaskAttemptID();
          boolean result = getValueFromBytes(data, thatTask);

          if (result) {
            LOG.debug("TASK mapping from zookeeper: " + thatTask + " ID:"
                + thatTask.getTaskID().getId() + " : " + s);
            sortedMap.put(thatTask.getTaskID().getId(), s);
          }

        }

      } catch (Exception e) {
View Full Code Here

    }
    queue.close();
  }

  public DiskQueue<IntWritable> getQueue() {
    TaskAttemptID id = new TaskAttemptID(new TaskID("123", 1, 2), 0);
    DiskQueue<IntWritable> queue = new DiskQueue<IntWritable>();
    // normally this is injected via reflection
    queue.setConf(conf);
    queue.init(conf, id);
    return queue;
View Full Code Here

   */
  public void testTextSpillingQueue() throws Exception {

    String msg = "Testing the spillage of spilling buffer";
    Text text = new Text(msg);
    TaskAttemptID id = new TaskAttemptID(new TaskID("123", 1, 2), 0);
    SpillingQueue<Text> queue = new SpillingQueue<Text>();
    Configuration conf = new HamaConfiguration();

    String fileName = System.getProperty("java.io.tmpdir") + File.separatorChar
        + new BigInteger(128, new SecureRandom()).toString(32);
View Full Code Here

TOP

Related Classes of org.apache.hama.bsp.TaskAttemptID

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.