-
Notifications
You must be signed in to change notification settings - Fork 1
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
32aac4b
commit 5871342
Showing
24 changed files
with
371 additions
and
396 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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
temp/ | ||
|
||
# C extensions | ||
*.so | ||
|
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from .Decider import * | ||
|
||
class CompressionOnlyDecider(Decider): | ||
def __init__(self): | ||
super().__init__() | ||
|
||
def decision(self, workflowlist): | ||
results = [] | ||
for CreationID, interval, SLA, application in workflowlist: | ||
choice = self.choices[2] | ||
tasklist = self.createTasks(CreationID, interval, SLA, application, choice) | ||
results += tasklist | ||
return results |
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,18 +1,40 @@ | ||
import math | ||
from utils.MathUtils import * | ||
from utils.MathConstants import * | ||
import pandas as pd | ||
from statistics import median | ||
import numpy as np | ||
from serverless.function.Task import * | ||
|
||
class Decider(): | ||
def __init__(self): | ||
self.env = None | ||
self.choices = ['layer', 'semantic', 'compression'] | ||
self.dataset = list(filter(lambda k: '.md' not in k, os.listdir(SAMPLE_PATH))) | ||
self.dataset = [os.path.join(SAMPLE_PATH, i) for i in self.dataset] | ||
|
||
def setEnvironment(self, env): | ||
self.env = env | ||
|
||
def decision(self, workflowlist): | ||
pass | ||
|
||
def getLayerInputs(self, cid, i): | ||
paths = [] | ||
for d in DSET: | ||
d2 = DSET[0].split('.')[0] | ||
paths.append(f'./temp/{d2}_L_{cid}_{i}.jpg') | ||
return paths | ||
|
||
def createTasks(cid, interval, SLA, application, choice): | ||
tasklist = [] | ||
if choice == 'semantic': | ||
tasklist.append(Task(cid, interval, SLA, application, choice, self.env, 0, [], [self.dataset[0]])) | ||
tasklist.append(Task(cid, interval, SLA, application, choice, self.env, 1, [], [self.dataset[1]])) | ||
tasklist.append(Task(cid, interval, SLA, application, choice, self.env, 2, [], [self.dataset[2]])) | ||
tasklist.append(Task(cid, interval, SLA, application, choice, self.env, 3, [], [self.dataset[3]])) | ||
elif choice == 'layer': | ||
tasklist.append(Task(cid, interval, SLA, application, choice, self.env, 0, [], self.dataset)) | ||
tasklist.append(Task(cid, interval, SLA, application, choice, self.env, 1, [0], self.getLayerInputs(cid, 0))) | ||
tasklist.append(Task(cid, interval, SLA, application, choice, self.env, 2, [0, 1], self.getLayerInputs(cid, 1))) | ||
tasklist.append(Task(cid, interval, SLA, application, choice, self.env, 3, [0, 1, 2], self.getLayerInputs(cid, 2))) | ||
elif choice == 'compression': | ||
tasklist.append(Task(cid, interval, SLA, application, choice, self.env, 0, [], self.dataset*2)) | ||
return tasklist | ||
|
||
|
||
|
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,9 +1,14 @@ | ||
from .Decider import * | ||
import random | ||
import numpy as np | ||
|
||
class RandomDecider(Decider): | ||
def __init__(self): | ||
super().__init__() | ||
|
||
def decision(self, workflowlist): | ||
return random.choices(self.choices, k = len(workflowlist)) | ||
results = [] | ||
for CreationID, interval, SLA, application in workflowlist: | ||
choice = np.random.choice(self.choices) | ||
tasklist = self.createTasks(CreationID, interval, SLA, application, choice) | ||
results += tasklist | ||
return results |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.