Skip to content

Commit a508ebb

Browse files
authored
fix(deadline): Windows Workers fail to deploy waiting for Deadline launcher service to restart (#354)
Fixes #353 and #312
1 parent efb6a59 commit a508ebb

File tree

9 files changed

+55
-27
lines changed

9 files changed

+55
-27
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
uses: actions/[email protected]
2727
with:
2828
node-version: ${{ matrix.node-version }}
29+
- run: npm install --global yarn
2930
- run: yarn global add typescript
30-
- run: yarn install --frozen-lockfile
31-
- run: ./build.sh
31+
- run: yarn build
3232
- run: ./pack.sh

packages/aws-rfdk/lib/deadline/lib/render-queue-ref.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,4 +361,11 @@ export interface InstanceConnectOptions {
361361
* The Instance/UserData which will directly connect to the Repository
362362
*/
363363
readonly host: IHost;
364+
365+
/**
366+
* Whether or not to start or restart the Deadline Launcher after configuring the connection.
367+
*
368+
* @default true
369+
*/
370+
readonly restartLauncher?: boolean;
364371
}

packages/aws-rfdk/lib/deadline/lib/rq-connection.ts

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,20 @@ export interface HTTPSConnectionOptions extends BaseConnectionOptions {
3939
}
4040

4141
interface ConnectionScriptArguments {
42-
42+
/**
43+
* The address of the Render Queue
44+
*/
4345
readonly address: string;
4446

47+
/**
48+
* The ARN to the AWS Secrets Manager secret containing the X509 CA Certificate in PEM format.
49+
*/
4550
readonly tlsCaArn?: string;
51+
52+
/**
53+
* Whether to restart the Deadline launcher after configuring the Render Queue connection.
54+
*/
55+
readonly restartLauncher?: boolean;
4656
}
4757

4858
/**
@@ -114,23 +124,31 @@ export abstract class RenderQueueConnection {
114124
`"\${DEADLINE_PATH}/deadlinecommand" -executeScriptNoGui "${configureScriptPath}" --render-queue "${args.address}" ${dlExtraCommands.join(' ')}`,
115125
// Cleanup
116126
`rm -f "${configureScriptPath}"`,
117-
'if service --status-all | grep -q "Deadline 10 Launcher"; then',
118-
' service deadline10launcher restart',
119-
'fi',
120127
);
128+
if (args.restartLauncher ?? true) {
129+
host.userData.addCommands(
130+
'if service --status-all | grep -q "Deadline 10 Launcher"; then',
131+
' service deadline10launcher restart',
132+
'fi',
133+
);
134+
}
121135
} else if ( host.osType === OperatingSystemType.WINDOWS ) {
122136
host.userData.addCommands(
123137
'$ErrorActionPreference = "Stop"',
124138
'$DEADLINE_PATH = (get-item env:"DEADLINE_PATH").Value',
125139
`& "$DEADLINE_PATH/deadlinecommand.exe" -executeScriptNoGui "${configureScriptPath}" --render-queue "${args.address}" ${dlExtraCommands.join(' ')} 2>&1`,
126140
`Remove-Item -Path "${configureScriptPath}"`,
127-
'If (Get-Service "deadline10launcherservice" -ErrorAction SilentlyContinue) {',
128-
' Restart-Service "deadline10launcherservice"',
129-
'} Else {',
130-
' & "$DEADLINE_PATH/deadlinelauncher.exe" -shutdownall 2>&1',
131-
' & "$DEADLINE_PATH/deadlinelauncher.exe" 2>&1',
132-
'}',
133141
);
142+
if (args.restartLauncher ?? true) {
143+
host.userData.addCommands(
144+
'If (Get-Service "deadline10launcherservice" -ErrorAction SilentlyContinue) {',
145+
' Restart-Service "deadline10launcherservice"',
146+
'} Else {',
147+
' & "$DEADLINE_PATH/deadlinelauncher.exe" -shutdownall 2>&1',
148+
' & "$DEADLINE_PATH/deadlinelauncher.exe" -nogui 2>&1',
149+
'}',
150+
);
151+
}
134152
}
135153
}
136154

@@ -163,6 +181,7 @@ class HTTPConnection extends RenderQueueConnection {
163181
params.host,
164182
{
165183
address: `http://${this.config.endpoint.socketAddress}`,
184+
restartLauncher: params.restartLauncher,
166185
},
167186
);
168187
}
@@ -200,6 +219,7 @@ class HTTPSConnection extends RenderQueueConnection {
200219
{
201220
address: `https://${this.config.endpoint.socketAddress}`,
202221
tlsCaArn: this.config.caCert.secretArn,
222+
restartLauncher: params.restartLauncher,
203223
},
204224
);
205225

packages/aws-rfdk/lib/deadline/lib/worker-configuration.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,14 @@ export class WorkerInstanceConfiguration extends Construct {
221221
);
222222
}
223223
props.userDataProvider?.preRenderQueueConfiguration(props.worker);
224-
props.renderQueue?.configureClientInstance({ host: props.worker });
224+
props.renderQueue?.configureClientInstance({
225+
host: props.worker,
226+
// Don't restart the Deadline Launcher service after configuring the connection to the Render Queue. We need to
227+
// restart it later anyways, and the Windows service for the Deadline Launcher can get locked in the "stopping"
228+
// state if you attempt to stop or restart it while it is still restarting. This can cause the user data execution
229+
// to get locked waiting for the service to finish stopping/restarting.
230+
restartLauncher: false,
231+
});
225232
props.userDataProvider?.preWorkerConfiguration(props.worker);
226233

227234
this.listenerPort = props.workerSettings?.listenerPort ?? WorkerInstanceConfiguration.DEFAULT_LISTENER_PORT;

packages/aws-rfdk/lib/deadline/scripts/bash/configureWorker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ else
133133
DEADLINE_LAUNCHER="$DEADLINE_PATH/deadlinelauncher"
134134
"$DEADLINE_LAUNCHER" -shutdownall
135135
sudo killall -w deadlineworker || true
136-
"$DEADLINE_LAUNCHER"
136+
"$DEADLINE_LAUNCHER" -nogui
137137
fi
138138

139139
echo "Script completed successfully."

packages/aws-rfdk/lib/deadline/scripts/powershell/configureWorker.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ If (Get-Service $serviceName -ErrorAction SilentlyContinue) {
127127
$DEADLINE_LAUNCHER = $DEADLINE_PATH + '/deadlinelauncher.exe'
128128
& $DEADLINE_LAUNCHER -shutdownall | Out-Default
129129
taskkill /f /fi "IMAGENAME eq deadlineworker.exe"
130-
& $DEADLINE_LAUNCHER
130+
& $DEADLINE_LAUNCHER -nogui
131131
}
132132

133133
Write-Host "Script completed successfully."

packages/aws-rfdk/lib/deadline/test/asset-constants.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export {
1818

1919
// configureWorker.sh
2020
export const CONFIG_WORKER_ASSET_LINUX = {
21-
Bucket: 'AssetParameters21c2af3bc1d4fd78061765b059dcc8e32568828e5cf479b08115489651491c8fS3BucketF10C60A7',
22-
Key: 'AssetParameters21c2af3bc1d4fd78061765b059dcc8e32568828e5cf479b08115489651491c8fS3VersionKey7FDCC89A',
21+
Bucket: 'AssetParameters1cfdffe73bb016717ba1f43d64fe528af27b3784f524a97bb36533a6e6d057ffS3Bucket9FBDD688',
22+
Key: 'AssetParameters1cfdffe73bb016717ba1f43d64fe528af27b3784f524a97bb36533a6e6d057ffS3VersionKey02A3157B',
2323
};
2424

2525
// configureWorker.ps1
@@ -29,8 +29,8 @@ export const CONFIG_WORKER_ASSET_WINDOWS = {
2929
};
3030

3131
export const CONFIG_WORKER_PORT_ASSET_WINDOWS = {
32-
Bucket: 'AssetParameters0b4fe3ffb7177773bb2781f92b37d9b01b3bd37ee60ea1715c0ad407f141005dS3BucketE7B32C3E',
33-
Key: 'AssetParameters0b4fe3ffb7177773bb2781f92b37d9b01b3bd37ee60ea1715c0ad407f141005dS3VersionKey843794E3',
32+
Bucket: 'AssetParameters3227efc256da3ae31791b7c80e1532cac975116846f179f118a20843e0c2ee80S3Bucket6583BE37',
33+
Key: 'AssetParameters3227efc256da3ae31791b7c80e1532cac975116846f179f118a20843e0c2ee80S3VersionKey6C80977B',
3434
};
3535

3636
// installDeadlineRepository.sh

packages/aws-rfdk/lib/deadline/test/render-queue.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ describe('RenderQueue', () => {
12271227
' Restart-Service "deadline10launcherservice"\n' +
12281228
'} Else {\n' +
12291229
' & "$DEADLINE_PATH/deadlinelauncher.exe" -shutdownall 2>&1\n' +
1230-
' & "$DEADLINE_PATH/deadlinelauncher.exe" 2>&1\n' +
1230+
' & "$DEADLINE_PATH/deadlinelauncher.exe" -nogui 2>&1\n' +
12311231
'}</powershell>',
12321232
],
12331233
],
@@ -1635,7 +1635,7 @@ describe('RenderQueue', () => {
16351635
' Restart-Service "deadline10launcherservice"\n' +
16361636
'} Else {\n' +
16371637
' & "$DEADLINE_PATH/deadlinelauncher.exe" -shutdownall 2>&1\n' +
1638-
' & "$DEADLINE_PATH/deadlinelauncher.exe" 2>&1\n' +
1638+
' & "$DEADLINE_PATH/deadlinelauncher.exe" -nogui 2>&1\n' +
16391639
'}</powershell>',
16401640
],
16411641
],

packages/aws-rfdk/lib/deadline/test/worker-fleet.test.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -721,9 +721,6 @@ test('default worker fleet is created correctly custom subnet values', () => {
721721
],
722722
},
723723
'\"\n' +
724-
'if service --status-all | grep -q "Deadline 10 Launcher"; then\n' +
725-
' service deadline10launcher restart\n' +
726-
'fi\n' +
727724
"mkdir -p $(dirname '/tmp/",
728725
{
729726
'Fn::Select': [
@@ -1214,9 +1211,6 @@ test('default worker fleet is created correctly with groups, pools and region',
12141211
],
12151212
},
12161213
'\"\n' +
1217-
'if service --status-all | grep -q "Deadline 10 Launcher"; then\n' +
1218-
' service deadline10launcher restart\n' +
1219-
'fi\n' +
12201214
"mkdir -p $(dirname '/tmp/",
12211215
{
12221216
'Fn::Select': [

0 commit comments

Comments
 (0)