From b70c007e9bfebff26f67fed9ffb99f7046732877 Mon Sep 17 00:00:00 2001 From: Joe Sondow Date: Thu, 24 Oct 2013 20:29:01 -0700 Subject: [PATCH 1/4] Fixed critical error for new Asgard installations that lack an existing Config.groovy file --- CHANGES.txt | 5 +++++ application.properties | 2 +- grails-app/conf/spring/resources.groovy | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 792bdc6e..f14b08a9 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,8 @@ +1.3.1 + +Bug Fix +- Fixed critical error for new Asgard installations that lack an existing Config.groovy file + 1.3 Features diff --git a/application.properties b/application.properties index e33e767b..28e170da 100644 --- a/application.properties +++ b/application.properties @@ -3,4 +3,4 @@ app.grails.version=2.2.4 app.name=asgard app.servlet.version=2.4 -app.version=1.3 +app.version=1.3.1 diff --git a/grails-app/conf/spring/resources.groovy b/grails-app/conf/spring/resources.groovy index 686fbdef..f0a317a7 100644 --- a/grails-app/conf/spring/resources.groovy +++ b/grails-app/conf/spring/resources.groovy @@ -48,6 +48,7 @@ beans = { deploymentActivitiesImpl(DeploymentActivitiesImpl) { it.autowire = "byName" + it.lazyInit = true } snsTaskFinishedListener(SnsTaskFinishedListener) { bean -> From f33d25395150cdb51605588bc2608e3adbe7af74 Mon Sep 17 00:00:00 2001 From: Joe Sondow Date: Thu, 24 Oct 2013 20:56:52 -0700 Subject: [PATCH 2/4] Rename method to reflect its two vital purposes --- .../com/netflix/asgard/AwsSimpleWorkflowService.groovy | 4 ++-- .../netflix/asgard/AwsSimpleWorkflowServiceUnitSpec.groovy | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy b/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy index 1ed1ba71..eaff5ed4 100644 --- a/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy +++ b/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy @@ -81,7 +81,7 @@ class AwsSimpleWorkflowService implements CacheInitializer, InitializingBean { * Set up relevant cache objects to begin retrieving data. */ void initializeCaches() { - caches.allWorkflowDomains.ensureSetUp({ retrieveDomains() }, { + caches.allWorkflowDomains.ensureSetUp({ retrieveDomainsAndEnsureDomainIsRegistered() }, { caches.allOpenWorkflowExecutions.ensureSetUp({ retrieveOpenWorkflowExecutions() }) caches.allClosedWorkflowExecutions.ensureSetUp({ retrieveClosedWorkflowExecutions() }) }) @@ -364,7 +364,7 @@ class AwsSimpleWorkflowService implements CacheInitializer, InitializingBean { // Workflow Domains - private List retrieveDomains() { + private List retrieveDomainsAndEnsureDomainIsRegistered() { log.debug('Retrieve workflow domains') ListDomainsRequest request = new ListDomainsRequest(registrationStatus: 'REGISTERED') List domains = domainFetcher.retrieve(Region.defaultRegion(), request) diff --git a/test/unit/com/netflix/asgard/AwsSimpleWorkflowServiceUnitSpec.groovy b/test/unit/com/netflix/asgard/AwsSimpleWorkflowServiceUnitSpec.groovy index fb9fb7f9..5fe9c5b8 100644 --- a/test/unit/com/netflix/asgard/AwsSimpleWorkflowServiceUnitSpec.groovy +++ b/test/unit/com/netflix/asgard/AwsSimpleWorkflowServiceUnitSpec.groovy @@ -51,7 +51,7 @@ class AwsSimpleWorkflowServiceUnitSpec extends Specification { awsSimpleWorkflowService.simpleWorkflowClient = Mock(AmazonSimpleWorkflow) when: - List domains = awsSimpleWorkflowService.retrieveDomains() + List domains = awsSimpleWorkflowService.retrieveDomainsAndEnsureDomainIsRegistered() then: domains == [new DomainInfo(name: 'domain1')] @@ -69,7 +69,7 @@ class AwsSimpleWorkflowServiceUnitSpec extends Specification { awsSimpleWorkflowService.simpleWorkflowClient = Mock(AmazonSimpleWorkflow) when: - awsSimpleWorkflowService.retrieveDomains() + awsSimpleWorkflowService.retrieveDomainsAndEnsureDomainIsRegistered() then: 1 * awsSimpleWorkflowService.simpleWorkflowClient.registerDomain(_) From a0597aeaa99be6d3733b42f27609cad9b89cb0b2 Mon Sep 17 00:00:00 2001 From: Joe Sondow Date: Thu, 24 Oct 2013 21:10:21 -0700 Subject: [PATCH 3/4] All 4 SWF-related caches that rely on the existence of the primary domain should be filled only after we've ensured the domain exists --- .../com/netflix/asgard/AwsSimpleWorkflowService.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy b/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy index eaff5ed4..68123d60 100644 --- a/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy +++ b/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy @@ -84,9 +84,9 @@ class AwsSimpleWorkflowService implements CacheInitializer, InitializingBean { caches.allWorkflowDomains.ensureSetUp({ retrieveDomainsAndEnsureDomainIsRegistered() }, { caches.allOpenWorkflowExecutions.ensureSetUp({ retrieveOpenWorkflowExecutions() }) caches.allClosedWorkflowExecutions.ensureSetUp({ retrieveClosedWorkflowExecutions() }) + caches.allWorkflowTypes.ensureSetUp({ retrieveWorkflowTypes() }) + caches.allActivityTypes.ensureSetUp({ retrieveActivityTypes() }) }) - caches.allWorkflowTypes.ensureSetUp({ retrieveWorkflowTypes() }) - caches.allActivityTypes.ensureSetUp({ retrieveActivityTypes() }) } // Activity types From bac2681f715303657b6aee0d8fd6e7582bd28f71 Mon Sep 17 00:00:00 2001 From: Joe Sondow Date: Thu, 24 Oct 2013 21:08:14 -0700 Subject: [PATCH 4/4] Ensure SWF domain gets created before attempting to reference the domain with live workers. --- CHANGES.txt | 6 ++++-- .../com/netflix/asgard/AwsSimpleWorkflowService.groovy | 7 ++++++- grails-app/services/com/netflix/asgard/FlowService.groovy | 6 ++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index f14b08a9..41bb0d48 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,7 +1,9 @@ 1.3.1 -Bug Fix -- Fixed critical error for new Asgard installations that lack an existing Config.groovy file +Bug Fixes +- Fixed startup error for new Asgard installations that lack an existing Config.groovy file +- Fixed startup error for AWS accounts that don't yet have an asgard SWF domain + 1.3 diff --git a/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy b/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy index 68123d60..27d08201 100644 --- a/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy +++ b/grails-app/services/com/netflix/asgard/AwsSimpleWorkflowService.groovy @@ -364,7 +364,12 @@ class AwsSimpleWorkflowService implements CacheInitializer, InitializingBean { // Workflow Domains - private List retrieveDomainsAndEnsureDomainIsRegistered() { + /** + * Gets all the SWF domains and registers the main domain we need if it's not already in the list. + * + * @return info objects for all the registered domains in the default region + */ + List retrieveDomainsAndEnsureDomainIsRegistered() { log.debug('Retrieve workflow domains') ListDomainsRequest request = new ListDomainsRequest(registrationStatus: 'REGISTERED') List domains = domainFetcher.retrieve(Region.defaultRegion(), request) diff --git a/grails-app/services/com/netflix/asgard/FlowService.groovy b/grails-app/services/com/netflix/asgard/FlowService.groovy index cfb5fdfe..b4d8ebbf 100644 --- a/grails-app/services/com/netflix/asgard/FlowService.groovy +++ b/grails-app/services/com/netflix/asgard/FlowService.groovy @@ -43,6 +43,7 @@ import org.springframework.beans.factory.InitializingBean class FlowService implements InitializingBean { def awsClientService + def awsSimpleWorkflowService def configService def idService DeploymentActivitiesImpl deploymentActivitiesImpl @@ -61,6 +62,11 @@ class FlowService implements InitializingBean { ] as Map) void afterPropertiesSet() { + + // Ensure that the domain has been registered before attempting to reference it with workers. This code runs + // before cache filling begins. + awsSimpleWorkflowService.retrieveDomainsAndEnsureDomainIsRegistered() + String domain = configService.simpleWorkflowDomain String taskList = configService.simpleWorkflowTaskList GlobalWorkflowAttributes.taskList = taskList