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
Arnaud Véron
slapos.core
Commits
0c102f60
Commit
0c102f60
authored
Sep 16, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_ecoallocation: Drop business template
parent
9057d97a
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
0 additions
and
829 deletions
+0
-829
master/bt5/slapos_ecoallocation/PathTemplateItem/service_module/zero_emission_ratio.xml
...n/PathTemplateItem/service_module/zero_emission_ratio.xml
+0
-444
master/bt5/slapos_ecoallocation/SkinTemplateItem/portal_skins/slapos_ecoallocation.xml
...on/SkinTemplateItem/portal_skins/slapos_ecoallocation.xml
+0
-47
master/bt5/slapos_ecoallocation/SkinTemplateItem/portal_skins/slapos_ecoallocation/ComputerConsumptionTioXMLFile_solveInvoicingGenerationEco.py
...puterConsumptionTioXMLFile_solveInvoicingGenerationEco.py
+0
-87
master/bt5/slapos_ecoallocation/SkinTemplateItem/portal_skins/slapos_ecoallocation/ComputerConsumptionTioXMLFile_solveInvoicingGenerationEco.xml
...uterConsumptionTioXMLFile_solveInvoicingGenerationEco.xml
+0
-62
master/bt5/slapos_ecoallocation/SkinTemplateItem/portal_skins/slapos_ecoallocation/Person_findPartitionEcoAllocation.py
...slapos_ecoallocation/Person_findPartitionEcoAllocation.py
+0
-120
master/bt5/slapos_ecoallocation/SkinTemplateItem/portal_skins/slapos_ecoallocation/Person_findPartitionEcoAllocation.xml
...lapos_ecoallocation/Person_findPartitionEcoAllocation.xml
+0
-62
master/bt5/slapos_ecoallocation/bt/template_format_version
master/bt5/slapos_ecoallocation/bt/template_format_version
+0
-1
master/bt5/slapos_ecoallocation/bt/template_keep_path_list
master/bt5/slapos_ecoallocation/bt/template_keep_path_list
+0
-1
master/bt5/slapos_ecoallocation/bt/template_keep_workflow_path_list
.../slapos_ecoallocation/bt/template_keep_workflow_path_list
+0
-1
master/bt5/slapos_ecoallocation/bt/template_path_list
master/bt5/slapos_ecoallocation/bt/template_path_list
+0
-1
master/bt5/slapos_ecoallocation/bt/template_skin_id_list
master/bt5/slapos_ecoallocation/bt/template_skin_id_list
+0
-1
master/bt5/slapos_ecoallocation/bt/title
master/bt5/slapos_ecoallocation/bt/title
+0
-1
master/bt5/slapos_ecoallocation/bt/version
master/bt5/slapos_ecoallocation/bt/version
+0
-1
No files found.
master/bt5/slapos_ecoallocation/PathTemplateItem/service_module/zero_emission_ratio.xml
deleted
100644 → 0
View file @
9057d97a
This diff is collapsed.
Click to expand it.
master/bt5/slapos_ecoallocation/SkinTemplateItem/portal_skins/slapos_ecoallocation.xml
deleted
100644 → 0
View file @
9057d97a
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Folder"
module=
"OFS.Folder"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_local_properties
</string>
</key>
<value>
<tuple>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
business_template_skin_layer_priority
</string>
</value>
</item>
<item>
<key>
<string>
type
</string>
</key>
<value>
<string>
float
</string>
</value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key>
<string>
_objects
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
business_template_skin_layer_priority
</string>
</key>
<value>
<float>
90.0
</float>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
slapos_ecoallocation
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_ecoallocation/SkinTemplateItem/portal_skins/slapos_ecoallocation/ComputerConsumptionTioXMLFile_solveInvoicingGenerationEco.py
deleted
100644 → 0
View file @
9057d97a
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
document
=
context
portal
=
document
.
getPortalObject
()
result
=
[]
tioxml_dict
=
document
.
ComputerConsumptionTioXMLFile_parseXml
()
if
tioxml_dict
is
None
:
document
.
reject
(
comment
=
"Not usable TioXML data"
)
else
:
packing_list_dict
=
{}
for
movement_dict
in
tioxml_dict
[
"movement"
]:
reference
=
movement_dict
[
'reference'
]
if
reference
in
packing_list_dict
:
packing_list_dict
[
reference
].
append
(
movement_dict
)
else
:
packing_list_dict
[
reference
]
=
[
movement_dict
]
compute_node
=
context
.
getContributorValue
(
portal_type
=
"Compute Node"
)
for
reference
,
movement_list
in
packing_list_dict
.
items
():
# Time to create the PL
delivery_template
=
portal
.
restrictedTraverse
(
portal
.
portal_preferences
.
getPreferredInstanceDeliveryTemplate
())
delivery
=
delivery_template
.
Base_createCloneDocument
(
batch_mode
=
1
)
# It had been reported for the compute_node itself so it is pure
# informative.
if
compute_node
.
getReference
()
==
reference
:
person
=
compute_node
.
getSourceAdministrationValue
(
portal_type
=
"Person"
)
aggregate_value_list
=
[
compute_node
]
delivery_title
=
"%s Information Report"
%
compute_node
.
getReference
()
else
:
if
reference
.
startswith
(
"slapuser"
):
reference
=
reference
.
replace
(
"slapuser"
,
"slappart"
)
# Find the partition / software instance / user
partition
=
portal
.
portal_catalog
.
getResultValue
(
parent_uid
=
compute_node
.
getUid
(),
reference
=
reference
,
portal_type
=
"Compute Partition"
,
validation_state
=
"validated"
)
assert
partition
.
getSlapState
()
==
'busy'
instance
=
portal
.
portal_catalog
.
getResultValue
(
default_aggregate_uid
=
partition
.
getUid
(),
portal_type
=
"Software Instance"
,
validation_state
=
"validated"
)
subscription
=
instance
.
getSpecialiseValue
(
portal_type
=
"Instance Tree"
)
person
=
subscription
.
getDestinationSectionValue
(
portal_type
=
"Person"
)
aggregate_value_list
=
[
partition
,
instance
,
subscription
]
delivery_title
=
"%s Consumption Usage"
%
instance
.
getReference
()
delivery
.
edit
(
title
=
delivery_title
,
destination
=
person
.
getRelativeUrl
(),
destination_decision
=
person
.
getRelativeUrl
(),
start_date
=
context
.
getCreationDate
(),
)
result
.
append
(
delivery
.
getRelativeUrl
())
for
movement
in
movement_list
:
service
=
portal
.
restrictedTraverse
(
movement
[
'resource'
])
delivery
.
newContent
(
portal_type
=
"Sale Packing List Line"
,
title
=
movement
[
'title'
],
quantity
=
movement
[
'quantity'
],
aggregate_value_list
=
aggregate_value_list
,
resource_value
=
service
,
quantity_unit
=
service
.
getQuantityUnit
(),
)
delivery
.
confirm
(
comment
=
"Created from %s"
%
context
.
getRelativeUrl
())
delivery
.
start
()
delivery
.
stop
()
delivery
.
deliver
()
delivery
.
startBuilding
()
document
.
share
(
comment
=
"Created packing list: %s"
%
result
)
return
result
master/bt5/slapos_ecoallocation/SkinTemplateItem/portal_skins/slapos_ecoallocation/ComputerConsumptionTioXMLFile_solveInvoicingGenerationEco.xml
deleted
100644 → 0
View file @
9057d97a
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
REQUEST=None
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ComputerConsumptionTioXMLFile_solveInvoicingGenerationEco
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_ecoallocation/SkinTemplateItem/portal_skins/slapos_ecoallocation/Person_findPartitionEcoAllocation.py
deleted
100644 → 0
View file @
9057d97a
import
random
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
ComplexQuery
compute_partition
=
None
query_kw
=
{
'software_release_url'
:
software_release_url
,
'portal_type'
:
'Compute Partition'
,
}
if
software_instance_portal_type
==
"Slave Instance"
:
query_kw
[
'free_for_request'
]
=
0
query_kw
[
'software_type'
]
=
software_type
elif
software_instance_portal_type
==
"Software Instance"
:
query_kw
[
'free_for_request'
]
=
1
else
:
raise
NotImplementedError
(
"Unknown portal type %s"
%
software_instance_portal_type
)
# support SLA
# Explicit location
#explicit_location = False
if
"computer_guid"
in
filter_kw
:
#explicit_location = True
query_kw
[
"parent_reference"
]
=
SimpleQuery
(
parent_reference
=
filter_kw
.
pop
(
"computer_guid"
))
if
"instance_guid"
in
filter_kw
:
#explicit_location = True
instance_guid
=
filter_kw
.
pop
(
"instance_guid"
)
query_kw
[
"aggregate_related_reference"
]
=
SimpleQuery
(
aggregate_related_reference
=
instance_guid
)
if
'network_guid'
in
filter_kw
:
network_guid
=
filter_kw
.
pop
(
'network_guid'
)
query_kw
[
"default_subordination_reference"
]
=
SimpleQuery
(
default_subordination_reference
=
network_guid
)
if
computer_network_query
:
if
query_kw
.
get
(
"default_subordination_reference"
):
query_kw
[
"default_subordination_reference"
]
=
ComplexQuery
(
query_kw
[
"default_subordination_reference"
],
computer_network_query
)
else
:
query_kw
[
"default_subordination_reference"
]
=
computer_network_query
if
"retention_delay"
in
filter_kw
:
filter_kw
.
pop
(
"retention_delay"
)
compute_node_base_category_list
=
[
'group'
,
'cpu_core'
,
'cpu_frequency'
,
'cpu_type'
,
'local_area_network_type'
,
'region'
,
'memory_size'
,
'memory_type'
,
'storage_capacity'
,
'storage_interface'
,
'storage_redundancy'
,
]
for
base_category
in
compute_node_base_category_list
:
if
base_category
in
filter_kw
:
category_relative_url
=
"%s"
%
filter_kw
.
pop
(
base_category
)
# XXX Small protection to prevent entering strange strings
category
=
context
.
getPortalObject
().
portal_categories
[
base_category
].
restrictedTraverse
(
str
(
category_relative_url
),
None
)
if
category
is
None
:
query_kw
[
"uid"
]
=
"-1"
else
:
query_kw
[
"%s_uid"
%
base_category
]
=
category
.
getUid
()
query_kw
[
"capacity_scope_uid"
]
=
context
.
getPortalObject
().
portal_categories
.
capacity_scope
.
open
.
getUid
()
# if not explicit_location:
# # Only allocation on public compute_node
# query_kw["allocation_scope_uid"] = context.getPortalObject().portal_categories.allocation_scope.open.public.getUid()
if
filter_kw
.
keys
():
# XXX Drop all unexpected keys
query_kw
[
"uid"
]
=
"-1"
if
test_mode
:
return
bool
(
len
(
context
.
portal_catalog
(
limit
=
1
,
**
query_kw
)))
# Get only one compute_partition per compute_node
compute_partition_list
=
context
.
portal_catalog
(
group_by
=
"parent_uid"
,
**
query_kw
)
software_release_list
=
context
.
portal_catalog
(
portal_type
=
"Software Release"
,
url_string
=
software_release_url
)
if
len
(
software_release_list
)
==
0
:
# Forbid to allocate partitions without an existing Software Release Document.
raise
KeyError
(
len
(
software_release_list
))
delta_co2_contribution_list
=
software_release_list
[
0
].
SoftwareRelease_getDeltaCO2List
(
compute_partition_list
)
isTransitionPossible
=
context
.
getPortalObject
().
portal_workflow
.
isTransitionPossible
while
len
(
delta_co2_contribution_list
):
partition_candidate_list
=
delta_co2_contribution_list
.
pop
(
min
(
delta_co2_contribution_list
))
for
compute_partition_candidate
in
partition_candidate_list
:
compute_partition_candidate
=
compute_partition_candidate
.
getObject
()
if
software_instance_portal_type
==
"Software Instance"
:
# Check if the compute partition can be marked as busy
if
isTransitionPossible
(
compute_partition_candidate
,
'mark_busy'
):
compute_partition
=
compute_partition_candidate
compute_partition
.
markBusy
()
break
elif
compute_partition_candidate
.
getSlapState
()
==
"busy"
:
# Only assign slave instance on busy partition
compute_partition
=
compute_partition_candidate
break
if
compute_partition
is
None
:
raise
ValueError
(
'It was not possible to find free Compute Partition'
)
# lock compute partition
compute_partition
.
serialize
()
return
compute_partition
.
getRelativeUrl
()
master/bt5/slapos_ecoallocation/SkinTemplateItem/portal_skins/slapos_ecoallocation/Person_findPartitionEcoAllocation.xml
deleted
100644 → 0
View file @
9057d97a
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
software_release_url, software_type, software_instance_portal_type, filter_kw, computer_network_query=None, test_mode=False
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Person_findPartitionEcoAllocation
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_ecoallocation/bt/template_format_version
deleted
100644 → 0
View file @
9057d97a
1
\ No newline at end of file
master/bt5/slapos_ecoallocation/bt/template_keep_path_list
deleted
100644 → 0
View file @
9057d97a
service_module/zero_emission_ratio
\ No newline at end of file
master/bt5/slapos_ecoallocation/bt/template_keep_workflow_path_list
deleted
100644 → 0
View file @
9057d97a
service_module/zero_emission_ratio
\ No newline at end of file
master/bt5/slapos_ecoallocation/bt/template_path_list
deleted
100644 → 0
View file @
9057d97a
service_module/zero_emission_ratio
\ No newline at end of file
master/bt5/slapos_ecoallocation/bt/template_skin_id_list
deleted
100644 → 0
View file @
9057d97a
slapos_ecoallocation
\ No newline at end of file
master/bt5/slapos_ecoallocation/bt/title
deleted
100644 → 0
View file @
9057d97a
slapos_ecoallocation
\ No newline at end of file
master/bt5/slapos_ecoallocation/bt/version
deleted
100644 → 0
View file @
9057d97a
1.0
\ No newline at end of file
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