@Test public void testSuccessfulEviction() { Job<BatchJobExt> job = TestDataFactory.newBatchJob("job1", 1, newSelfManagedDisruptionBudget(1_000)); relocationConnectorStubs.addJob(job); relocationConnectorStubs.setQuota("job1", 1); Task task = jobOperations.getTasks().get(0); relocationConnectorStubs.place(TestDataFactory.REMOVABLE_INSTANCE_GROUP, task); TaskRelocationPlan taskRelocationPlan = oneMigrationPlan().toBuilder().withTaskId(task.getId()).build(); Map<String, TaskRelocationStatus> result = step.evict(Collections.singletonMap(task.getId(), taskRelocationPlan)); assertThat(result).hasSize(1); TaskRelocationStatus relocationStatus = result.get(task.getId()); assertThat(relocationStatus.getTaskId()).isEqualTo(task.getId()); assertThat(relocationStatus.getStatusCode()).isEqualTo(TaskRelocationStatus.STATUS_CODE_TERMINATED); assertThat(relocationStatus.getTaskRelocationPlan()).isEqualTo(taskRelocationPlan); }
public Map<String, TaskRelocationStatus> evict(Map<String, TaskRelocationPlan> taskToEvict) { Stopwatch stopwatch = Stopwatch.createStarted(); try { Map<String, TaskRelocationStatus> result = execute(taskToEvict); metrics.onSuccess(result.size(), stopwatch.elapsed(TimeUnit.MILLISECONDS)); logger.debug("Eviction result: {}", result); return result; } catch (Exception e) { logger.error("Step processing error", e); metrics.onError(stopwatch.elapsed(TimeUnit.MILLISECONDS)); throw e; } }
TaskEvictionStep { public Map<String, TaskRelocationStatus> evict(Map<String, TaskRelocationPlan> taskToEvict) { Stopwatch stopwatch = Stopwatch.createStarted(); try { Map<String, TaskRelocationStatus> result = execute(taskToEvict); metrics.onSuccess(result.size(), stopwatch.elapsed(TimeUnit.MILLISECONDS)); logger.debug("Eviction result: {}", result); return result; } catch (Exception e) { logger.error("Step processing error", e); metrics.onError(stopwatch.elapsed(TimeUnit.MILLISECONDS)); throw e; } } }
TaskEvictionStep { public Map<String, TaskRelocationStatus> evict(Map<String, TaskRelocationPlan> taskToEvict) { Stopwatch stopwatch = Stopwatch.createStarted(); try { Map<String, TaskRelocationStatus> result = execute(taskToEvict); metrics.onSuccess(result.size(), stopwatch.elapsed(TimeUnit.MILLISECONDS)); logger.debug("Eviction result: {}", result); return result; } catch (Exception e) { logger.error("Step processing error", e); metrics.onError(stopwatch.elapsed(TimeUnit.MILLISECONDS)); throw e; } } TaskEvictionStep(EvictionServiceClient evictionServiceClient,
                            TitusRuntime titusRuntime,
                            RelocationTransactionLogger transactionLog,
                            Scheduler scheduler); }
TaskEvictionStep { public Map<String, TaskRelocationStatus> evict(Map<String, TaskRelocationPlan> taskToEvict) { Stopwatch stopwatch = Stopwatch.createStarted(); try { Map<String, TaskRelocationStatus> result = execute(taskToEvict); metrics.onSuccess(result.size(), stopwatch.elapsed(TimeUnit.MILLISECONDS)); logger.debug("Eviction result: {}", result); return result; } catch (Exception e) { logger.error("Step processing error", e); metrics.onError(stopwatch.elapsed(TimeUnit.MILLISECONDS)); throw e; } } TaskEvictionStep(EvictionServiceClient evictionServiceClient,
                            TitusRuntime titusRuntime,
                            RelocationTransactionLogger transactionLog,
                            Scheduler scheduler); Map<String, TaskRelocationStatus> evict(Map<String, TaskRelocationPlan> taskToEvict); }
TaskEvictionStep { public Map<String, TaskRelocationStatus> evict(Map<String, TaskRelocationPlan> taskToEvict) { Stopwatch stopwatch = Stopwatch.createStarted(); try { Map<String, TaskRelocationStatus> result = execute(taskToEvict); metrics.onSuccess(result.size(), stopwatch.elapsed(TimeUnit.MILLISECONDS)); logger.debug("Eviction result: {}", result); return result; } catch (Exception e) { logger.error("Step processing error", e); metrics.onError(stopwatch.elapsed(TimeUnit.MILLISECONDS)); throw e; } } TaskEvictionStep(EvictionServiceClient evictionServiceClient,
                            TitusRuntime titusRuntime,
                            RelocationTransactionLogger transactionLog,
                            Scheduler scheduler); Map<String, TaskRelocationStatus> evict(Map<String, TaskRelocationPlan> taskToEvict);  }