flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GJL <...@git.apache.org>
Subject [GitHub] flink issue #4933: [FLINK-7960] [tests] Fix race conditions in ExecutionGrap...
Date Wed, 01 Nov 2017 16:20:32 GMT
Github user GJL commented on the issue:

    https://github.com/apache/flink/pull/4933
  
    While you are at it: 
    
    `ExecutionGraphTestUtils#switchToRunning` 
    ```
    public static void switchToRunning(ExecutionGraph eg) {
    		// check that all execution are in state DEPLOYING
    		for (ExecutionVertex ev : eg.getAllExecutionVertices()) {
    			final Execution exec = ev.getCurrentExecutionAttempt();
    			assert(exec.getState() == ExecutionState.DEPLOYING);
    		}
    
    		// switch executions to RUNNING
    		for (ExecutionVertex ev : eg.getAllExecutionVertices()) {
    			final Execution exec = ev.getCurrentExecutionAttempt();
    			exec.switchToRunning();
    		}
    	}
    ```
    
    could be improved to
    
    ```
    public static void switchToRunning(ExecutionGraph eg) {
    		// check that all execution are in state DEPLOYING
    		for (ExecutionVertex ev : eg.getAllExecutionVertices()) {
    			final Execution exec = ev.getCurrentExecutionAttempt();
    			final ExecutionState executionState = exec.getState();
    			assert executionState == ExecutionState.DEPLOYING 
    				: "Expected executionState to be DEPLOYING, was: " + executionState;
    		}
    
    		// switch executions to RUNNING
    		for (ExecutionVertex ev : eg.getAllExecutionVertices()) {
    			final Execution exec = ev.getCurrentExecutionAttempt();
    			exec.switchToRunning();
    		}
    	}
    ```
    
    so that the failure reason is more obvious.


---

Mime
View raw message