Search in sources :

Example 1 with JobConnectorConfiguration

use of com.netflix.titus.runtime.connector.jobmanager.JobConnectorConfiguration in project titus-control-plane by Netflix.

the class CommandContext method getJobManagementClientWithKeepAlive.

public RemoteJobManagementClient getJobManagementClientWithKeepAlive(long keepAliveInternalMs) {
    JobManagementServiceGrpc.JobManagementServiceStub stub = getJobManagementGrpcStub();
    ReactorJobManagementServiceStub reactorStub = getGrpcToReactorClientFactory().apply(stub, ReactorJobManagementServiceStub.class, JobManagementServiceGrpc.getServiceDescriptor());
    JobConnectorConfiguration configuration = Archaius2Ext.newConfiguration(JobConnectorConfiguration.class, "titus.connector.jobService.keepAliveIntervalMs", "" + keepAliveInternalMs);
    return new RemoteJobManagementClientWithKeepAlive("cli", configuration, stub, reactorStub, titusRuntime);
}
Also used : JobManagementServiceGrpc(com.netflix.titus.grpc.protogen.JobManagementServiceGrpc) ReactorJobManagementServiceStub(com.netflix.titus.runtime.connector.jobmanager.ReactorJobManagementServiceStub) JobConnectorConfiguration(com.netflix.titus.runtime.connector.jobmanager.JobConnectorConfiguration) RemoteJobManagementClientWithKeepAlive(com.netflix.titus.runtime.connector.jobmanager.RemoteJobManagementClientWithKeepAlive)

Example 2 with JobConnectorConfiguration

use of com.netflix.titus.runtime.connector.jobmanager.JobConnectorConfiguration in project titus-control-plane by Netflix.

the class StreamDataReplicatorPerf method main.

public static void main(String[] args) throws InterruptedException {
    TitusRuntime titusRuntime = TitusRuntimes.internal();
    JobManagementClient client = Mockito.mock(JobManagementClient.class);
    JobConnectorConfiguration configuration = Mockito.mock(JobConnectorConfiguration.class);
    Mockito.when(client.observeJobs(ArgumentMatchers.any())).thenAnswer(invocation -> Flux.defer(() -> {
        JobManagerEvent jobUpdateEvent = JobUpdateEvent.newJob(JOB, JobManagerConstants.GRPC_REPLICATOR_CALL_METADATA);
        JobManagerEvent taskUpdateEvent = TaskUpdateEvent.newTask(JOB, TASK, JobManagerConstants.GRPC_REPLICATOR_CALL_METADATA);
        return Flux.just(jobUpdateEvent, JobManagerEvent.snapshotMarker()).concatWith(Flux.interval(Duration.ofSeconds(1)).take(1).map(tick -> taskUpdateEvent)).concatWith(Flux.interval(Duration.ofSeconds(1)).take(1).flatMap(tick -> Flux.error(new RuntimeException("Simulated error"))));
    }));
    JobDataReplicator replicator = new JobDataReplicatorProvider(configuration, client, JobSnapshotFactories.newDefault(titusRuntime), titusRuntime).get();
    replicator.events().subscribe(System.out::println);
    Thread.sleep(3600_000);
}
Also used : JobManagerConstants(com.netflix.titus.api.jobmanager.service.JobManagerConstants) Job(com.netflix.titus.api.jobmanager.model.job.Job) ArgumentMatchers(org.mockito.ArgumentMatchers) JobUpdateEvent(com.netflix.titus.api.jobmanager.model.job.event.JobUpdateEvent) JobSnapshotFactories(com.netflix.titus.runtime.connector.jobmanager.snapshot.JobSnapshotFactories) Task(com.netflix.titus.api.jobmanager.model.job.Task) JobDataReplicator(com.netflix.titus.runtime.connector.jobmanager.JobDataReplicator) JobGenerator(com.netflix.titus.testkit.model.job.JobGenerator) JobManagerEvent(com.netflix.titus.api.jobmanager.model.job.event.JobManagerEvent) Mockito(org.mockito.Mockito) Flux(reactor.core.publisher.Flux) TaskUpdateEvent(com.netflix.titus.api.jobmanager.model.job.event.TaskUpdateEvent) TitusRuntimes(com.netflix.titus.common.runtime.TitusRuntimes) JobConnectorConfiguration(com.netflix.titus.runtime.connector.jobmanager.JobConnectorConfiguration) JobDataReplicatorProvider(com.netflix.titus.runtime.connector.jobmanager.replicator.JobDataReplicatorProvider) Duration(java.time.Duration) JobManagementClient(com.netflix.titus.runtime.connector.jobmanager.JobManagementClient) TitusRuntime(com.netflix.titus.common.runtime.TitusRuntime) JobDataReplicator(com.netflix.titus.runtime.connector.jobmanager.JobDataReplicator) JobDataReplicatorProvider(com.netflix.titus.runtime.connector.jobmanager.replicator.JobDataReplicatorProvider) JobConnectorConfiguration(com.netflix.titus.runtime.connector.jobmanager.JobConnectorConfiguration) JobManagerEvent(com.netflix.titus.api.jobmanager.model.job.event.JobManagerEvent) JobManagementClient(com.netflix.titus.runtime.connector.jobmanager.JobManagementClient) TitusRuntime(com.netflix.titus.common.runtime.TitusRuntime)

Aggregations

JobConnectorConfiguration (com.netflix.titus.runtime.connector.jobmanager.JobConnectorConfiguration)2 Job (com.netflix.titus.api.jobmanager.model.job.Job)1 Task (com.netflix.titus.api.jobmanager.model.job.Task)1 JobManagerEvent (com.netflix.titus.api.jobmanager.model.job.event.JobManagerEvent)1 JobUpdateEvent (com.netflix.titus.api.jobmanager.model.job.event.JobUpdateEvent)1 TaskUpdateEvent (com.netflix.titus.api.jobmanager.model.job.event.TaskUpdateEvent)1 JobManagerConstants (com.netflix.titus.api.jobmanager.service.JobManagerConstants)1 TitusRuntime (com.netflix.titus.common.runtime.TitusRuntime)1 TitusRuntimes (com.netflix.titus.common.runtime.TitusRuntimes)1 JobManagementServiceGrpc (com.netflix.titus.grpc.protogen.JobManagementServiceGrpc)1 JobDataReplicator (com.netflix.titus.runtime.connector.jobmanager.JobDataReplicator)1 JobManagementClient (com.netflix.titus.runtime.connector.jobmanager.JobManagementClient)1 ReactorJobManagementServiceStub (com.netflix.titus.runtime.connector.jobmanager.ReactorJobManagementServiceStub)1 RemoteJobManagementClientWithKeepAlive (com.netflix.titus.runtime.connector.jobmanager.RemoteJobManagementClientWithKeepAlive)1 JobDataReplicatorProvider (com.netflix.titus.runtime.connector.jobmanager.replicator.JobDataReplicatorProvider)1 JobSnapshotFactories (com.netflix.titus.runtime.connector.jobmanager.snapshot.JobSnapshotFactories)1 JobGenerator (com.netflix.titus.testkit.model.job.JobGenerator)1 Duration (java.time.Duration)1 ArgumentMatchers (org.mockito.ArgumentMatchers)1 Mockito (org.mockito.Mockito)1