Notifies the standalone slave agency that the master agency is missing
772189
def spawn_missing_master(self):
        '''
        
        '''
        d = defer.succeed(None)
        if callable(self.on_master_missing_cb):
            d.addCallback(defer.drop_param, self.on_master_missing_cb)
        return d
140198
final void setMaster() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.entry(this, tc, "setMaster");

        synchronized (getMessageLockArtefact()) {
            master = compatibilityWrapperOrSelf;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.exit(this, tc, "setMaster");
    }
832980
private void deliverMasterChangedAnnouncement(final DeviceUpdate update) {
        for (final MasterListener listener : getMasterListeners()) {
            try {
                listener.masterChanged(update);
            } catch (Throwable t) {
                logger.warn("Problem delivering master changed announcement to listener", t);
            }
        }
    }
630835
@Override
	public String agentStatus() {

		StringBuilder sb = new StringBuilder();

		// Messages
		LinkedBlockingQueue<Message> agentQueue = this.messagingClient.getMessageProcessor().getMessageQueue();
		if( agentQueue.isEmpty() ) {
			sb.append( "There is no message being processed in agent queue\n" );

		} else {
			sb.append( "Agent " + getScopedInstancePath() + " (" + getApplicationName() + ")\n" );
			sb.append( "The number total of messages in agent queue is : " + agentQueue.size() + "\n" );
			sb.append( "The types of messages being processed are : " + "\n");
			for( Message msg : agentQueue ) {
				sb.append( msg.getClass().getSimpleName() + "\n" );
			}
		}

		// Running processes
		Process p = ProcessStore.getProcess(this.applicationName, this.scopedInstancePath);
		if( p != null )
			sb.append( "Be careful. A recipe is under execution." );
		else
			sb.append( "No recipe is under execution." );

		return sb.toString();
	}
1043355
def agent_show(self, agent_id, **kwargs):
        ""
        api_path = "/api/v2/agents/{agent_id}"
        api_path = api_path.format(agent_id=agent_id)
        return self.call(api_path, **kwargs)
195865
def __StartMaster(self):
        
    num_masters = len(self.cluster.get_instances_in_role("master", "running"))
    assert(num_masters < 1)
    logging.info( "waiting for masters to start")
    if self.config.master_on_spot_instances:          
      self.__LaunchSpotMasterInstances()
    else:
      self.__LaunchOnDemandMasterInstances()
    time.sleep(1)
    self.__ConfigureMaster()
    return True
1043763
def agents_me_update(self, data, **kwargs):
        ""
        api_path = "/api/v2/agents/me"
        return self.call(api_path, method="PUT", data=data, **kwargs)
205337
private void deliverBeatAnnouncement(final Beat beat) {
        for (final MasterListener listener : getMasterListeners()) {
            try {
                listener.newBeat(beat);
            } catch (Throwable t) {
                logger.warn("Problem delivering master beat announcement to listener", t);
            }
        }
    }
384370
def _setup_master(self):
        
        self.broker = mitogen.master.Broker(install_watcher=False)
        self.router = mitogen.master.Router(
            broker=self.broker,
            max_message_size=4096 * 1048576,
        )
        self._setup_responder(self.router.responder)
        mitogen.core.listen(self.broker, 'shutdown', self.on_broker_shutdown)
        mitogen.core.listen(self.broker, 'exit', self.on_broker_exit)
        self.listener = mitogen.unix.Listener(
            router=self.router,
            path=self.unix_listener_path,
            backlog=C.DEFAULT_FORKS,
        )
        self._enable_router_debug()
        self._enable_stack_dumps()
568916
public void waitForNewMaster(int timeoutMs) throws TimeoutException, InterruptedException {
    CommonUtils.waitFor("the new leader master to start", () -> getLeaderIndex() != -1,
        WaitForOptions.defaults().setTimeoutMs(timeoutMs));
  }
1095673
public void startAgent (AgentObject agent)
    {
        agent.setLocal(AgentData.class, new AgentData());

        Bureau bureau = _bureaus.get(agent.bureauId);
        if (bureau != null && bureau.ready()) {
            _omgr.registerObject(agent);

            log.info("Bureau ready, sending createAgent", "agent", agent.which());
            BureauSender.createAgent(bureau.clientObj, agent.getOid());
            bureau.agentStates.put(agent, AgentState.STARTED);
            bureau.summarize();
            return;
        }

        if (bureau == null) {
            LauncherEntry launcherEntry = _launchers.get(agent.bureauType);
            if (launcherEntry == null) {
                log.warning("Launcher not found", "agent", agent.which());
                return;
            }

            log.info("Creating new bureau", "bureauId", agent.bureauId, "launcher", launcherEntry);
            bureau = new Bureau();
            bureau.bureauId = agent.bureauId;
            bureau.token = generateToken(bureau.bureauId);
            bureau.launcherEntry = launcherEntry;
            _invoker.postUnit(new LauncherUnit(bureau, _omgr));
            _bureaus.put(agent.bureauId, bureau);
        }

        _omgr.registerObject(agent);
        bureau.agentStates.put(agent, AgentState.PENDING);

        log.info("Bureau not ready, pending agent", "agent", agent.which());
        bureau.summarize();
    }
1196987
private boolean checkMisroutedIv2IntiateTaskMessage(Iv2InitiateTaskMessage message) {
        if (message.isForReplica()) {
            return false;
        }

        if (m_scheduler.isLeader() && m_migratePartitionLeaderStatus != MigratePartitionLeaderStatus.TXN_RESTART) {
            //At this point, the message is sent to partition leader
            return false;
        }

        //At this point, the message is misrouted.
        //(1) If a site has been demoted via @MigratePartitionLeader, the messages which are sent to the leader will be restarted.
        //(2) If a site becomes new leader via @MigratePartitionLeader. Transactions will be restarted before it gets notification from old
        //    leader that transactions on older leader have been drained.
        InitiateResponseMessage response = new InitiateResponseMessage(message);
        response.setMisrouted(message.getStoredProcedureInvocation());
        response.m_sourceHSId = getHSId();
        deliver(response);
        if (tmLog.isDebugEnabled()) {
            tmLog.debug("Sending message back on:" + CoreUtils.hsIdToString(m_hsId) + " isLeader:" + m_scheduler.isLeader() +
                    " status:" + m_migratePartitionLeaderStatus + "\n" + message);
        }
        //notify the new partition leader that the old leader has completed the Txns if needed.
        notifyNewLeaderOfTxnDoneIfNeeded();
        return true;
    }
766820
private void updateFederatedManagerService() {
        if (!activated) {
            return;
        }

        if (profileManager.getReference() != null) {
            Tr.info(tc, "FEDERATED_MANAGER_SERVICE_READY");
        } else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Some required federated manager services are not available.");
            }
        }
    }
1268997
function(self, id) {
  let msg = {action: 'record', id: id};
  self.service.agent.notify(Constants.KEYWORDS.MASTER_WATCHER, msg);
}
906848
def detached(self, worker):
        """"""
        for wfb in self.attaching_workers + self.workers:
            if wfb.worker == worker:
                break
        else:
            log.msg("WEIRD: Builder.detached(%s) (%s)"
                    " not in attaching_workers(%s)"
                    " or workers(%s)" % (worker, worker.workername,
                                         self.attaching_workers,
                                         self.workers))
            return

        if wfb in self.attaching_workers:
            self.attaching_workers.remove(wfb)
        if wfb in self.workers:
            self.workers.remove(wfb)

        # inform the WorkerForBuilder that their worker went away
        wfb.detached()
1136344
def merge_null_missing(request,name,field,pkeys):
  ""
  request.update({rk:None for rk in [FieldKey(name,pkey,field) for pkey in pkeys] if rk not in request})
604644
def respond_to_missing?(method, _include_private = false)
      if @key && _resource.respond_to?(@key) && (delegate = _resource.send(@key)) && delegate.respond_to?(method.to_s)
        true
      else
        _resource.respond_to?(method.to_s)
      end
    end