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
Léo-Paul Géneau
slapos.core
Commits
7b613a01
Commit
7b613a01
authored
Dec 02, 2022
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio_api_style: Generate Hash document for instances hosting shared instances
parent
03d74ad9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
4 deletions
+65
-4
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api_cache/Base_postAsJSONResultToActiveProcess.py
...pos_jio_api_cache/Base_postAsJSONResultToActiveProcess.py
+12
-1
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api_cache/SlapOSNode_aggregateHashFile.py
...kins/slapos_jio_api_cache/SlapOSNode_aggregateHashFile.py
+1
-1
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api_cache/SlapOSNode_aggregateHashFile.xml
...ins/slapos_jio_api_cache/SlapOSNode_aggregateHashFile.xml
+1
-1
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api_cache/SlapOSNode_generateHashFile.py
...skins/slapos_jio_api_cache/SlapOSNode_generateHashFile.py
+50
-0
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api_cache/SlapOSNode_generateHashFile.xml
...kins/slapos_jio_api_cache/SlapOSNode_generateHashFile.xml
+1
-1
No files found.
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api_cache/Base_postAsJSONResultToActiveProcess.py
View file @
7b613a01
...
@@ -5,8 +5,19 @@ data = {
...
@@ -5,8 +5,19 @@ data = {
"reference"
:
context
.
getReference
(),
"reference"
:
context
.
getReference
(),
"md5sum"
:
hashlib
.
md5
(
context
.
asJSONText
()).
hexdigest
(),
"md5sum"
:
hashlib
.
md5
(
context
.
asJSONText
()).
hexdigest
(),
"method"
:
"python: hashlib.md5(json_text).hexdigest()"
,
"method"
:
"python: hashlib.md5(json_text).hexdigest()"
,
"data-schema"
:
context
.
getJSONSchemaUrl
()
"data-schema"
:
context
.
getJSONSchemaUrl
()
,
}
}
import
json
import
json
context
.
getPortalObject
().
restrictedTraverse
(
active_process
).
postResult
(
context
.
getPortalObject
().
restrictedTraverse
(
active_process
).
postResult
(
ActiveResult
(
detail
=
json
.
dumps
(
data
).
encode
(
'utf8'
).
encode
(
'zlib'
)))
ActiveResult
(
detail
=
json
.
dumps
(
data
).
encode
(
'utf8'
).
encode
(
'zlib'
)))
if
context
.
getPortalType
()
==
"Software Instance"
:
host_shared_instance
=
context
.
getPortalObject
().
portal_catalog
(
limit
=
1
,
default_aggregate_uid
=
context
.
getAggregateUid
(),
portal_type
=
"Slave Instance"
,
validation_state
=
"validated"
,
**
{
"slapos_item.slap_state"
:
"start_requested"
}
)
if
host_shared_instance
:
context
.
activate
().
SlapOSNode_generateHashFile
()
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api_cache/
Compute
Node_aggregateHashFile.py
→
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api_cache/
SlapOS
Node_aggregateHashFile.py
View file @
7b613a01
...
@@ -7,7 +7,7 @@ result_list = [ json.loads(result.detail.decode('zlib')) for result in active_pr
...
@@ -7,7 +7,7 @@ result_list = [ json.loads(result.detail.decode('zlib')) for result in active_pr
result_list
.
sort
()
result_list
.
sort
()
data
=
{
data
=
{
"
compute_
node_id"
:
context
.
getReference
(),
"node_id"
:
context
.
getReference
(),
# Here it should not be hardcoded
# Here it should not be hardcoded
"document_hash_list"
:
result_list
,
"document_hash_list"
:
result_list
,
"timestamp"
:
timestamp
"timestamp"
:
timestamp
...
...
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api_cache/
Compute
Node_aggregateHashFile.xml
→
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api_cache/
SlapOS
Node_aggregateHashFile.xml
View file @
7b613a01
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
Compute
Node_aggregateHashFile
</string>
</value>
<value>
<string>
SlapOS
Node_aggregateHashFile
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api_cache/
Compute
Node_generateHashFile.py
→
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api_cache/
SlapOS
Node_generateHashFile.py
View file @
7b613a01
...
@@ -7,14 +7,27 @@ if portal.portal_activities.countMessageWithTag(tag) or \
...
@@ -7,14 +7,27 @@ if portal.portal_activities.countMessageWithTag(tag) or \
portal
.
portal_activities
.
countMessageWithTag
(
aggregate_tag
):
portal
.
portal_activities
.
countMessageWithTag
(
aggregate_tag
):
return
return
compute_partition_list
=
portal
.
portal_catalog
(
if
context
.
getPortalType
()
==
"Compute Node"
:
compute_partition_list
=
portal
.
portal_catalog
(
portal_type
=
"Compute Partition"
,
portal_type
=
"Compute Partition"
,
validation_state
=
"validated"
validation_state
=
"validated"
)
)
if
not
compute_partition_list
:
if
not
compute_partition_list
:
return
return
compute_partition_uid_list
=
[
x
.
uid
for
x
in
compute_partition_list
]
compute_partition_uid_list
=
[
x
.
uid
for
x
in
compute_partition_list
]
search_kw
=
{
"portal_type"
:
"Software Instance"
,
"default_aggregate_uid"
:
compute_partition_uid_list
,
"validation_state"
:
"validated"
,
}
else
:
# Case the Node is an Instance
search_kw
=
{
"default_aggregate_uid"
:
context
.
getAggregateUid
(),
"portal_type"
:
"Slave Instance"
,
"validation_state"
:
"validated"
,
"slapos_item.slap_state"
:
"start_requested"
,
}
import
time
import
time
now
=
int
(
time
.
time
())
now
=
int
(
time
.
time
())
...
@@ -25,25 +38,13 @@ portal.portal_catalog.searchAndActivate(
...
@@ -25,25 +38,13 @@ portal.portal_catalog.searchAndActivate(
method_id
=
"Base_postAsJSONResultToActiveProcess"
,
method_id
=
"Base_postAsJSONResultToActiveProcess"
,
activate_kw
=
dict
(
tag
=
tag
,
priority
=
priority
),
activate_kw
=
dict
(
tag
=
tag
,
priority
=
priority
),
method_kw
=
dict
(
active_process
=
compute_node_active_process
.
getRelativeUrl
()),
method_kw
=
dict
(
active_process
=
compute_node_active_process
.
getRelativeUrl
()),
portal_type
=
"Software Instance"
,
**
search_kw
default_aggregate_uid
=
compute_partition_uid_list
,
validation_state
=
"validated"
,
)
portal
.
portal_catalog
.
searchAndActivate
(
method_id
=
"Base_postAsJSONResultToActiveProcess"
,
activate_kw
=
dict
(
tag
=
tag
,
priority
=
priority
),
method_kw
=
dict
(
active_process
=
compute_node_active_process
.
getRelativeUrl
()),
default_aggregate_uid
=
compute_partition_uid_list
,
portal_type
=
"Slave Instance"
,
validation_state
=
"validated"
,
**
{
"slapos_item.slap_state"
:
"start_requested"
}
)
)
context
.
activate
(
context
.
activate
(
tag
=
aggregate_tag
,
tag
=
aggregate_tag
,
after_tag
=
tag
,
after_tag
=
tag
,
activity
=
'SQLQueue'
).
Compute
Node_aggregateHashFile
(
activity
=
'SQLQueue'
).
SlapOS
Node_aggregateHashFile
(
timestamp
=
now
,
timestamp
=
now
,
active_process
=
compute_node_active_process
.
getRelativeUrl
()
active_process
=
compute_node_active_process
.
getRelativeUrl
()
)
)
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api_cache/
Compute
Node_generateHashFile.xml
→
master/bt5/slapos_jio_api_style/SkinTemplateItem/portal_skins/slapos_jio_api_cache/
SlapOS
Node_generateHashFile.xml
View file @
7b613a01
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
Compute
Node_generateHashFile
</string>
</value>
<value>
<string>
SlapOS
Node_generateHashFile
</string>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
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