use of org.apache.flink.runtime.operators.lifecycle.event.OperatorStartedEvent in project flink by apache.
the class MultiInputTestOperator method open.
@Override
public void open() throws Exception {
super.open();
registerTimer();
this.eventQueue.add(new OperatorStartedEvent(operatorId, getRuntimeContext().getIndexOfThisSubtask(), getRuntimeContext().getAttemptNumber()));
}
use of org.apache.flink.runtime.operators.lifecycle.event.OperatorStartedEvent in project flink by apache.
the class TestJobExecutor method waitForFailover.
private void waitForFailover(BlockingQueue<TestEvent> queue) throws Exception {
int timeoutMs = 10_000;
Deadline deadline = Deadline.fromNow(Duration.ofMillis(timeoutMs));
String operatorId = null;
int subtaskId = -1;
int attemptNumber = -1;
while (deadline.hasTimeLeft()) {
TestEvent e = queue.poll(deadline.timeLeft().toMillis(), MILLISECONDS);
if (e instanceof TestCommandAckEvent) {
TestCommandAckEvent ack = (TestCommandAckEvent) e;
if (ack.getCommand() == FAIL) {
operatorId = ack.operatorId;
subtaskId = ack.subtaskIndex;
attemptNumber = ack.getAttemptNumber();
}
} else if (e instanceof OperatorStartedEvent && operatorId != null) {
OperatorStartedEvent started = (OperatorStartedEvent) e;
if (started.operatorId.equals(operatorId) && started.subtaskIndex == subtaskId && started.getAttemptNumber() >= attemptNumber) {
return;
}
}
}
throw new TimeoutException("No subtask restarted in " + timeoutMs + "ms");
}
use of org.apache.flink.runtime.operators.lifecycle.event.OperatorStartedEvent in project flink by apache.
the class TestEventSource method open.
@Override
public void open(Configuration parameters) throws Exception {
super.open(parameters);
this.isRunning = true;
this.scheduledCommands = new LinkedBlockingQueue<>();
this.commandQueue.subscribe(cmd -> scheduledCommands.add(cmd), operatorID);
this.eventQueue.add(new OperatorStartedEvent(operatorID, getRuntimeContext().getIndexOfThisSubtask(), getRuntimeContext().getAttemptNumber()));
}
use of org.apache.flink.runtime.operators.lifecycle.event.OperatorStartedEvent in project flink by apache.
the class OneInputTestStreamOperator method open.
@Override
public void open() throws Exception {
super.open();
this.eventQueue.add(new OperatorStartedEvent(operatorID, getRuntimeContext().getIndexOfThisSubtask(), getRuntimeContext().getAttemptNumber()));
this.dispatcher.subscribe(receivedCommands::add, operatorID);
this.state = getKeyedStateBackend() != null ? getRuntimeContext().getListState(new ListStateDescriptor<>("test", String.class)) : getOperatorStateBackend().getListState(new ListStateDescriptor<>("test", String.class));
}
use of org.apache.flink.runtime.operators.lifecycle.event.OperatorStartedEvent in project flink by apache.
the class TwoInputTestStreamOperator method open.
@Override
public void open() throws Exception {
super.open();
this.eventQueue.add(new OperatorStartedEvent(operatorID, getRuntimeContext().getIndexOfThisSubtask(), getRuntimeContext().getAttemptNumber()));
}
Aggregations