Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Efficiency improvements #23

Merged
merged 4 commits into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions experiments/dax_convert_and_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import shadow.algorithms.heuristic as heuristic

workflow = Workflow('dax_files/output/shadow_Epigenomics_24.json')
env = Environment('environments/sys.json')
workflow.add_environment(env)
env = Environment("environments/sys.json")
workflow.add_environment("env")
heuristic.heft(workflow)


Expand Down
97 changes: 0 additions & 97 deletions recipes/routput/system_spec_20_[(200, 400)]_[1.0]

This file was deleted.

5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
simpy
numpy >= 1.19.0
networkx >= 2.3
networkx >= 2.6
pandas >= 0.24.2
matplotlib >= 3.1.0
coverage==4.5.4
coveralls==1.8.2
pydot
graphviz
graphviz
tqdm
143 changes: 71 additions & 72 deletions shadow.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,58 +20,58 @@
import unittest
import logging

import test
from test import test_workflow, test_heuristic
from shadow.algorithms.heuristic import heft
from shadow.models.workflow import Workflow
from shadow.models.environment import Environment

testcases = { # Tests for the test runner
"workflow": test.test_workflow,
"heuristic": test.test_heuristic
"workflow": test_workflow,
"heuristic": test_heuristic
}


def run_tests(arg, tests, curr_parser):
if arg['all']:
suite = unittest.TestSuite()
loader = unittest.TestLoader()
for test in tests:
suite.addTests(loader.loadTestsFromModule(tests[test]))
runner = unittest.TextTestRunner()
runner.run(suite)
return True

if arg['case']:
for case in arg['case']:
suite = unittest.TestSuite()
loader = unittest.TestLoader()
suite.addTests(loader.loadTestsFromModule(tests[case]))
runner = unittest.TextTestRunner()
runner.run(suite)
else:
curr_parser.print_help()
if arg['all']:
suite = unittest.TestSuite()
loader = unittest.TestLoader()
for test in tests:
suite.addTests(loader.loadTestsFromModule(tests[test]))
runner = unittest.TextTestRunner()
runner.run(suite)
return True

if arg['case']:
for case in arg['case']:
suite = unittest.TestSuite()
loader = unittest.TestLoader()
suite.addTests(loader.loadTestsFromModule(tests[case]))
runner = unittest.TextTestRunner()
runner.run(suite)
else:
curr_parser.print_help()


def run_shadow():
"""
env = Environment(environment_config)
wf = Workflow(workflow_config)
wf.add_environment()
env.run_workflows(heuristic.heft)
"""
env = Environment(environment_config)
wf = Workflow(workflow_config)
wf.add_environment()
env.run_workflows(heuristic.heft)

:return:
"""
pass
:return:
"""
pass


def run_algorithm(arg, parser):
if arg['algorithm'] == 'heft':
pass
wf = Workflow(arg['workflow'])
env = Environment(arg['environment'])
wf.add_environment(env)
print(heft(wf))
print(wf.machine_alloc)
if arg['algorithm'] == 'heft':
pass
wf = Workflow(arg['workflow'])
env = Environment(arg['environment'])
wf.add_environment(env)
print(heft(wf).makespan)
# print(wf.machine_alloc)


# wf = Workflow(arg['graph'])
Expand All @@ -82,39 +82,38 @@ def run_algorithm(arg, parser):


if __name__ == "__main__":

parser = argparse.ArgumentParser(description='ScHeduling Algorithms for Data-Intensive Workflows')
parser.add_argument('--log', help='Log-level for logger (default is 3 [Warning])')

subparsers = parser.add_subparsers(help='Command', dest='command')

# choices = list(cfg.test.keys())
# test = { # Tests for the test runner
# "workflow": test.test_workflow,
# "graph_generator": test.test_graph_generator,
# "heuristic": test.test_heuristic,
# "metaheuristic": test.test_metaheuristic}

test_parser = subparsers.add_parser('test', help='Test Runner')
test_parser.add_argument('--all', action='store_true', help='Run all test')
test_parser.add_argument('--case', nargs='+', choices=list(testcases), help='Run the following test cases')

test_parser.set_defaults(func=run_tests)

algorithm_parser = subparsers.add_parser('algorithm', help='Run a single algorithm on a given data file')
algorithm_parser.set_defaults(func=run_algorithm)
algorithm_parser.add_argument('algorithm', help='Name of algorithm')
algorithm_parser.add_argument('workflow', help='Location of workflow config')
algorithm_parser.add_argument('environment', help='Location of the environment config')

args = parser.parse_args()
if not args.command:
parser.print_help()
if args.log:
# Levels in logger are multiples of 10, so we multiply by 10 so people use the logical 1/2/3/4
loglevel = int(args.log) * 10
logging.basicConfig(level=loglevel)
if args.command == 'algorithm':
args.func(vars(args), algorithm_parser)
if args.command == 'test':
args.func(vars(args), testcases, test_parser)
# logging.basicConfig(level="DEBUG")
parser = argparse.ArgumentParser(
description='ScHeduling Algorithms for Data-Intensive Workflows')
parser.add_argument('--log',
help='Log-level for logger (default is 3 [Warning])')

subparsers = parser.add_subparsers(help='Command', dest='command')

test_parser = subparsers.add_parser('test', help='Test Runner')
test_parser.add_argument('--all', action='store_true', help='Run all test')
test_parser.add_argument('--case', nargs='+', choices=list(testcases),
help='Run the following test cases')

test_parser.set_defaults(func=run_tests)

algorithm_parser = subparsers.add_parser('algorithm',
help='Run a single algorithm on a given data file')
algorithm_parser.set_defaults(func=run_algorithm)
algorithm_parser.add_argument('algorithm', help='Name of algorithm')
algorithm_parser.add_argument('workflow',
help='Location of workflow config')
algorithm_parser.add_argument('environment',
help='Location of the environment config')

args = parser.parse_args()
if not args.command:
parser.print_help()
if args.log:
# Levels in logger are multiples of 10, so we multiply by 10 so people use the logical 1/2/3/4
loglevel = int(args.log) * 10
logging.basicConfig(level=loglevel)
if args.command == 'algorithm':
args.func(vars(args), algorithm_parser)
if args.command == 'test':
args.func(vars(args), testcases, test_parser)
Loading