Skip to content

Commit f131cf1

Browse files
Amazon MWAA now lets you choose a worker replacement strategy when updating an environment. This release adds two worker replacement strategies: FORCED (default), which stops workers immediately, and GRACEFUL, which allows workers to finish current tasks before shutting down.
1 parent 764fa09 commit f131cf1

File tree

8 files changed

+201
-55
lines changed

8 files changed

+201
-55
lines changed

generator/ServiceModels/mwaa/mwaa-2020-07-01.api.json

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,8 @@
568568
"Status":{"shape":"UpdateStatus"},
569569
"CreatedAt":{"shape":"UpdateCreatedAt"},
570570
"Error":{"shape":"UpdateError"},
571-
"Source":{"shape":"UpdateSource"}
571+
"Source":{"shape":"UpdateSource"},
572+
"WorkerReplacementStrategy":{"shape":"WorkerReplacementStrategy"}
572573
}
573574
},
574575
"ListEnvironmentsInput":{
@@ -988,26 +989,27 @@
988989
"locationName":"Name"
989990
},
990991
"ExecutionRoleArn":{"shape":"IamRoleArn"},
992+
"AirflowConfigurationOptions":{"shape":"AirflowConfigurationOptions"},
991993
"AirflowVersion":{"shape":"AirflowVersion"},
992-
"SourceBucketArn":{"shape":"S3BucketArn"},
993994
"DagS3Path":{"shape":"RelativePath"},
995+
"EnvironmentClass":{"shape":"EnvironmentClass"},
996+
"LoggingConfiguration":{"shape":"LoggingConfigurationInput"},
997+
"MaxWorkers":{"shape":"MaxWorkers"},
998+
"MinWorkers":{"shape":"MinWorkers"},
999+
"MaxWebservers":{"shape":"MaxWebservers"},
1000+
"MinWebservers":{"shape":"MinWebservers"},
1001+
"WorkerReplacementStrategy":{"shape":"WorkerReplacementStrategy"},
1002+
"NetworkConfiguration":{"shape":"UpdateNetworkConfigurationInput"},
9941003
"PluginsS3Path":{"shape":"RelativePath"},
9951004
"PluginsS3ObjectVersion":{"shape":"S3ObjectVersion"},
9961005
"RequirementsS3Path":{"shape":"RelativePath"},
9971006
"RequirementsS3ObjectVersion":{"shape":"S3ObjectVersion"},
1007+
"Schedulers":{"shape":"Schedulers"},
1008+
"SourceBucketArn":{"shape":"S3BucketArn"},
9981009
"StartupScriptS3Path":{"shape":"RelativePath"},
9991010
"StartupScriptS3ObjectVersion":{"shape":"S3ObjectVersion"},
1000-
"AirflowConfigurationOptions":{"shape":"AirflowConfigurationOptions"},
1001-
"EnvironmentClass":{"shape":"EnvironmentClass"},
1002-
"MaxWorkers":{"shape":"MaxWorkers"},
1003-
"NetworkConfiguration":{"shape":"UpdateNetworkConfigurationInput"},
1004-
"LoggingConfiguration":{"shape":"LoggingConfigurationInput"},
1005-
"WeeklyMaintenanceWindowStart":{"shape":"WeeklyMaintenanceWindowStart"},
10061011
"WebserverAccessMode":{"shape":"WebserverAccessMode"},
1007-
"MinWorkers":{"shape":"MinWorkers"},
1008-
"Schedulers":{"shape":"Schedulers"},
1009-
"MinWebservers":{"shape":"MinWebservers"},
1010-
"MaxWebservers":{"shape":"MaxWebservers"}
1012+
"WeeklyMaintenanceWindowStart":{"shape":"WeeklyMaintenanceWindowStart"}
10111013
}
10121014
},
10131015
"UpdateEnvironmentOutput":{
@@ -1079,6 +1081,13 @@
10791081
"max":9,
10801082
"min":1,
10811083
"pattern":".*(MON|TUE|WED|THU|FRI|SAT|SUN):([01]\\d|2[0-3]):(00|30).*"
1084+
},
1085+
"WorkerReplacementStrategy":{
1086+
"type":"string",
1087+
"enum":[
1088+
"FORCED",
1089+
"GRACEFUL"
1090+
]
10821091
}
10831092
}
10841093
}

generator/ServiceModels/mwaa/mwaa-2020-07-01.docs.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,13 @@
692692
"Environment$WeeklyMaintenanceWindowStart": "<p>The day and time of the week in Coordinated Universal Time (UTC) 24-hour standard time that weekly maintenance updates are scheduled. For example: <code>TUE:03:30</code>.</p>",
693693
"UpdateEnvironmentInput$WeeklyMaintenanceWindowStart": "<p>The day and time of the week in Coordinated Universal Time (UTC) 24-hour standard time to start weekly maintenance updates of your environment in the following format: <code>DAY:HH:MM</code>. For example: <code>TUE:03:30</code>. You can specify a start time in 30 minute increments only.</p>"
694694
}
695+
},
696+
"WorkerReplacementStrategy": {
697+
"base": null,
698+
"refs": {
699+
"LastUpdate$WorkerReplacementStrategy": "<p>The worker replacement strategy used in the last update of the environment.</p>",
700+
"UpdateEnvironmentInput$WorkerReplacementStrategy": "<p>The worker replacement strategy to use when updating the environment.</p> <p>You can select one of the following strategies:</p> <ul> <li> <p> <b>Forced -</b> Stops and replaces Apache Airflow workers without waiting for tasks to complete before an update.</p> </li> <li> <p> <b>Graceful -</b> Allows Apache Airflow workers to complete running tasks for up to 12 hours during an update before they're stopped and replaced.</p> </li> </ul>"
701+
}
695702
}
696703
}
697704
}

generator/ServiceModels/mwaa/mwaa-2020-07-01.normal.json

Lines changed: 58 additions & 43 deletions
Large diffs are not rendered by default.

sdk/src/Services/MWAA/Generated/Model/Internal/MarshallTransformations/LastUpdateUnmarshaller.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ public LastUpdate Unmarshall(JsonUnmarshallerContext context)
9090
unmarshalledObject.Status = unmarshaller.Unmarshall(context);
9191
continue;
9292
}
93+
if (context.TestExpression("WorkerReplacementStrategy", targetDepth))
94+
{
95+
var unmarshaller = StringUnmarshaller.Instance;
96+
unmarshalledObject.WorkerReplacementStrategy = unmarshaller.Unmarshall(context);
97+
continue;
98+
}
9399
}
94100
return unmarshalledObject;
95101
}

sdk/src/Services/MWAA/Generated/Model/Internal/MarshallTransformations/UpdateEnvironmentRequestMarshaller.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ public IRequest Marshall(UpdateEnvironmentRequest publicRequest)
214214
context.Writer.Write(publicRequest.WeeklyMaintenanceWindowStart);
215215
}
216216

217+
if(publicRequest.IsSetWorkerReplacementStrategy())
218+
{
219+
context.Writer.WritePropertyName("WorkerReplacementStrategy");
220+
context.Writer.Write(publicRequest.WorkerReplacementStrategy);
221+
}
222+
217223
writer.WriteObjectEnd();
218224
string snippet = stringWriter.ToString();
219225
request.Content = System.Text.Encoding.UTF8.GetBytes(snippet);

sdk/src/Services/MWAA/Generated/Model/LastUpdate.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public partial class LastUpdate
3939
private UpdateError _error;
4040
private string _source;
4141
private UpdateStatus _status;
42+
private WorkerReplacementStrategy _workerReplacementStrategy;
4243

4344
/// <summary>
4445
/// Gets and sets the property CreatedAt.
@@ -114,5 +115,23 @@ internal bool IsSetStatus()
114115
return this._status != null;
115116
}
116117

118+
/// <summary>
119+
/// Gets and sets the property WorkerReplacementStrategy.
120+
/// <para>
121+
/// The worker replacement strategy used in the last update of the environment.
122+
/// </para>
123+
/// </summary>
124+
public WorkerReplacementStrategy WorkerReplacementStrategy
125+
{
126+
get { return this._workerReplacementStrategy; }
127+
set { this._workerReplacementStrategy = value; }
128+
}
129+
130+
// Check to see if WorkerReplacementStrategy property is set
131+
internal bool IsSetWorkerReplacementStrategy()
132+
{
133+
return this._workerReplacementStrategy != null;
134+
}
135+
117136
}
118137
}

sdk/src/Services/MWAA/Generated/Model/UpdateEnvironmentRequest.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public partial class UpdateEnvironmentRequest : AmazonMWAARequest
5757
private string _startupScriptS3Path;
5858
private WebserverAccessMode _webserverAccessMode;
5959
private string _weeklyMaintenanceWindowStart;
60+
private WorkerReplacementStrategy _workerReplacementStrategy;
6061

6162
/// <summary>
6263
/// Gets and sets the property AirflowConfigurationOptions.
@@ -573,5 +574,38 @@ internal bool IsSetWeeklyMaintenanceWindowStart()
573574
return this._weeklyMaintenanceWindowStart != null;
574575
}
575576

577+
/// <summary>
578+
/// Gets and sets the property WorkerReplacementStrategy.
579+
/// <para>
580+
/// The worker replacement strategy to use when updating the environment.
581+
/// </para>
582+
///
583+
/// <para>
584+
/// You can select one of the following strategies:
585+
/// </para>
586+
/// <ul> <li>
587+
/// <para>
588+
/// <b>Forced -</b> Stops and replaces Apache Airflow workers without waiting for tasks
589+
/// to complete before an update.
590+
/// </para>
591+
/// </li> <li>
592+
/// <para>
593+
/// <b>Graceful -</b> Allows Apache Airflow workers to complete running tasks for up
594+
/// to 12 hours during an update before they're stopped and replaced.
595+
/// </para>
596+
/// </li> </ul>
597+
/// </summary>
598+
public WorkerReplacementStrategy WorkerReplacementStrategy
599+
{
600+
get { return this._workerReplacementStrategy; }
601+
set { this._workerReplacementStrategy = value; }
602+
}
603+
604+
// Check to see if WorkerReplacementStrategy property is set
605+
internal bool IsSetWorkerReplacementStrategy()
606+
{
607+
return this._workerReplacementStrategy != null;
608+
}
609+
576610
}
577611
}

sdk/src/Services/MWAA/Generated/ServiceEnumerations.cs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,4 +541,54 @@ public static implicit operator WebserverAccessMode(string value)
541541
}
542542
}
543543

544+
545+
/// <summary>
546+
/// Constants used for properties of type WorkerReplacementStrategy.
547+
/// </summary>
548+
public class WorkerReplacementStrategy : ConstantClass
549+
{
550+
551+
/// <summary>
552+
/// Constant FORCED for WorkerReplacementStrategy
553+
/// </summary>
554+
public static readonly WorkerReplacementStrategy FORCED = new WorkerReplacementStrategy("FORCED");
555+
/// <summary>
556+
/// Constant GRACEFUL for WorkerReplacementStrategy
557+
/// </summary>
558+
public static readonly WorkerReplacementStrategy GRACEFUL = new WorkerReplacementStrategy("GRACEFUL");
559+
560+
/// <summary>
561+
/// This constant constructor does not need to be called if the constant
562+
/// you are attempting to use is already defined as a static instance of
563+
/// this class.
564+
/// This constructor should be used to construct constants that are not
565+
/// defined as statics, for instance if attempting to use a feature that is
566+
/// newer than the current version of the SDK.
567+
/// </summary>
568+
public WorkerReplacementStrategy(string value)
569+
: base(value)
570+
{
571+
}
572+
573+
/// <summary>
574+
/// Finds the constant for the unique value.
575+
/// </summary>
576+
/// <param name="value">The unique value for the constant</param>
577+
/// <returns>The constant for the unique value</returns>
578+
public static WorkerReplacementStrategy FindValue(string value)
579+
{
580+
return FindValue<WorkerReplacementStrategy>(value);
581+
}
582+
583+
/// <summary>
584+
/// Utility method to convert strings to the constant class.
585+
/// </summary>
586+
/// <param name="value">The string value to convert to the constant class.</param>
587+
/// <returns></returns>
588+
public static implicit operator WorkerReplacementStrategy(string value)
589+
{
590+
return FindValue(value);
591+
}
592+
}
593+
544594
}

0 commit comments

Comments
 (0)