forked from awslabs/ec2-spot-jenkins-plugin
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix unnecessary decrement of maxTotalUses and add clarity to logs aro…
…und terminations triggered by plugin (#375) * rename EC2TerminationCause to EC2ExecutorInterruptionCause for clarity * -add and track EC2AgentTerminationReason when plugin triggers termination -rename force to overrideOtherSettings in scheduleToTerminate for clarity #363 * [fix] remove unnecessary decrement which could lead to -1 (has special meaning) [fix] remove misleading log and redundant set #363 * update and add tests * rename overrideOtherSettings to ignoreMinConstraints
- Loading branch information
Showing
15 changed files
with
290 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/com/amazon/jenkins/ec2fleet/EC2AgentTerminationReason.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.amazon.jenkins.ec2fleet; | ||
|
||
/** | ||
* Enum to represent the reason for termination of an EC2 instance by the plugin. | ||
*/ | ||
public enum EC2AgentTerminationReason { | ||
IDLE_FOR_TOO_LONG("Agent idle for too long"), | ||
MAX_TOTAL_USES_EXHAUSTED("MaxTotalUses exhausted for agent"), | ||
EXCESS_CAPACITY("Excess capacity for fleet"), | ||
AGENT_DELETED("Agent deleted"); | ||
|
||
private final String description; | ||
|
||
EC2AgentTerminationReason(String description) { | ||
this.description = description; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public static EC2AgentTerminationReason fromDescription(String desc) { | ||
for (EC2AgentTerminationReason reason: values()) { | ||
if(reason.description.equalsIgnoreCase(desc)) { | ||
return reason; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return this.description; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.