Search in sources :

Example 26 with SchedulerDriver

use of org.apache.mesos.SchedulerDriver in project jesos by groupon.

the class LocalSchedulerMessageProcessor method frameworkRegistered.

@Subscribe
public void frameworkRegistered(final FrameworkRegisteredMessageEnvelope envelope) {
    checkState(envelope.getRecipient().equals(context.getDriverUPID()), "Received a remote message for local delivery");
    final FrameworkRegisteredMessage frameworkRegisteredMessage = envelope.getMessage();
    if (!masterIsValid(frameworkRegisteredMessage.getMasterInfo())) {
        return;
    }
    final FrameworkID frameworkId = frameworkRegisteredMessage.getFrameworkId();
    context.connected();
    context.setFailover(false);
    context.setFrameworkId(frameworkId);
    eventBus.post(new SchedulerCallback() {

        @Override
        public Runnable getCallback(final Scheduler scheduler, final SchedulerDriver schedulerDriver) {
            return new Runnable() {

                @Override
                public void run() {
                    scheduler.registered(schedulerDriver, frameworkId, context.getMaster());
                }
            };
        }
    });
}
Also used : Scheduler(org.apache.mesos.Scheduler) FrameworkRegisteredMessage(mesos.internal.Messages.FrameworkRegisteredMessage) FrameworkID(org.apache.mesos.Protos.FrameworkID) SchedulerDriver(org.apache.mesos.SchedulerDriver) Subscribe(com.google.common.eventbus.Subscribe)

Aggregations

SchedulerDriver (org.apache.mesos.SchedulerDriver)26 Scheduler (org.apache.mesos.Scheduler)10 Subscribe (com.google.common.eventbus.Subscribe)8 Protos (org.apache.mesos.Protos)8 UPID (com.groupon.mesos.util.UPID)6 Properties (java.util.Properties)6 Before (org.junit.Before)6 Config (com.twitter.heron.spi.common.Config)4 StateStore (com.mesosphere.sdk.state.StateStore)3 FrameworkID (org.apache.mesos.Protos.FrameworkID)3 Test (org.junit.Test)3 Plan (com.mesosphere.sdk.scheduler.plan.Plan)2 BaseContainer (com.twitter.heron.scheduler.mesos.framework.BaseContainer)2 MesosFramework (com.twitter.heron.scheduler.mesos.framework.MesosFramework)2 Config (org.apache.heron.spi.common.Config)2 Offer (org.apache.mesos.Protos.Offer)2 TaskStatus (org.apache.mesos.Protos.TaskStatus)2 Etcd (com.chinaunicom.etcd.v2.Etcd)1 RestfulServerConfiguration (com.dangdang.ddframe.job.cloud.scheduler.env.RestfulServerConfiguration)1 ProducerManager (com.dangdang.ddframe.job.cloud.scheduler.producer.ProducerManager)1