org.apache.reef.driver.client.JobMessageObserver Java Examples

The following examples show how to use org.apache.reef.driver.client.JobMessageObserver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NemoDriver.java    From nemo with Apache License 2.0 6 votes vote down vote up
@Inject
private NemoDriver(final UserApplicationRunner userApplicationRunner,
                   final RuntimeMaster runtimeMaster,
                   final NameServer nameServer,
                   final LocalAddressProvider localAddressProvider,
                   final JobMessageObserver client,
                   @Parameter(JobConf.ExecutorJsonContents.class) final String resourceSpecificationString,
                   @Parameter(JobConf.JobId.class) final String jobId,
                   @Parameter(JobConf.FileDirectory.class) final String localDirectory,
                   @Parameter(JobConf.GlusterVolumeDirectory.class) final String glusterDirectory) {
  IdManager.setInDriver();
  this.userApplicationRunner = userApplicationRunner;
  this.runtimeMaster = runtimeMaster;
  this.nameServer = nameServer;
  this.localAddressProvider = localAddressProvider;
  this.resourceSpecificationString = resourceSpecificationString;
  this.jobId = jobId;
  this.localDirectory = localDirectory;
  this.glusterDirectory = glusterDirectory;
  this.client = client;
  this.handler = new RemoteClientMessageLoggingHandler(client);
}
 
Example #2
Source File: NemoDriver.java    From incubator-nemo with Apache License 2.0 5 votes vote down vote up
@Inject
private NemoDriver(final UserApplicationRunner userApplicationRunner,
                   final RuntimeMaster runtimeMaster,
                   final NameServer nameServer,
                   final LocalAddressProvider localAddressProvider,
                   final JobMessageObserver client,
                   final ClientRPC clientRPC,
                   final DataPlaneConf dataPlaneConf,
                   @Parameter(JobConf.ExecutorJSONContents.class) final String resourceSpecificationString,
                   @Parameter(JobConf.BandwidthJSONContents.class) final String bandwidthString,
                   @Parameter(JobConf.JobId.class) final String jobId,
                   @Parameter(JobConf.FileDirectory.class) final String localDirectory,
                   @Parameter(JobConf.GlusterVolumeDirectory.class) final String glusterDirectory) {
  IdManager.setInDriver();
  this.userApplicationRunner = userApplicationRunner;
  this.runtimeMaster = runtimeMaster;
  this.nameServer = nameServer;
  this.localAddressProvider = localAddressProvider;
  this.resourceSpecificationString = resourceSpecificationString;
  this.jobId = jobId;
  this.localDirectory = localDirectory;
  this.glusterDirectory = glusterDirectory;
  this.handler = new RemoteClientMessageLoggingHandler(client);
  this.clientRPC = clientRPC;
  this.dataPlaneConf = dataPlaneConf;
  // TODO #69: Support job-wide execution property
  ResourceSitePass.setBandwidthSpecificationString(bandwidthString);
  clientRPC.registerHandler(ControlMessage.ClientToDriverMessageType.Notification, this::handleNotification);
  clientRPC.registerHandler(ControlMessage.ClientToDriverMessageType.LaunchDAG, message -> {
    startSchedulingUserDAG(message.getLaunchDAG().getDag());
    final Map<Serializable, Object> broadcastVars =
      SerializationUtils.deserialize(message.getLaunchDAG().getBroadcastVars().toByteArray());
    BroadcastManagerMaster.registerBroadcastVariablesFromClient(broadcastVars);
  });
  clientRPC.registerHandler(ControlMessage.ClientToDriverMessageType.DriverShutdown, message -> shutdown());
  // Send DriverStarted message to the client
  clientRPC.send(ControlMessage.DriverToClientMessage.newBuilder()
    .setType(ControlMessage.DriverToClientMessageType.DriverStarted).build());
}
 
Example #3
Source File: SuspendDriver.java    From reef with Apache License 2.0 5 votes vote down vote up
/**
 * Job driver constructor.
 * All parameters are injected from TANG automatically.
 *
 * @param evaluatorRequestor is used to request Evaluators.
 * @param numCycles          number of cycles to run in the task.
 * @param delay              delay in seconds between cycles in the task.
 */
@Inject
SuspendDriver(
    final JobMessageObserver jobMessageObserver,
    final EvaluatorRequestor evaluatorRequestor,
    @Parameter(Launch.Local.class) final boolean isLocal,
    @Parameter(Launch.NumCycles.class) final int numCycles,
    @Parameter(Launch.Delay.class) final int delay) {

  this.jobMessageObserver = jobMessageObserver;
  this.evaluatorRequestor = evaluatorRequestor;

  try {

    final Configuration checkpointServiceConfig = FSCheckPointServiceConfiguration.CONF
        .set(FSCheckPointServiceConfiguration.IS_LOCAL, Boolean.toString(isLocal))
        .set(FSCheckPointServiceConfiguration.PATH, "/tmp")
        .set(FSCheckPointServiceConfiguration.PREFIX, "reef-checkpoint-")
        .set(FSCheckPointServiceConfiguration.REPLICATION_FACTOR, "3")
        .build();

    final JavaConfigurationBuilder cb = Tang.Factory.getTang().newConfigurationBuilder()
        .bindNamedParameter(Launch.NumCycles.class, Integer.toString(numCycles))
        .bindNamedParameter(Launch.Delay.class, Integer.toString(delay));

    cb.addConfiguration(checkpointServiceConfig);
    this.contextConfig = cb.build();

  } catch (final BindException ex) {
    throw new RuntimeException(ex);
  }
}
 
Example #4
Source File: JobDriver.java    From reef with Apache License 2.0 5 votes vote down vote up
/**
 * Job driver constructor.
 * All parameters are injected from TANG automatically.
 *
 * @param clock                      Wake clock to schedule and check up running jobs.
 * @param jobMessageObserver         is used to send messages back to the client.
 * @param evaluatorRequestor         is used to request Evaluators.
 * @param activeContextBridgeFactory
 */
@Inject
JobDriver(final Clock clock,
          final HttpServer httpServer,
          final NameServer nameServer,
          final JobMessageObserver jobMessageObserver,
          final EvaluatorRequestor evaluatorRequestor,
          final DriverStatusManager driverStatusManager,
          final LoggingScopeFactory loggingScopeFactory,
          final LocalAddressProvider localAddressProvider,
          final ActiveContextBridgeFactory activeContextBridgeFactory,
          final REEFFileNames reefFileNames,
          final AllocatedEvaluatorBridgeFactory allocatedEvaluatorBridgeFactory,
          final CLRProcessFactory clrProcessFactory,
          @Parameter(DefinedRuntimes.class) final Set<String> definedRuntimes) {
  this.clock = clock;
  this.httpServer = httpServer;
  this.jobMessageObserver = jobMessageObserver;
  this.evaluatorRequestor = evaluatorRequestor;
  this.nameServer = nameServer;
  this.driverStatusManager = driverStatusManager;
  this.activeContextBridgeFactory = activeContextBridgeFactory;
  this.allocatedEvaluatorBridgeFactory = allocatedEvaluatorBridgeFactory;
  this.nameServerInfo = localAddressProvider.getLocalAddress() + ":" + this.nameServer.getPort();
  this.loggingScopeFactory = loggingScopeFactory;
  this.reefFileNames = reefFileNames;
  this.localAddressProvider = localAddressProvider;
  this.clrProcessFactory = clrProcessFactory;
  this.definedRuntimes = definedRuntimes;
}
 
Example #5
Source File: RemoteClientMessageLoggingHandler.java    From incubator-nemo with Apache License 2.0 4 votes vote down vote up
public RemoteClientMessageLoggingHandler(final JobMessageObserver client) {
  this.client = client;
  this.closed = new AtomicBoolean(false);
  this.formatter = new SimpleFormatter();
}
 
Example #6
Source File: RemoteClientMessageLoggingHandler.java    From nemo with Apache License 2.0 4 votes vote down vote up
public RemoteClientMessageLoggingHandler(final JobMessageObserver client) {
  this.client = client;
  this.closed = new AtomicBoolean(false);
  this.formatter = new SimpleFormatter();
}
 
Example #7
Source File: EvaluatorReuseTestDriver.java    From reef with Apache License 2.0 4 votes vote down vote up
@Inject
EvaluatorReuseTestDriver(@Parameter(NumberOfIterations.class) final int n,
                         final JobMessageObserver client) {
  this.numberOfIterations = n;
  this.client = client;
}
 
Example #8
Source File: DriverFailOnFail.java    From reef with Apache License 2.0 4 votes vote down vote up
@Inject
public DriverFailOnFail(final JobMessageObserver client, final EvaluatorRequestor requestor) {
  this.client = client;
  this.requestor = requestor;
}
 
Example #9
Source File: StatePassingDriver.java    From reef with Apache License 2.0 4 votes vote down vote up
@Inject
public StatePassingDriver(final JobMessageObserver client) {
  this.client = client;
}
 
Example #10
Source File: DriverMessagingDriver.java    From reef with Apache License 2.0 4 votes vote down vote up
@Inject
DriverMessagingDriver(final Clock clock, final JobMessageObserver client) {
  this.clock = clock;
  this.client = client;
}
 
Example #11
Source File: TaskMessagingDriver.java    From reef with Apache License 2.0 4 votes vote down vote up
@Inject
public TaskMessagingDriver(final JobMessageObserver client, final Clock clock) {
  this.client = client;
  this.clock = clock;
}