Skip to content

Commit 27bbb47

Browse files
authored
Revert "Reconnect offline agents" (#360)
1 parent f2f07da commit 27bbb47

5 files changed

Lines changed: 22 additions & 32 deletions

File tree

src/main/java/com/microsoft/azure/vmagent/AzureVMCloudOnceRetentionStrategy.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ public long check(final AzureVMComputer agentComputer) {
3838
done(agentComputer);
3939
}
4040
}
41-
42-
if (agentComputer.isOffline() && !agentComputer.isConnecting() && agentComputer.isLaunchSupported()) {
43-
agentComputer.tryReconnect();
44-
}
45-
4641
return 1;
4742
}
4843

src/main/java/com/microsoft/azure/vmagent/AzureVMCloudPoolRetentionStrategy.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,12 @@ public void run() {
9898
final int currentPoolSize
9999
= ((AzureVMCloudPoolRetentionStrategy) currentTemplate.getRetentionStrategy()).getPoolSize();
100100

101-
Computer.threadPoolForRemoting.submit(() -> checkPoolSizeAndDelete(agentComputer, currentPoolSize));
102-
103-
if (agentComputer.isOffline() && !agentComputer.isConnecting() && agentComputer.isLaunchSupported()) {
104-
agentComputer.tryReconnect();
105-
}
101+
Computer.threadPoolForRemoting.submit(new Runnable() {
102+
@Override
103+
public void run() {
104+
checkPoolSizeAndDelete(agentComputer, currentPoolSize);
105+
}
106+
});
106107

107108
return 1;
108109
}

src/main/java/com/microsoft/azure/vmagent/AzureVMCloudRetensionStrategy.java

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,38 +61,39 @@ public long check(@NonNull AzureVMComputer agentNode) {
6161
return check(agentNode, new ExecutionEngine());
6262
}
6363

64-
protected long check(final AzureVMComputer agentComputer, ExecutionEngine executionEngine) {
64+
protected long check(final AzureVMComputer agentNode, ExecutionEngine executionEngine) {
6565
// Determine whether we can recycle this machine.
6666
// The CRS is the way that nodes that are currently operating "correctly"
6767
// can be retained/reclaimed. Any failure modes need to be dealt with through
68-
// the cleanup task.
68+
// the clean up task.
6969

70+
boolean canRecycle = true;
7071
// Node must be idle
71-
boolean canRecycle = agentComputer.isIdle();
72+
canRecycle &= agentNode.isIdle();
7273
// The node must also be online. This also implies not temporarily disconnected
7374
// (like by a user).
74-
canRecycle &= agentComputer.isOnline();
75+
canRecycle &= agentNode.isOnline();
7576
// The configured idle time must be > 0 (which means leave forever)
7677
canRecycle &= idleTerminationMillis > 0;
7778
// The number of ms it's been idle must be greater than the current idle time.
78-
canRecycle &= idleTerminationMillis < (System.currentTimeMillis() - agentComputer.getIdleStartMilliseconds());
79+
canRecycle &= idleTerminationMillis < (System.currentTimeMillis() - agentNode.getIdleStartMilliseconds());
7980

80-
if (agentComputer.getNode() == null) {
81+
if (agentNode.getNode() == null) {
8182
return 1;
8283
}
8384

84-
final AzureVMAgent agent = agentComputer.getNode();
85+
final AzureVMAgent agent = agentNode.getNode();
8586

8687
if (canRecycle) {
8788
LOGGER.log(Level.INFO, "Idle timeout reached for agent: {0}, action: {1}",
88-
new Object[]{agentComputer.getName(), agent.isShutdownOnIdle() ? "shutdown" : "delete"});
89+
new Object[]{agentNode.getName(), agent.isShutdownOnIdle() ? "shutdown" : "delete"});
8990

9091
Callable<Void> task = () -> {
9192
// Block cleanup while we execute so the cleanup task doesn't try to take it
9293
// away (node will go offline). Also blocks cleanup in case of shutdown.
9394
agent.blockCleanUpAction();
9495
if (agent.isShutdownOnIdle()) {
95-
LOGGER.log(Level.INFO, "Going to idleTimeout agent: {0}", agentComputer.getName());
96+
LOGGER.log(Level.INFO, "Going to idleTimeout agent: {0}", agentNode.getName());
9697
agent.shutdown(Messages._Idle_Timeout_Shutdown());
9798
} else {
9899
agent.deprovision(Messages._Idle_Timeout_Delete());
@@ -111,31 +112,24 @@ protected long check(final AzureVMComputer agentComputer, ExecutionEngine execut
111112
defaultTimeoutInSeconds
112113
));
113114
} catch (AzureCloudException ae) {
114-
LOGGER.log(Level.WARNING, String.format("Could not terminate or shutdown %s",
115-
agentComputer.getName()), ae);
115+
LOGGER.log(Level.WARNING, String.format("Could not terminate or shutdown %s", agentNode.getName()), ae);
116116
// If we have an exception, set the agent for deletion.
117117
// It's unlikely we'll be able to shut it down properly ever.
118-
AzureVMAgent node = agentComputer.getNode();
118+
AzureVMAgent node = agentNode.getNode();
119119
if (node != null) {
120120
node.setCleanUpAction(CleanUpAction.DELETE, Messages._Failed_Initial_Shutdown_Or_Delete());
121121
}
122122
} catch (Exception e) {
123123
LOGGER.log(Level.WARNING,
124-
String.format("Exception occurred while calling timeout on node %s",
125-
agentComputer.getName()), e);
124+
String.format("Exception occurred while calling timeout on node %s", agentNode.getName()), e);
126125
// If we have an exception, set the agent for deletion.
127126
// It's unlikely we'll be able to shut it down properly ever.
128-
AzureVMAgent node = agentComputer.getNode();
127+
AzureVMAgent node = agentNode.getNode();
129128
if (node != null) {
130129
node.setCleanUpAction(CleanUpAction.DELETE, Messages._Failed_Initial_Shutdown_Or_Delete());
131130
}
132131
}
133132
}
134-
135-
if (agentComputer.isOffline() && !agentComputer.isConnecting() && agentComputer.isLaunchSupported()) {
136-
agentComputer.tryReconnect();
137-
}
138-
139133
return 1;
140134
}
141135

src/main/resources/scripts/ubuntuInstallMavenScript.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Install Maven
22

3-
MAVEN_VERSION=3.8.5
3+
MAVEN_VERSION=3.8.4
44

55
sudo curl -O https://downloads.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz
66
sudo tar zxvf apache-maven-${MAVEN_VERSION}-bin.tar.gz -C /opt/

src/main/webapp/help-initScript.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
sudo apt-get install -y git
1818

1919
# Install Maven
20-
MAVEN_VERSION=3.8.5
20+
MAVEN_VERSION=3.8.4
2121

2222
sudo curl -O https://downloads.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz
2323
sudo tar zxvf apache-maven-${MAVEN_VERSION}-bin.tar.gz -C /opt/

0 commit comments

Comments
 (0)