Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@
<url>https://vip.creatis.insa-lyon.fr:9007/nexus/repository/snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class BatchOptions {

/* value in millis */
@JsonProperty(value = "commandExecutionTimeoutInMillis")
private int commandExecutionTimeout = 10;
private int commandExecutionTimeout = 10000;

/* value in millis */
@JsonProperty(value = "sshEventTimeoutInMillis")
Expand All @@ -36,4 +36,4 @@ public class BatchOptions {

@JsonProperty("customPreJobCommands")
private List<String> customPreJobCommands = new ArrayList<>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public void clean() {
try {
if (remoteCommand.execute(config).failed()) {
log.warn("Failed to execute the remote command: {}", remoteCommand.getCommand());
remoteCommand.logFailure();
}
} catch (GaswException e) {
log.error("Failed to destroy the batch manager !", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.Collection;
import java.util.EnumSet;
import java.util.concurrent.TimeUnit;
import java.util.Set;

import org.apache.sshd.client.SshClient;
import org.apache.sshd.client.channel.ChannelExec;
Expand Down Expand Up @@ -118,8 +119,14 @@ private RemoteOutput executeCommand(final String command) throws GaswException {
channel.setOut(stdout);
channel.setErr(stderr);

channel.open().verify(config.getOptions().getCommandExecutionTimeout(), TimeUnit.SECONDS);
channel.waitFor(EnumSet.of(ClientChannelEvent.CLOSED, ClientChannelEvent.EXIT_STATUS), config.getOptions().getSshEventTimeout());
channel.open().verify(config.getOptions().getCommandExecutionTimeout(), TimeUnit.MILLISECONDS);

final Set<ClientChannelEvent> events = channel.waitFor(
EnumSet.of(ClientChannelEvent.CLOSED, ClientChannelEvent.EXIT_STATUS),
config.getOptions().getCommandExecutionTimeout());
if (events.contains(ClientChannelEvent.TIMEOUT)) {
log.warn("Command timed out after {} ms: {}", config.getOptions().getCommandExecutionTimeout(), command);
}

return new RemoteOutput(stdout.toString(), stderr.toString(), channel.getExitStatus());
} catch (IOException e) {
Expand Down
Loading