Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0ea5e0fd
authored
Oct 18, 2018
by
Belákovics Ádám
Browse files
Options
Browse Files
Download
Plain Diff
added the new algorithm to SCHEDULER_METHODs
parents
11d0ec42
e8684154
Pipeline
#671
passed with stage
in 0 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
12 deletions
+50
-12
circle/circle/settings/base.py
+3
-0
circle/dashboard/forms.py
+7
-7
circle/dashboard/templates/dashboard/_resources-sliders.html
+1
-1
circle/dashboard/templates/dashboard/vm-detail/network.html
+3
-1
circle/manager/scheduler.py
+36
-3
No files found.
circle/circle/settings/base.py
View file @
0ea5e0fd
...
...
@@ -574,6 +574,9 @@ SESSION_COOKIE_NAME = "csessid%x" % (((getnode() // 139) ^
(
getnode
()
%
983
))
&
0xffff
)
MAX_NODE_RAM
=
get_env_variable
(
"MAX_NODE_RAM"
,
1024
)
MAX_NODE_CPU_CORE
=
get_env_variable
(
"MAX_NODE_CPU_CORE"
,
10
)
SCHEDULER_METHOD
=
get_env_variable
(
"SCHEDULER_METHOD"
,
'random'
)
# Url to download the client: (e.g. http://circlecloud.org/client/download/)
CLIENT_DOWNLOAD_URL
=
get_env_variable
(
'CLIENT_DOWNLOAD_URL'
,
'http://circlecloud.org/client/download/'
)
...
...
circle/dashboard/forms.py
View file @
0ea5e0fd
...
...
@@ -59,7 +59,7 @@ from storage.models import DataStore, Disk
from
django.contrib.admin.widgets
import
FilteredSelectMultiple
from
django.contrib.auth.models
import
Permission
from
.models
import
Profile
,
GroupProfile
,
Message
from
circle.settings.base
import
LANGUAGES
,
MAX_NODE_RAM
from
circle.settings.base
import
LANGUAGES
,
MAX_NODE_RAM
,
MAX_NODE_CPU_CORE
from
django.utils.translation
import
string_concat
from
.validators
import
domain_validator
...
...
@@ -118,10 +118,10 @@ class VmCustomizeForm(forms.Form):
cpu_count
=
forms
.
IntegerField
(
widget
=
forms
.
NumberInput
(
attrs
=
{
'class'
:
"form-control input-tags cpu-count-input"
,
'min'
:
1
,
'max'
:
10
,
'max'
:
MAX_NODE_CPU_CORE
,
'required'
:
""
,
}),
min_value
=
1
,
max_value
=
10
,
min_value
=
1
,
max_value
=
MAX_NODE_CPU_CORE
,
)
ram_size
=
forms
.
IntegerField
(
widget
=
forms
.
TextInput
(
attrs
=
{
...
...
@@ -466,10 +466,10 @@ class TemplateForm(forms.ModelForm):
num_cores
=
forms
.
IntegerField
(
widget
=
forms
.
NumberInput
(
attrs
=
{
'class'
:
"form-control input-tags cpu-count-input"
,
'min'
:
1
,
'max'
:
10
,
'max'
:
MAX_NODE_CPU_CORE
,
'required'
:
""
,
}),
min_value
=
1
,
max_value
=
10
,
min_value
=
1
,
max_value
=
MAX_NODE_CPU_CORE
,
)
ram_size
=
forms
.
IntegerField
(
widget
=
forms
.
NumberInput
(
attrs
=
{
...
...
@@ -1508,10 +1508,10 @@ class VmResourcesForm(forms.ModelForm):
num_cores
=
forms
.
IntegerField
(
widget
=
forms
.
NumberInput
(
attrs
=
{
'class'
:
"form-control input-tags cpu-count-input"
,
'min'
:
1
,
'max'
:
10
,
'max'
:
MAX_NODE_CPU_CORE
,
'required'
:
""
,
}),
min_value
=
1
,
max_value
=
10
,
min_value
=
1
,
max_value
=
MAX_NODE_CPU_CORE
,
)
ram_size
=
forms
.
IntegerField
(
widget
=
forms
.
NumberInput
(
attrs
=
{
...
...
circle/dashboard/templates/dashboard/_resources-sliders.html
View file @
0ea5e0fd
...
...
@@ -46,7 +46,7 @@
<i
class=
"fa fa-ticket"
></i>
{% trans "RAM amount" %}
</div>
<div
class=
"col-sm-6"
>
<input
type=
"text"
class=
"vm-slider ram-slider"
<input
type=
"text"
class=
"vm-slider ram-slider"
disabled
placeholder=
"{% trans "
Enable
JS
for
fancy
sliders
"
%}"
data-slider=
"true"
data-slider-highlight=
"true"
data-slider-range=
"0, 8192"
data-slider-step=
"128"
data-slider-snap=
"true"
/>
...
...
circle/dashboard/templates/dashboard/vm-detail/network.html
View file @
0ea5e0fd
...
...
@@ -73,7 +73,9 @@
{% if l.ipv4 %}
<tr>
<td>
{% display_portforward4 l %}
{% autoescape off %}
{% display_portforward4 l %}
{% endautoescape %}
</td>
<td><i
class=
"fa fa-long-arrow-right"
></i></td>
<td>
...
...
circle/manager/scheduler.py
View file @
0ea5e0fd
...
...
@@ -23,6 +23,10 @@ from django.conf import settings
from
common.models
import
HumanReadableException
from
circle.settings.base
import
SCHEDULER_METHOD
import
random
logger
=
getLogger
(
__name__
)
...
...
@@ -52,9 +56,7 @@ class TraitsUnsatisfiableException(SchedulerError):
"new virtual machine currently."
)
def
select_node
(
instance
,
nodes
):
''' Select a node for hosting an instance based on its requirements.
'''
def
common_select
(
instance
,
nodes
):
# check required traits
nodes
=
[
n
for
n
in
nodes
if
n
.
schedule_enabled
and
n
.
online
and
...
...
@@ -71,9 +73,40 @@ def select_node(instance, nodes):
# sort nodes first by sorting_key, then priority
nodes
.
sort
(
key
=
lambda
n
:
n
.
priority
,
reverse
=
True
)
return
nodes
def
common_evenly
(
instance
,
nodes
):
nodes
=
common_select
(
instance
,
nodes
)
nodes
.
sort
(
key
=
free_cpu_time
,
reverse
=
True
)
result
=
nodes
[
0
]
return
result
def
common_random
(
instance
,
nodes
):
nodes
=
common_select
(
instance
,
nodes
)
result
=
random
.
choice
(
nodes
)
return
result
def
advanced_with_time_stamp
(
instance
,
nodes
):
nodes
=
common_select
(
instance
,
nodes
)
nodes
.
sort
(
key
=
sorting_key
,
reverse
=
True
)
result
=
nodes
[
0
]
return
result
def
select_node
(
instance
,
nodes
):
''' Select a node for hosting an instance based on its requirements.
'''
if
SCHEDULER_METHOD
==
'evenly'
:
result
=
common_evenly
(
instance
,
nodes
)
elif
SCHEDULER_METHOD
==
'random'
:
result
=
common_random
(
instance
,
nodes
)
elif
SCHEDULER_METHOD
==
'advanced'
:
result
=
advanced_with_time_stamp
(
instance
,
nodes
)
else
:
# Default method is the random
result
=
common_random
(
instance
,
nodes
)
logger
.
info
(
'Scheduler method:
%
s selected'
,
unicode
(
SCHEDULER_METHOD
))
logger
.
info
(
'select_node:
%
s for
%
s'
,
unicode
(
result
),
unicode
(
instance
))
result
.
time_stamp
=
timezone
.
now
()
...
...
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