Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deadline): adding deadline version check for workers #100

Merged
merged 7 commits into from
Sep 18, 2020
Merged
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
6 changes: 6 additions & 0 deletions packages/aws-rfdk/lib/deadline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The `aws-rfdk/deadline` sub-module contains Deadline-specific constructs that ca
import * as deadline from 'aws-rfdk/deadline';
```

---

_**Note:** RFDK constructs currently support Deadline 10.1.9 and later._

---

- [Render Queue](#render-queue)
- [Docker Container Images](#render-queue-docker-container-images)
- [Encryption](#render-queue-encryption)
Expand Down
8 changes: 7 additions & 1 deletion packages/aws-rfdk/lib/deadline/lib/worker-fleet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import {
import {
IRenderQueue,
} from './render-queue';
import { Version } from './version';

/**
* Interface for Deadline Worker Fleet.
Expand Down Expand Up @@ -181,12 +182,16 @@ export interface WorkerInstanceFleetProps {
/**
* Health Monitor component to monitor the health of instances.
*
* Note: The health-check feature is supported with Deadline Client v10.1.9 and later.
*
* @default - Health Monitoring is turned-off
*/
readonly healthMonitor?: IHealthMonitor;

/**
* Properties for configuring a health check
* Properties for configuring a health check.
*
* Note: The health-check feature is supported with Deadline Client v10.1.9 and later.
*
* @default properties of HealthCheckConfig applies
*/
Expand Down Expand Up @@ -548,6 +553,7 @@ export class WorkerInstanceFleet extends WorkerInstanceFleetBase {
`'${groups}'`,
`'${pools}'`,
`'${props.region || ''}'`,
`'${Version.MINIMUM_SUPPORTED_DEADLINE_VERSION.toString()}'`,
],
});
}
Expand Down
17 changes: 17 additions & 0 deletions packages/aws-rfdk/lib/deadline/scripts/bash/configureWorker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# $2: comma separated groups
# $3: comma separated pools
# $4: region
# $5: minimum supported deadline version

# exit when any command fails
set -xeuo pipefail
Expand All @@ -17,6 +18,7 @@ HEALTH_CHECK_PORT="$1"
WORKER_GROUPS=(${2//,/ })
WORKER_POOLS=(${3//,/ })
WORKER_REGION="$4"
MINIMUM_SUPPORTED_DEADLINE_VERSION=$5

# Cloud-init does not load system environment variables. Cherry-pick the
# environment variable installed by the Deadline Client installer.
Expand All @@ -36,6 +38,21 @@ if [ ! -f "$DEADLINE_COMMAND" ]; then
exit 1
fi

isVersionLessThan() {
python -c "import sys;sys.exit(0 if tuple(map(int, sys.argv[-2].split('.'))) < tuple(map(int, sys.argv[-1].split('.'))) else 1)" "$1" "$2"
}

DEADLINE_VERSION=$("$DEADLINE_COMMAND" -Version | grep -oP '[v]\K\d+\.\d+\.\d+\.\d+\b')
if [ -z "$DEADLINE_VERSION" ]; then
echo "ERROR: Unable to identify the version of installed Deadline Client. Exiting..."
exit 1
fi

if isVersionLessThan $DEADLINE_VERSION $MINIMUM_SUPPORTED_DEADLINE_VERSION; then
echo "ERROR: Installed Deadline Version ($DEADLINE_VERSION) is less than the minimum supported version ($MINIMUM_SUPPORTED_DEADLINE_VERSION). Exiting..."
exit 1
fi

# launch worker at launcher startup
"$DEADLINE_COMMAND" -SetIniFileSetting LaunchSlaveAtStartup True
# keep worker running
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ param (
[Parameter(Mandatory=$True)]
$workerPools,
[Parameter(Mandatory=$True)]
$workerRegion
$workerRegion,
[Parameter(Mandatory=$True)]
$minimumSupportedDeadlineVersion
)

Set-PSDebug -Trace 1
Expand All @@ -28,6 +30,17 @@ if (!(Test-Path $DEADLINE_COMMAND)) {
exit 1
}

$DeadlineVersion = (& $DEADLINE_COMMAND -Version | Out-String) | Select-String -Pattern '[v](\d+\.\d+\.\d+\.\d+)\b' | % {$_.Matches.Groups[1].Value}
if ([string]::IsNullOrEmpty($DeadlineVersion)) {
Write-Host "ERROR: Unable to identify the version of installed Deadline Client. Exiting..."
exit 1
}

if([System.Version]$DeadlineVersion -lt [System.Version]$minimumSupportedDeadlineVersion) {
Write-Host "ERROR: Installed Deadline Version ($($DeadlineVersion)) is less than the minimum supported version ($($minimumSupportedDeadlineVersion)). Exiting..."
exit 1
}

# launch worker at launcher startup
& $DEADLINE_COMMAND -SetIniFileSetting LaunchSlaveAtStartup True | Out-Default
# keep worker running
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-rfdk/lib/deadline/test/asset-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export {CWA_ASSET_LINUX};

// configureWorker.sh
export const CONFIG_WORKER_ASSET_LINUX = {
Bucket: 'AssetParameters2435996be08703cd3819e249890abb41cc0860324e5cfe1b5945704934db7101S3BucketB40BB072',
Key: 'AssetParameters2435996be08703cd3819e249890abb41cc0860324e5cfe1b5945704934db7101S3VersionKey4F3F9A7F',
Bucket: 'AssetParameters3915f098ad4813270754c05c4e236d137da778773dfb13912fa54f387cc5929aS3BucketE7DA333E',
Key: 'AssetParameters3915f098ad4813270754c05c4e236d137da778773dfb13912fa54f387cc5929aS3VersionKey1C0D482D',
};

// configureWorker.ps1
Expand Down
5 changes: 3 additions & 2 deletions packages/aws-rfdk/lib/deadline/test/worker-fleet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
IRenderQueue,
RenderQueue,
Repository,
Version,
VersionQuery,
WorkerInstanceFleet,
} from '../lib';
Expand Down Expand Up @@ -685,7 +686,7 @@ test('default worker fleet is created correctly custom subnet values', () => {
},
],
},
"' '6161' '' '' ''",
`' '6161' '' '' '' '${Version.MINIMUM_SUPPORTED_DEADLINE_VERSION}'`,
],
],
});
Expand Down Expand Up @@ -1085,7 +1086,7 @@ test('default worker fleet is created correctly with groups, pools and region',
},
],
},
"' '63415' 'a,b' 'c,d' 'E'",
`' '63415' 'a,b' 'c,d' 'E' '${Version.MINIMUM_SUPPORTED_DEADLINE_VERSION}'`,
]],
});
});
Expand Down