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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
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
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
10 deletions
+48
-10
circle/circle/settings/base.py
+3
-0
circle/dashboard/forms.py
+7
-7
circle/dashboard/templates/dashboard/_resources-sliders.html
+0
-0
circle/dashboard/templates/dashboard/vm-detail/network.html
+2
-0
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) ^
...
@@ -574,6 +574,9 @@ SESSION_COOKIE_NAME = "csessid%x" % (((getnode() // 139) ^
(
getnode
()
%
983
))
&
0xffff
)
(
getnode
()
%
983
))
&
0xffff
)
MAX_NODE_RAM
=
get_env_variable
(
"MAX_NODE_RAM"
,
1024
)
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/)
# 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/'
)
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
...
@@ -59,7 +59,7 @@ from storage.models import DataStore, Disk
from
django.contrib.admin.widgets
import
FilteredSelectMultiple
from
django.contrib.admin.widgets
import
FilteredSelectMultiple
from
django.contrib.auth.models
import
Permission
from
django.contrib.auth.models
import
Permission
from
.models
import
Profile
,
GroupProfile
,
Message
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
django.utils.translation
import
string_concat
from
.validators
import
domain_validator
from
.validators
import
domain_validator
...
@@ -118,10 +118,10 @@ class VmCustomizeForm(forms.Form):
...
@@ -118,10 +118,10 @@ class VmCustomizeForm(forms.Form):
cpu_count
=
forms
.
IntegerField
(
widget
=
forms
.
NumberInput
(
attrs
=
{
cpu_count
=
forms
.
IntegerField
(
widget
=
forms
.
NumberInput
(
attrs
=
{
'class'
:
"form-control input-tags cpu-count-input"
,
'class'
:
"form-control input-tags cpu-count-input"
,
'min'
:
1
,
'min'
:
1
,
'max'
:
10
,
'max'
:
MAX_NODE_CPU_CORE
,
'required'
:
""
,
'required'
:
""
,
}),
}),
min_value
=
1
,
max_value
=
10
,
min_value
=
1
,
max_value
=
MAX_NODE_CPU_CORE
,
)
)
ram_size
=
forms
.
IntegerField
(
widget
=
forms
.
TextInput
(
attrs
=
{
ram_size
=
forms
.
IntegerField
(
widget
=
forms
.
TextInput
(
attrs
=
{
...
@@ -466,10 +466,10 @@ class TemplateForm(forms.ModelForm):
...
@@ -466,10 +466,10 @@ class TemplateForm(forms.ModelForm):
num_cores
=
forms
.
IntegerField
(
widget
=
forms
.
NumberInput
(
attrs
=
{
num_cores
=
forms
.
IntegerField
(
widget
=
forms
.
NumberInput
(
attrs
=
{
'class'
:
"form-control input-tags cpu-count-input"
,
'class'
:
"form-control input-tags cpu-count-input"
,
'min'
:
1
,
'min'
:
1
,
'max'
:
10
,
'max'
:
MAX_NODE_CPU_CORE
,
'required'
:
""
,
'required'
:
""
,
}),
}),
min_value
=
1
,
max_value
=
10
,
min_value
=
1
,
max_value
=
MAX_NODE_CPU_CORE
,
)
)
ram_size
=
forms
.
IntegerField
(
widget
=
forms
.
NumberInput
(
attrs
=
{
ram_size
=
forms
.
IntegerField
(
widget
=
forms
.
NumberInput
(
attrs
=
{
...
@@ -1508,10 +1508,10 @@ class VmResourcesForm(forms.ModelForm):
...
@@ -1508,10 +1508,10 @@ class VmResourcesForm(forms.ModelForm):
num_cores
=
forms
.
IntegerField
(
widget
=
forms
.
NumberInput
(
attrs
=
{
num_cores
=
forms
.
IntegerField
(
widget
=
forms
.
NumberInput
(
attrs
=
{
'class'
:
"form-control input-tags cpu-count-input"
,
'class'
:
"form-control input-tags cpu-count-input"
,
'min'
:
1
,
'min'
:
1
,
'max'
:
10
,
'max'
:
MAX_NODE_CPU_CORE
,
'required'
:
""
,
'required'
:
""
,
}),
}),
min_value
=
1
,
max_value
=
10
,
min_value
=
1
,
max_value
=
MAX_NODE_CPU_CORE
,
)
)
ram_size
=
forms
.
IntegerField
(
widget
=
forms
.
NumberInput
(
attrs
=
{
ram_size
=
forms
.
IntegerField
(
widget
=
forms
.
NumberInput
(
attrs
=
{
...
...
circle/dashboard/templates/dashboard/_resources-sliders.html
View file @
0ea5e0fd
circle/dashboard/templates/dashboard/vm-detail/network.html
View file @
0ea5e0fd
...
@@ -73,7 +73,9 @@
...
@@ -73,7 +73,9 @@
{% if l.ipv4 %}
{% if l.ipv4 %}
<tr>
<tr>
<td>
<td>
{% autoescape off %}
{% display_portforward4 l %}
{% display_portforward4 l %}
{% endautoescape %}
</td>
</td>
<td><i
class=
"fa fa-long-arrow-right"
></i></td>
<td><i
class=
"fa fa-long-arrow-right"
></i></td>
<td>
<td>
...
...
circle/manager/scheduler.py
View file @
0ea5e0fd
...
@@ -23,6 +23,10 @@ from django.conf import settings
...
@@ -23,6 +23,10 @@ from django.conf import settings
from
common.models
import
HumanReadableException
from
common.models
import
HumanReadableException
from
circle.settings.base
import
SCHEDULER_METHOD
import
random
logger
=
getLogger
(
__name__
)
logger
=
getLogger
(
__name__
)
...
@@ -52,9 +56,7 @@ class TraitsUnsatisfiableException(SchedulerError):
...
@@ -52,9 +56,7 @@ class TraitsUnsatisfiableException(SchedulerError):
"new virtual machine currently."
)
"new virtual machine currently."
)
def
select_node
(
instance
,
nodes
):
def
common_select
(
instance
,
nodes
):
''' Select a node for hosting an instance based on its requirements.
'''
# check required traits
# check required traits
nodes
=
[
n
for
n
in
nodes
nodes
=
[
n
for
n
in
nodes
if
n
.
schedule_enabled
and
n
.
online
and
if
n
.
schedule_enabled
and
n
.
online
and
...
@@ -71,9 +73,40 @@ def select_node(instance, nodes):
...
@@ -71,9 +73,40 @@ def select_node(instance, nodes):
# sort nodes first by sorting_key, then priority
# sort nodes first by sorting_key, then priority
nodes
.
sort
(
key
=
lambda
n
:
n
.
priority
,
reverse
=
True
)
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
)
nodes
.
sort
(
key
=
sorting_key
,
reverse
=
True
)
result
=
nodes
[
0
]
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
))
logger
.
info
(
'select_node:
%
s for
%
s'
,
unicode
(
result
),
unicode
(
instance
))
result
.
time_stamp
=
timezone
.
now
()
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