use of com.spotify.helios.servicescommon.EventSender in project helios by spotify.
the class ZooKeeperAgentModel method setTaskStatus.
/**
* Set the {@link TaskStatus} for the job identified by {@code jobId}.
*/
@Override
public void setTaskStatus(final JobId jobId, final TaskStatus status) throws InterruptedException {
log.debug("setting task status: {}", status);
taskStatuses.put(jobId.toString(), status.toJsonBytes());
if (historyWriter != null) {
try {
historyWriter.saveHistoryItem(status);
} catch (Exception e) {
// Log error here and keep going as saving task history is not critical.
// This is to prevent bad data in the queue from screwing up the actually important Helios
// agent operations.
log.error("Error saving task status {} to ZooKeeper: {}", status, e);
}
}
final TaskStatusEvent event = new TaskStatusEvent(status, System.currentTimeMillis(), agent);
final byte[] message = event.toJsonBytes();
for (final EventSender sender : eventSenders) {
sender.send(taskStatusEventTopic, message);
}
}
use of com.spotify.helios.servicescommon.EventSender in project helios by spotify.
the class UndeployFilteringTest method setUp.
@Before
public void setUp() throws Exception {
// make zookeeper interfaces
curator = zk().curatorWithSuperAuth();
final ZooKeeperClientProvider zkcp = new ZooKeeperClientProvider(new DefaultZooKeeperClient(curator), ZooKeeperModelReporter.noop());
final List<EventSender> eventSenders = Collections.emptyList();
zkMasterModel = new ZooKeeperMasterModel(zkcp, getClass().getName(), eventSenders, "");
startDefaultMaster();
agent = startDefaultAgent(TEST_HOST);
client = defaultClient();
awaitHostRegistered(client, TEST_HOST, LONG_WAIT_SECONDS, SECONDS);
}
use of com.spotify.helios.servicescommon.EventSender in project helios by spotify.
the class ZooKeeperMasterModelIntegrationTest method setup.
@Before
public void setup() throws Exception {
final RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
final CuratorFramework curator = CuratorFrameworkFactory.newClient(zk.connectString(), retryPolicy);
curator.start();
final ZooKeeperClient client = new DefaultZooKeeperClient(curator);
// TODO (dano): this bootstrapping is essentially duplicated from MasterService,
// should be moved into ZooKeeperMasterModel?
client.ensurePath(Paths.configHosts());
client.ensurePath(Paths.configJobs());
client.ensurePath(Paths.configJobRefs());
client.ensurePath(Paths.statusHosts());
client.ensurePath(Paths.statusMasters());
client.ensurePath(Paths.historyJobs());
final ZooKeeperClientProvider zkProvider = new ZooKeeperClientProvider(client, ZooKeeperModelReporter.noop());
final List<EventSender> eventSenders = ImmutableList.of(eventSender);
model = new ZooKeeperMasterModel(zkProvider, getClass().getName(), eventSenders, deploymentGroupEventTopic);
}
use of com.spotify.helios.servicescommon.EventSender in project helios by spotify.
the class TaskHistoryWriterTest method setUp.
@Before
public void setUp() throws Exception {
zk = new ZooKeeperTestingServerManager();
agentStateDirs = Files.createTempDirectory("helios-agents");
client = new DefaultZooKeeperClient(zk.curatorWithSuperAuth());
makeWriter(client);
final ZooKeeperClientProvider zkProvider = new ZooKeeperClientProvider(client, ZooKeeperModelReporter.noop());
final List<EventSender> eventSenders = Collections.emptyList();
masterModel = new ZooKeeperMasterModel(zkProvider, "test", eventSenders, TaskStatusEvent.TASK_STATUS_EVENT_TOPIC);
client.ensurePath(Paths.configJobs());
client.ensurePath(Paths.configJobRefs());
client.ensurePath(Paths.historyJobHostEvents(JOB_ID, HOSTNAME));
masterModel.registerHost(HOSTNAME, "foo");
masterModel.addJob(JOB);
}
Aggregations