-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2fe2cb8
commit 257698b
Showing
15 changed files
with
381 additions
and
385 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,4 +68,4 @@ service_run: | |
- echo "Finished" | ||
only: | ||
- master | ||
- feature/dev | ||
- feature/dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +0,0 @@ | ||
[submodule "hcloud-badge"] | ||
path = hcloud-badge | ||
url = ssh://[email protected]:8102/iitp-sds/hcloud-badge.git | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# hcc-violin_scheduler | ||
Hcloud Classic Server Deploy Scheduler | ||
# hcc-violin_scheduler | ||
Hcloud Classic Server Deploy Scheduler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,62 @@ | ||
package driver | ||
|
||
import ( | ||
"fmt" | ||
"hcc/violin-scheduler/data" | ||
"hcc/violin-scheduler/lib/logger" | ||
"hcc/violin-scheduler/lib/scheduler" | ||
"hcc/violin-scheduler/model" | ||
"time" | ||
) | ||
|
||
// ScheduleNodes : Scheduling nodes | ||
func ScheduleNodes(args map[string]interface{}) (interface{}, error) { | ||
listNodeData, err := AllNodes() | ||
nodes := listNodeData.(data.ListNodeData).Data.ListNode | ||
var userQuota model.Quota | ||
userQuota.ServerUUID = args["server_uuid"].(string) | ||
userQuota.CPU = args["cpu"].(int) | ||
userQuota.Memory = args["memory"].(int) | ||
userQuota.NumberOfNodes = args["nr_node"].(int) | ||
|
||
if err != nil { | ||
logger.Logger.Print(err) | ||
return nil, err | ||
} | ||
var testlist model.ScheduledNodes | ||
startTime := time.Now() | ||
selectedNodeList, err := scheduler.NodeListParser(nodes, userQuota) | ||
for _, selectedNodeUUID := range selectedNodeList { | ||
testlist.NodeList = append(testlist.NodeList, selectedNodeUUID) | ||
} | ||
var returnData data.ScheduledNodeData | ||
returnData.Data.ScheduledNode = testlist | ||
elapsedTime := time.Since((startTime)) | ||
logger.Logger.Println("[Create Server Scheduling Action]\nServer UUID : ", args["server_uuid"], " Scheduling Elapse Time : ", elapsedTime) | ||
return returnData.Data.ScheduledNode, err | ||
} | ||
|
||
func TestSchedule(args map[string]interface{}) (interface{}, error) { | ||
listNodeData, err := AllNodes() | ||
nodes := listNodeData.(data.ListNodeData).Data.ListNode | ||
var userQuota model.Quota | ||
userQuota.ServerUUID = args["server_uuid"].(string) | ||
userQuota.CPU = args["cpu"].(int) | ||
userQuota.Memory = args["memory"].(int) | ||
userQuota.NumberOfNodes = args["nr_node"].(int) | ||
|
||
if err != nil { | ||
logger.Logger.Print(err) | ||
return nil, err | ||
} | ||
var testlist model.ScheduledNodes | ||
startTime := time.Now() | ||
selectedNodeList, err := scheduler.NodeListParser(nodes, userQuota) | ||
for _, selectedNodeUUID := range selectedNodeList { | ||
testlist.NodeList = append(testlist.NodeList, selectedNodeUUID) | ||
fmt.Println("nodelist.NodeList: ", testlist.NodeList) | ||
} | ||
elapsedTime := time.Since((startTime)) | ||
logger.Logger.Println("[Create Server Scheduling Action]\nServer UUID : ", args["server_uuid"], " Scheduling Elapse Time : ", elapsedTime) | ||
return testlist.NodeList, err | ||
} | ||
package driver | ||
|
||
import ( | ||
"fmt" | ||
"hcc/violin-scheduler/data" | ||
"hcc/violin-scheduler/lib/logger" | ||
"hcc/violin-scheduler/lib/scheduler" | ||
"hcc/violin-scheduler/model" | ||
"time" | ||
) | ||
|
||
// ScheduleNodes : Scheduling nodes | ||
func ScheduleNodes(args map[string]interface{}) (interface{}, error) { | ||
listNodeData, err := AllNodes() | ||
nodes := listNodeData.(data.ListNodeData).Data.ListNode | ||
var userQuota model.Quota | ||
userQuota.ServerUUID = args["server_uuid"].(string) | ||
userQuota.CPU = args["cpu"].(int) | ||
userQuota.Memory = args["memory"].(int) | ||
userQuota.NumberOfNodes = args["nr_node"].(int) | ||
|
||
if err != nil { | ||
logger.Logger.Print(err) | ||
return nil, err | ||
} | ||
var testlist model.ScheduledNodes | ||
startTime := time.Now() | ||
selectedNodeList, err := scheduler.NodeListParser(nodes, userQuota) | ||
for _, selectedNodeUUID := range selectedNodeList { | ||
testlist.NodeList = append(testlist.NodeList, selectedNodeUUID) | ||
} | ||
var returnData data.ScheduledNodeData | ||
returnData.Data.ScheduledNode = testlist | ||
elapsedTime := time.Since((startTime)) | ||
logger.Logger.Println("[Create Server Scheduling Action]\nServer UUID : ", args["server_uuid"], " Scheduling Elapse Time : ", elapsedTime) | ||
return returnData.Data.ScheduledNode, err | ||
} | ||
|
||
func TestSchedule(args map[string]interface{}) (interface{}, error) { | ||
listNodeData, err := AllNodes() | ||
nodes := listNodeData.(data.ListNodeData).Data.ListNode | ||
var userQuota model.Quota | ||
userQuota.ServerUUID = args["server_uuid"].(string) | ||
userQuota.CPU = args["cpu"].(int) | ||
userQuota.Memory = args["memory"].(int) | ||
userQuota.NumberOfNodes = args["nr_node"].(int) | ||
|
||
if err != nil { | ||
logger.Logger.Print(err) | ||
return nil, err | ||
} | ||
var testlist model.ScheduledNodes | ||
startTime := time.Now() | ||
selectedNodeList, err := scheduler.NodeListParser(nodes, userQuota) | ||
for _, selectedNodeUUID := range selectedNodeList { | ||
testlist.NodeList = append(testlist.NodeList, selectedNodeUUID) | ||
fmt.Println("nodelist.NodeList: ", testlist.NodeList) | ||
} | ||
elapsedTime := time.Since((startTime)) | ||
logger.Logger.Println("[Create Server Scheduling Action]\nServer UUID : ", args["server_uuid"], " Scheduling Elapse Time : ", elapsedTime) | ||
return testlist.NodeList, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package end | ||
|
||
// MainEnd : Main ending function | ||
func MainEnd() { | ||
// mysqlEnd() | ||
loggerEnd() | ||
} | ||
package end | ||
|
||
// MainEnd : Main ending function | ||
func MainEnd() { | ||
// mysqlEnd() | ||
loggerEnd() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
package http | ||
|
||
import ( | ||
"net/url" | ||
"strings" | ||
) | ||
|
||
func compatibleRFC3986Encode(str string) string { | ||
resultStr := str | ||
resultStr = strings.Replace(resultStr, "+", "%20", -1) | ||
return resultStr | ||
} | ||
|
||
func queryURLEncoder(queryString string) string { | ||
params := url.Values{ | ||
"query_string": {queryString}, | ||
} | ||
|
||
urlEncode := compatibleRFC3986Encode(params.Encode()) | ||
urlEncode = urlEncode[len("query_string="):] | ||
|
||
return urlEncode | ||
} | ||
package http | ||
|
||
import ( | ||
"net/url" | ||
"strings" | ||
) | ||
|
||
func compatibleRFC3986Encode(str string) string { | ||
resultStr := str | ||
resultStr = strings.Replace(resultStr, "+", "%20", -1) | ||
return resultStr | ||
} | ||
|
||
func queryURLEncoder(queryString string) string { | ||
params := url.Values{ | ||
"query_string": {queryString}, | ||
} | ||
|
||
urlEncode := compatibleRFC3986Encode(params.Encode()) | ||
urlEncode = urlEncode[len("query_string="):] | ||
|
||
return urlEncode | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
package config | ||
|
||
import "github.com/Terry-Mao/goconf" | ||
|
||
var configLocation = "/etc/hcc/violin-scheduler/violin-scheduler.conf" | ||
|
||
type schedulerConfig struct { | ||
MysqlConfig *goconf.Section | ||
HTTPConfig *goconf.Section | ||
RabbitMQConfig *goconf.Section | ||
FluteConfig *goconf.Section | ||
GrpcConfig *goconf.Section | ||
} | ||
package config | ||
|
||
import "github.com/Terry-Mao/goconf" | ||
|
||
var configLocation = "/etc/hcc/violin-scheduler/violin-scheduler.conf" | ||
|
||
type schedulerConfig struct { | ||
MysqlConfig *goconf.Section | ||
HTTPConfig *goconf.Section | ||
RabbitMQConfig *goconf.Section | ||
FluteConfig *goconf.Section | ||
GrpcConfig *goconf.Section | ||
} |
Oops, something went wrong.