Hi @erigaud,
Before running the commands, how have you validated nothing is running / cluster is not in use?
A few suggestions:
Make sure that the cluster is in a running state before you submit the command. The CommandExecutionAPI has a method to ensure the cluster is running
Creating a new execution context for each command can add overhead. Instead, create an execution context once and reuse it for multiple commands. This can be done by creating an execution context and then using it for subsequent commands
// Create an execution context
Created context = commandExecutionService.create(new CreateContext(clusterID, language));
String contextId = context.getId();
// Execute commands using the created context
Command command = new Command(clusterID, contextId, language, commandStr);
Created commandResponse = commandExecutionService.execute(command);