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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
f7fd97b4
Commit
f7fd97b4
authored
Jul 05, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: only allocate on allocation_scope/open
parent
e6b5063a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_findPartition.py
...ateItem/portal_skins/slapos_cloud/Person_findPartition.py
+5
-3
No files found.
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Person_findPartition.py
View file @
f7fd97b4
import
random
from
Products.ZSQLCatalog.SQLCatalog
import
SimpleQuery
,
ComplexQuery
person
=
context
portal
=
person
.
getPortalObject
()
assert
project_uid
...
...
@@ -8,6 +9,7 @@ compute_partition = None
filter_kw_copy
=
filter_kw
.
copy
()
query_kw
=
{
'parent__follow_up__uid'
:
project_uid
,
'allocation_scope__uid'
:
portal
.
restrictedTraverse
(
"portal_categories/allocation_scope"
).
getUid
(),
'software_release_url'
:
software_release_url
,
'portal_type'
:
'Compute Partition'
,
}
...
...
@@ -104,8 +106,8 @@ if test_mode:
SQL_WINDOW_SIZE
=
50
# fetch at mot 50 random Compute Partitions, and check if they are ok
isTransitionPossible
=
p
erson
.
getPortalObject
()
.
portal_workflow
.
isTransitionPossible
result_count
=
p
erson
.
portal_catalog
.
countResults
(
**
query_kw
)[
0
][
0
]
isTransitionPossible
=
p
ortal
.
portal_workflow
.
isTransitionPossible
result_count
=
p
ortal
.
portal_catalog
.
countResults
(
**
query_kw
)[
0
][
0
]
offset
=
max
(
0
,
result_count
-
1
)
if
offset
>=
SQL_WINDOW_SIZE
:
limit
=
(
random
.
randint
(
0
,
offset
),
SQL_WINDOW_SIZE
)
...
...
@@ -113,7 +115,7 @@ else:
limit
=
(
0
,
SQL_WINDOW_SIZE
)
for
compute_partition_candidate
in
context
.
portal_catalog
(
for
compute_partition_candidate
in
portal
.
portal_catalog
(
limit
=
limit
,
**
query_kw
):
compute_partition_candidate
=
compute_partition_candidate
.
getObject
()
if
compute_partition_candidate
.
getParentValue
().
getCapacityScope
()
==
"close"
:
...
...
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