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

Use reboot version and allow for no default instance #2607

Merged
merged 1 commit into from
May 4, 2020
Merged
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
18 changes: 13 additions & 5 deletions aws/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import com.amazonaws.services.lambda.model.InvocationType
import com.amazonaws.services.lambda.model.InvokeResult
import jp.classmethod.aws.gradle.lambda.AWSLambdaInvokeTask
import jp.classmethod.aws.reboot.gradle.lambda.AWSLambdaInvokeTask


buildscript {
Expand All @@ -11,15 +11,15 @@ buildscript {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "jp.classmethod.aws:gradle-aws-plugin:0.35"
classpath "jp.classmethod.aws.reboot:gradle-aws-plugin-reboot:0.42"
}
}

group = 'beam'
version = '0.8.0'

apply plugin: "base"
apply plugin: "jp.classmethod.aws.lambda"
apply plugin: "jp.classmethod.aws.reboot.lambda"

aws {
profileName = "gradle"
Expand All @@ -28,6 +28,11 @@ aws {

lambda {
region = "us-east-2"
maxErrorRetry = 0
requestTimeout = 900000
clientExecutionTimeout = 900000
connectionTimeout = 900000
socketTimeout = 900000
}

task deploy(type: AWSLambdaInvokeTask) {
Expand Down Expand Up @@ -73,6 +78,9 @@ task deploy(type: AWSLambdaInvokeTask) {
break
}

def tempInstanceType = "${ext.getParameterValue('instanceType') ?: (project.hasProperty('defaultInstanceType') ? defaultInstanceType : '')}"
def finalInstanceType = tempInstanceType != "" ? tempInstanceType : null

def pload = """{
"title": "${ext.getParameterValue('runName') + '_' + getCurrentGitUserEmail()}",
"git_user_email": "${getCurrentGitUserEmail()}",
Expand All @@ -88,7 +96,7 @@ task deploy(type: AWSLambdaInvokeTask) {
"storage_size": ${ext.getParameterValue('storageSize')},
"batch": ${ext.getParameterValue('beamBatch')},
"s3_publish": ${ext.getParameterValue('s3Backup') ?: true},
"instance_type": "${ext.getParameterValue('instanceType') ?: defaultInstanceType}",
"instance_type": ${finalInstanceType},
"region": "${ext.getParameterValue('region') ?: defaultRegion}",
"shutdown_wait": "${ext.getParameterValue('shutdownWait')}",
"shutdown_behaviour": "${ext.getParameterValue('shutdownBehaviour')}",
Expand All @@ -100,14 +108,14 @@ task deploy(type: AWSLambdaInvokeTask) {
"min_memory": ${ext.getParameterValue('minMemory') ?: 0},
"max_memory": ${ext.getParameterValue('maxMemory') ?: 0}
}"""
println payload
println "Please note that if you set isSpot to true then it could take an excessive time period. In fact it could time out at 15 minutes and still complete later on. ALSO! volumes using spot instances must be MANUALLY deleted. This is done so you do not lose data in the case of a premature shutdown."
functionName = "simulateBeam"
invocationType = InvocationType.RequestResponse
payload = pload
}

doLast {
println payload
println new String(invokeResult.payload.array(), "UTF-8")
}
}
Expand Down