Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Boxiang Sun
slapos.core
Commits
94999b09
Commit
94999b09
authored
May 09, 2023
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
slapos_cloud: Move _fillComputeNodeInformationCache to priority 1
See merge request
nexedi/slapos.core!525
parents
724f3ab3
6e32236a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
5 deletions
+25
-5
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSComputeNodeMixin.py
...em/portal_components/mixin.erp5.SlapOSComputeNodeMixin.py
+1
-1
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloud.py
...mplateItem/portal_components/test.erp5.testSlapOSCloud.py
+16
-1
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapTool.py
...ateItem/portal_components/test.erp5.testSlapOSSlapTool.py
+8
-3
No files found.
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSComputeNodeMixin.py
View file @
94999b09
...
...
@@ -103,7 +103,7 @@ class SlapOSComputeNodeMixin(object):
def
_activateFillComputeNodeInformationCache
(
self
,
user
):
tag
=
'compute_node_information_cache_fill_%s_%s'
%
(
self
.
getReference
(),
user
)
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
):
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloud.py
View file @
94999b09
...
...
@@ -524,7 +524,6 @@ class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation(
self
.
_makeComplexComputeNode
(
with_slave
=
True
)
self
.
portal
.
REQUEST
[
'disable_isTestRun'
]
=
True
self
.
tic
()
self
.
login
(
self
.
compute_node_user_id
)
user
=
self
.
getPortalObject
().
portal_membership
.
getAuthenticatedMember
().
getUserName
()
...
...
@@ -532,6 +531,11 @@ class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation(
self
.
compute_node
.
setAccessStatus
(
self
.
compute_node_id
)
refresh_etag
=
self
.
compute_node
.
_calculateRefreshEtag
()
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
()
first_etag
=
self
.
compute_node
.
_calculateRefreshEtag
()
...
...
@@ -625,6 +629,11 @@ class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation(
self
.
compute_node
.
setAccessStatus
(
self
.
compute_node_id
)
refresh_etag
=
self
.
compute_node
.
_calculateRefreshEtag
()
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
()
third_etag
=
self
.
compute_node
.
_calculateRefreshEtag
()
...
...
@@ -666,6 +675,12 @@ class TestSlapOSCloudSlapOSComputeNodeMixin_getCacheComputeNodeInformation(
self
.
compute_node
.
setAccessStatus
(
self
.
compute_node_id
)
refresh_etag
=
self
.
compute_node
.
_calculateRefreshEtag
()
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
()
fourth_etag
=
self
.
compute_node
.
_calculateRefreshEtag
()
fourth_body_fingerprint
=
hashData
(
...
...
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapTool.py
View file @
94999b09
...
...
@@ -75,11 +75,12 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
def
test_activate_getFullComputerInformation_first_access
(
self
):
self
.
_makeComplexComputeNode
(
with_slave
=
True
)
self
.
portal
.
REQUEST
[
'disable_isTestRun'
]
=
True
self
.
tic
()
self
.
login
(
self
.
compute_node_user_id
)
self
.
portal_slap
.
getFullComputerInformation
(
self
.
compute_node_id
)
self
.
tic
()
self
.
portal_slap
.
getFullComputerInformation
(
self
.
compute_node_id
)
# First access.
# Cache has been filled by interaction workflow
# (luckily, it seems the cache is filled after everything is indexed)
...
...
@@ -174,7 +175,9 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
self
.
assertEqual
(
current_activity_count
,
len
(
self
.
portal
.
portal_activities
.
getMessageList
()))
self
.
tic
()
self
.
portal_slap
.
getFullComputerInformation
(
self
.
compute_node_id
)
self
.
tic
()
# 6th, the instance edition triggered an interaction workflow
# which updated the cache
response
=
self
.
portal_slap
.
getFullComputerInformation
(
self
.
compute_node_id
)
...
...
@@ -212,6 +215,8 @@ class TestSlapOSSlapToolgetFullComputerInformation(TestSlapOSSlapToolMixin):
self
.
assertEqual
(
third_body_fingerprint
,
hashData
(
response
.
body
))
self
.
assertEqual
(
current_activity_count
,
len
(
self
.
portal
.
portal_activities
.
getMessageList
()))
self
.
tic
()
self
.
portal_slap
.
getFullComputerInformation
(
self
.
compute_node_id
)
self
.
tic
()
# 8th access
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment