Commit 94999b09 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: Move _fillComputeNodeInformationCache to priority 1

See merge request !525
parents 724f3ab3 6e32236a
Pipeline #27955 failed with stage
in 0 seconds
...@@ -103,7 +103,7 @@ class SlapOSComputeNodeMixin(object): ...@@ -103,7 +103,7 @@ class SlapOSComputeNodeMixin(object):
def _activateFillComputeNodeInformationCache(self, user): def _activateFillComputeNodeInformationCache(self, user):
tag = 'compute_node_information_cache_fill_%s_%s' % (self.getReference(), user) tag = 'compute_node_information_cache_fill_%s_%s' % (self.getReference(), user)
if self.getPortalObject().portal_activities.countMessageWithTag(tag) == 0: if self.getPortalObject().portal_activities.countMessageWithTag(tag) == 0:
self.activate(activity='SQLQueue', priority=2, tag=tag)._fillComputeNodeInformationCache(user) self.activate(activity='SQLQueue', priority=1, tag=tag)._fillComputeNodeInformationCache(user)
def _fillComputeNodeInformationCache(self, user): def _fillComputeNodeInformationCache(self, user):
......
...@@ -524,7 +524,6 @@ class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation( ...@@ -524,7 +524,6 @@ class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation(
self._makeComplexComputeNode(with_slave=True) self._makeComplexComputeNode(with_slave=True)
self.portal.REQUEST['disable_isTestRun'] = True self.portal.REQUEST['disable_isTestRun'] = True
self.tic()
self.login(self.compute_node_user_id) self.login(self.compute_node_user_id)
user = self.getPortalObject().portal_membership.getAuthenticatedMember().getUserName() user = self.getPortalObject().portal_membership.getAuthenticatedMember().getUserName()
...@@ -532,6 +531,11 @@ class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation( ...@@ -532,6 +531,11 @@ class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation(
self.compute_node.setAccessStatus(self.compute_node_id) self.compute_node.setAccessStatus(self.compute_node_id)
refresh_etag = self.compute_node._calculateRefreshEtag() refresh_etag = self.compute_node._calculateRefreshEtag()
body, etag = self.compute_node._getComputeNodeInformation(user, refresh_etag) body, etag = self.compute_node._getComputeNodeInformation(user, refresh_etag)
# This tic and second call is to fix indexation ordering while some sub object
# is created after the etag is computed and stored.
self.tic()
refresh_etag = self.compute_node._calculateRefreshEtag()
body, etag = self.compute_node._getComputeNodeInformation(user, refresh_etag)
self.commit() self.commit()
first_etag = self.compute_node._calculateRefreshEtag() first_etag = self.compute_node._calculateRefreshEtag()
...@@ -625,6 +629,11 @@ class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation( ...@@ -625,6 +629,11 @@ class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation(
self.compute_node.setAccessStatus(self.compute_node_id) self.compute_node.setAccessStatus(self.compute_node_id)
refresh_etag = self.compute_node._calculateRefreshEtag() refresh_etag = self.compute_node._calculateRefreshEtag()
body, etag = self.compute_node._getComputeNodeInformation(user, refresh_etag) body, etag = self.compute_node._getComputeNodeInformation(user, refresh_etag)
# On the previous tic, the values can be indexed out of order, so recall after indextion
# so the values are propely set.
self.tic()
body, etag = self.compute_node._getComputeNodeInformation(user, refresh_etag)
self.commit() self.commit()
third_etag = self.compute_node._calculateRefreshEtag() third_etag = self.compute_node._calculateRefreshEtag()
...@@ -666,6 +675,12 @@ class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation( ...@@ -666,6 +675,12 @@ class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation(
self.compute_node.setAccessStatus(self.compute_node_id) self.compute_node.setAccessStatus(self.compute_node_id)
refresh_etag = self.compute_node._calculateRefreshEtag() refresh_etag = self.compute_node._calculateRefreshEtag()
body, etag = self.compute_node._getComputeNodeInformation(user, refresh_etag) body, etag = self.compute_node._getComputeNodeInformation(user, refresh_etag)
# On the previous tic, the values can be indexed out of order, so recall after indextion
# so the values are propely set.
self.tic()
body, etag = self.compute_node._getComputeNodeInformation(user, refresh_etag)
self.commit() self.commit()
fourth_etag = self.compute_node._calculateRefreshEtag() fourth_etag = self.compute_node._calculateRefreshEtag()
fourth_body_fingerprint = hashData( fourth_body_fingerprint = hashData(
......
...@@ -75,11 +75,12 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin): ...@@ -75,11 +75,12 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
def test_activate_getFullComputerInformation_first_access(self): def test_activate_getFullComputerInformation_first_access(self):
self._makeComplexComputeNode(with_slave=True) self._makeComplexComputeNode(with_slave=True)
self.portal.REQUEST['disable_isTestRun'] = True self.portal.REQUEST['disable_isTestRun'] = True
self.tic()
self.login(self.compute_node_user_id) self.login(self.compute_node_user_id)
self.portal_slap.getFullComputerInformation(self.compute_node_id) self.portal_slap.getFullComputerInformation(self.compute_node_id)
self.tic()
self.portal_slap.getFullComputerInformation(self.compute_node_id)
# First access. # First access.
# Cache has been filled by interaction workflow # Cache has been filled by interaction workflow
# (luckily, it seems the cache is filled after everything is indexed) # (luckily, it seems the cache is filled after everything is indexed)
...@@ -174,7 +175,9 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin): ...@@ -174,7 +175,9 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
self.assertEqual(current_activity_count, len(self.portal.portal_activities.getMessageList())) self.assertEqual(current_activity_count, len(self.portal.portal_activities.getMessageList()))
self.tic() self.tic()
self.portal_slap.getFullComputerInformation(self.compute_node_id)
self.tic()
# 6th, the instance edition triggered an interaction workflow # 6th, the instance edition triggered an interaction workflow
# which updated the cache # which updated the cache
response = self.portal_slap.getFullComputerInformation(self.compute_node_id) response = self.portal_slap.getFullComputerInformation(self.compute_node_id)
...@@ -212,6 +215,8 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin): ...@@ -212,6 +215,8 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
self.assertEqual(third_body_fingerprint, hashData(response.body)) self.assertEqual(third_body_fingerprint, hashData(response.body))
self.assertEqual(current_activity_count, len(self.portal.portal_activities.getMessageList())) self.assertEqual(current_activity_count, len(self.portal.portal_activities.getMessageList()))
self.tic()
self.portal_slap.getFullComputerInformation(self.compute_node_id)
self.tic() self.tic()
# 8th access # 8th access
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment