Examples of BSPPeerProtocol


Examples of org.apache.hama.ipc.BSPPeerProtocol

      int port = Integer.parseInt(args[1]);
      InetSocketAddress address = new InetSocketAddress(host, port);
      TaskAttemptID taskid = TaskAttemptID.forName(args[2]);

      // //////////////////
      BSPPeerProtocol umbilical = (BSPPeerProtocol) RPC.getProxy(
          BSPPeerProtocol.class, BSPPeerProtocol.versionID, address,
          defaultConf);

      final BSPTask task = (BSPTask) umbilical.getTask(taskid);
      int peerPort = umbilical.getAssignedPortNum(taskid);

      defaultConf.addResource(new Path(task.getJobFile()));
      BSPJob job = new BSPJob(task.getJobID(), task.getJobFile());

      defaultConf.set(Constants.PEER_HOST, args[3]);
      if (null != args && 5 == args.length) {
        defaultConf.setInt("bsp.checkpoint.port", Integer.parseInt(args[4]));
      }
      defaultConf.setInt(Constants.PEER_PORT, peerPort);

      try {
        // use job-specified working directory
        FileSystem.get(job.getConf()).setWorkingDirectory(
            job.getWorkingDirectory());

        // instantiate and init our peer
        @SuppressWarnings("rawtypes")
        final BSPPeerImpl<?, ?, ?, ?> bspPeer = new BSPPeerImpl(job,
            defaultConf, taskid, umbilical, task.partition, task.splitClass,
            task.split, task.getCounters());

        task.run(job, bspPeer, umbilical); // run the task

      } catch (FSError e) {
        LOG.fatal("FSError from child", e);
        umbilical.fsError(taskid, e.getMessage());
      } catch (SyncException e) {
        LOG.fatal("SyncError from child", e);
        umbilical.fatalError(taskid, e.toString());

        // Report back any failures, for diagnostic purposes
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        e.printStackTrace(new PrintStream(baos));
      } catch (Throwable throwable) {
View Full Code Here

Examples of org.apache.hama.ipc.BSPPeerProtocol

      try {
        BSPJob job = new BSPJob(hamaConf);
        job.setInputFormat(NullInputFormat.class);
        job.setOutputFormat(NullOutputFormat.class);

        final BSPPeerProtocol proto = (BSPPeerProtocol) RPC.getProxy(
            BSPPeerProtocol.class, HamaRPCProtocolVersion.versionID,
            new InetSocketAddress("127.0.0.1", port), hamaConf);

        BSPTask task = new BSPTask();
        task.setConf(job);

        LOG.info("Testing failure case in process - "
            + hamaConf.getInt(TEST_POINT, 0));

        Runtime.getRuntime().addShutdownHook(new Thread() {
          @Override
          public void run() {
            try {
              proto.close();
            } catch (Exception e) {
              // too late to log!
            }
          }
        });
View Full Code Here

Examples of org.apache.hama.ipc.BSPPeerProtocol

      int port = Integer.parseInt(args[1]);
      InetSocketAddress address = new InetSocketAddress(host, port);
      TaskAttemptID taskid = TaskAttemptID.forName(args[2]);

      // //////////////////
      BSPPeerProtocol umbilical = (BSPPeerProtocol) RPC.getProxy(
          BSPPeerProtocol.class, HamaRPCProtocolVersion.versionID, address,
          defaultConf);

      final BSPTask task = (BSPTask) umbilical.getTask(taskid);
      int peerPort = umbilical.getAssignedPortNum(taskid);

      defaultConf.addResource(new Path(task.getJobFile()));
      BSPJob job = new BSPJob(task.getJobID(), task.getJobFile());

      defaultConf.set(Constants.PEER_HOST, args[3]);
      if (null != args && 5 == args.length) {
        defaultConf.setInt("bsp.checkpoint.port", Integer.parseInt(args[4]));
      }
      defaultConf.setInt(Constants.PEER_PORT, peerPort);

      long superstep = Long.parseLong(args[4]);
      TaskStatus.State state = TaskStatus.State.valueOf(args[5]);
      LOG.debug("Starting peer for step " + superstep + " state = " + state);

      try {
        // use job-specified working directory
        FileSystem.get(job.getConfiguration()).setWorkingDirectory(
            job.getWorkingDirectory());

        // instantiate and init our peer
        @SuppressWarnings("rawtypes")
        final BSPPeerImpl<?, ?, ?, ?, ?> bspPeer = new BSPPeerImpl(job,
            defaultConf, taskid, umbilical, task.partition, task.splitClass,
            task.split, task.getCounters(), superstep, state);

        task.run(job, bspPeer, umbilical); // run the task

      } catch (FSError e) {
        LOG.fatal("FSError from child", e);
        umbilical.fsError(taskid, e.getMessage());
        e.printStackTrace();
      } catch (SyncException e) {
        LOG.fatal("SyncError from child", e);
        umbilical.fatalError(taskid, e.toString());

        // Report back any failures, for diagnostic purposes
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        e.printStackTrace(new PrintStream(baos));
        e.printStackTrace();
View Full Code Here

Examples of org.apache.hama.ipc.BSPPeerProtocol

    }
    String[] hostPort = umbilicalAddress.split(":");
    InetSocketAddress address = new InetSocketAddress(hostPort[0],
        Integer.valueOf(hostPort[1]));

    BSPPeerProtocol umbilical = RPC.getProxy(BSPPeerProtocol.class,
        HamaRPCProtocolVersion.versionID, address, conf);

    BSPJob job = new BSPJob(new HamaConfiguration(conf));

    BSPTask task = (BSPTask) umbilical.getTask(id);

    peer = new BSPPeerImpl(job, conf, id, umbilical, id.id, task.splitClass,
        task.split, counters);

    // this is a checked cast because we can only set a class via the BSPJob
View Full Code Here

Examples of org.apache.hama.ipc.BSPPeerProtocol

      try {
        BSPJob job = new BSPJob(hamaConf);
        job.setInputFormat(NullInputFormat.class);
        job.setOutputFormat(NullOutputFormat.class);

        final BSPPeerProtocol proto = (BSPPeerProtocol) RPC.getProxy(
            BSPPeerProtocol.class, HamaRPCProtocolVersion.versionID,
            new InetSocketAddress("127.0.0.1", port), hamaConf);

        BSPTask task = new BSPTask();
        task.setConf(job);

        LOG.info("Testing failure case in process - "
            + hamaConf.getInt(TEST_POINT, 0));

        Runtime.getRuntime().addShutdownHook(new Thread() {
          @Override
          public void run() {
            try {
              proto.close();
            } catch (Exception e) {
              // too late to log!
            }
          }
        });
View Full Code Here

Examples of org.apache.hama.ipc.BSPPeerProtocol

      int port = Integer.parseInt(args[1]);
      InetSocketAddress address = new InetSocketAddress(host, port);
      TaskAttemptID taskid = TaskAttemptID.forName(args[2]);

      // //////////////////
      BSPPeerProtocol umbilical = (BSPPeerProtocol) RPC.getProxy(
          BSPPeerProtocol.class, HamaRPCProtocolVersion.versionID, address,
          defaultConf);

      final BSPTask task = (BSPTask) umbilical.getTask(taskid);
      int peerPort = umbilical.getAssignedPortNum(taskid);

      defaultConf.addResource(new Path(task.getJobFile()));
      BSPJob job = new BSPJob(task.getJobID(), task.getJobFile());

      defaultConf.set(Constants.PEER_HOST, args[3]);
      if (null != args && 5 == args.length) {
        defaultConf.setInt("bsp.checkpoint.port", Integer.parseInt(args[4]));
      }
      defaultConf.setInt(Constants.PEER_PORT, peerPort);

      long superstep = Long.parseLong(args[4]);
      TaskStatus.State state = TaskStatus.State.valueOf(args[5]);
      LOG.debug("Starting peer for sstep " + superstep + " state = " + state);

      try {
        // use job-specified working directory
        FileSystem.get(job.getConfiguration()).setWorkingDirectory(
            job.getWorkingDirectory());

        // instantiate and init our peer
        @SuppressWarnings("rawtypes")
        final BSPPeerImpl<?, ?, ?, ?, ?> bspPeer = new BSPPeerImpl(job,
            defaultConf, taskid, umbilical, task.partition, task.splitClass,
            task.split, task.getCounters(), superstep, state);

        task.run(job, bspPeer, umbilical); // run the task

      } catch (FSError e) {
        LOG.fatal("FSError from child", e);
        umbilical.fsError(taskid, e.getMessage());
        e.printStackTrace();
      } catch (SyncException e) {
        LOG.fatal("SyncError from child", e);
        umbilical.fatalError(taskid, e.toString());

        // Report back any failures, for diagnostic purposes
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        e.printStackTrace(new PrintStream(baos));
        e.printStackTrace();
View Full Code Here

Examples of org.apache.hama.ipc.BSPPeerProtocol

      int port = Integer.parseInt(args[1]);
      InetSocketAddress address = new InetSocketAddress(host, port);
      TaskAttemptID taskid = TaskAttemptID.forName(args[2]);

      // //////////////////
      BSPPeerProtocol umbilical = (BSPPeerProtocol) RPC.getProxy(
          BSPPeerProtocol.class, HamaRPCProtocolVersion.versionID, address,
          defaultConf);

      final BSPTask task = (BSPTask) umbilical.getTask(taskid);
      int peerPort = umbilical.getAssignedPortNum(taskid);

      defaultConf.addResource(new Path(task.getJobFile()));
      BSPJob job = new BSPJob(task.getJobID(), task.getJobFile());

      defaultConf.set(Constants.PEER_HOST, args[3]);
      if (null != args && 5 == args.length) {
        defaultConf.setInt("bsp.checkpoint.port", Integer.parseInt(args[4]));
      }
      defaultConf.setInt(Constants.PEER_PORT, peerPort);

      long superstep = Long.parseLong(args[4]);
      TaskStatus.State state = TaskStatus.State.valueOf(args[5]);
      LOG.debug("Starting peer for sstep " + superstep + " state = " + state);

      try {
        // use job-specified working directory
        FileSystem.get(job.getConfiguration()).setWorkingDirectory(
            job.getWorkingDirectory());

        // instantiate and init our peer
        @SuppressWarnings("rawtypes")
        final BSPPeerImpl<?, ?, ?, ?, ?> bspPeer = new BSPPeerImpl(job,
            defaultConf, taskid, umbilical, task.partition, task.splitClass,
            task.split, task.getCounters(), superstep, state);

        task.run(job, bspPeer, umbilical); // run the task

      } catch (FSError e) {
        LOG.fatal("FSError from child", e);
        umbilical.fsError(taskid, e.getMessage());
        e.printStackTrace();
      } catch (SyncException e) {
        LOG.fatal("SyncError from child", e);
        umbilical.fatalError(taskid, e.toString());

        // Report back any failures, for diagnostic purposes
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        e.printStackTrace(new PrintStream(baos));
        e.printStackTrace();
View Full Code Here

Examples of org.apache.hama.ipc.BSPPeerProtocol

      try {
        BSPJob job = new BSPJob(hamaConf);
        job.setInputFormat(NullInputFormat.class);
        job.setOutputFormat(NullOutputFormat.class);

        final BSPPeerProtocol proto = (BSPPeerProtocol) RPC.getProxy(
            BSPPeerProtocol.class, HamaRPCProtocolVersion.versionID,
            new InetSocketAddress("127.0.0.1", port), hamaConf);

        BSPTask task = new BSPTask();
        task.setConf(job);

        LOG.info("Testing failure case in process - "
            + hamaConf.getInt(TEST_POINT, 0));

        Runtime.getRuntime().addShutdownHook(new Thread() {
          @Override
          public void run() {
            try {
              proto.close();
            } catch (Exception e) {
              // too late to log!
            }
          }
        });
View Full Code Here

Examples of org.apache.hama.ipc.BSPPeerProtocol

      int port = Integer.parseInt(args[1]);
      InetSocketAddress address = new InetSocketAddress(host, port);
      TaskAttemptID taskid = TaskAttemptID.forName(args[2]);

      // //////////////////
      BSPPeerProtocol umbilical = (BSPPeerProtocol) RPC.getProxy(
          BSPPeerProtocol.class, HamaRPCProtocolVersion.versionID, address,
          defaultConf);

      final BSPTask task = (BSPTask) umbilical.getTask(taskid);
      int peerPort = Constants.DEFAULT_PEER_PORT;
      peerPort = BSPNetUtils.getNextAvailable(peerPort);

      defaultConf.addResource(new Path(task.getJobFile()));
      BSPJob job = new BSPJob(task.getJobID(), task.getJobFile());

      defaultConf.set(Constants.PEER_HOST, args[3]);
      if (null != args && 5 == args.length) {
        defaultConf.setInt("bsp.checkpoint.port", Integer.parseInt(args[4]));
      }
      defaultConf.setInt(Constants.PEER_PORT, peerPort);

      long superstep = Long.parseLong(args[4]);
      TaskStatus.State state = TaskStatus.State.valueOf(args[5]);
      LOG.debug("Starting peer for sstep " + superstep + " state = " + state);

      try {
        // use job-specified working directory
        FileSystem.get(job.getConfiguration()).setWorkingDirectory(
            job.getWorkingDirectory());

        // instantiate and init our peer
        @SuppressWarnings("rawtypes")
        final BSPPeerImpl<?, ?, ?, ?, ?> bspPeer = new BSPPeerImpl(job,
            defaultConf, taskid, umbilical, task.partition, task.splitClass,
            task.split, task.getCounters(), superstep, state);

        task.run(job, bspPeer, umbilical); // run the task

      } catch (FSError e) {
        LOG.fatal("FSError from child", e);
        umbilical.fsError(taskid, e.getMessage());
        e.printStackTrace();
      } catch (SyncException e) {
        LOG.fatal("SyncError from child", e);
        umbilical.fatalError(taskid, e.toString());

        // Report back any failures, for diagnostic purposes
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        e.printStackTrace(new PrintStream(baos));
        e.printStackTrace();
View Full Code Here

Examples of org.apache.hama.ipc.BSPPeerProtocol

      int port = Integer.parseInt(args[1]);
      InetSocketAddress address = new InetSocketAddress(host, port);
      TaskAttemptID taskid = TaskAttemptID.forName(args[2]);

      // //////////////////
      BSPPeerProtocol umbilical = (BSPPeerProtocol) RPC.getProxy(
          BSPPeerProtocol.class, HamaRPCProtocolVersion.versionID, address,
          defaultConf);

      final BSPTask task = (BSPTask) umbilical.getTask(taskid);
      int peerPort = umbilical.getAssignedPortNum(taskid);

      defaultConf.addResource(new Path(task.getJobFile()));
      BSPJob job = new BSPJob(task.getJobID(), task.getJobFile());

      defaultConf.set(Constants.PEER_HOST, args[3]);
      if (null != args && 5 == args.length) {
        defaultConf.setInt("bsp.checkpoint.port", Integer.parseInt(args[4]));
      }
      defaultConf.setInt(Constants.PEER_PORT, peerPort);

      long superstep = Long.parseLong(args[4]);
      TaskStatus.State state = TaskStatus.State.valueOf(args[5]);
      LOG.debug("Starting peer for step " + superstep + " state = " + state);

      try {
        // use job-specified working directory
        FileSystem.get(job.getConfiguration()).setWorkingDirectory(
            job.getWorkingDirectory());

        // instantiate and init our peer
        @SuppressWarnings("rawtypes")
        final BSPPeerImpl<?, ?, ?, ?, ?> bspPeer = new BSPPeerImpl(job,
            defaultConf, taskid, umbilical, task.partition, task.splitClass,
            task.split, task.getCounters(), superstep, state);

        task.run(job, bspPeer, umbilical); // run the task

      } catch (FSError e) {
        LOG.fatal("FSError from child", e);
        umbilical.fsError(taskid, e.getMessage());
        e.printStackTrace();
      } catch (SyncException e) {
        LOG.fatal("SyncError from child", e);
        umbilical.fatalError(taskid, e.toString());

        // Report back any failures, for diagnostic purposes
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        e.printStackTrace(new PrintStream(baos));
        e.printStackTrace();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.