Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
User expired
2018s-advanced-distributed-systems
Commits
1582cde1
Unverified
Commit
1582cde1
authored
Dec 05, 2018
by
Bennett Piater
Browse files
add parallel width estimate
parent
41069a10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
scheduler/main.py
scheduler/main.py
+12
-0
scheduler/preprocessing.py
scheduler/preprocessing.py
+26
-0
No files found.
scheduler/main.py
0 → 100755
View file @
1582cde1
#!/usr/bin/env python3
from
typing
import
List
from
parser
import
parse_tasks
,
parse_machine_prices
from
preprocessing
import
*
def
main
():
tasks
=
parse_tasks
()
parallel_width_estimate
=
parallel_width_assuming_mapreduce
(
tasks
)
# print(parallel_width_estimate)
if
__name__
==
"__main__"
:
main
()
scheduler/preprocessing.py
View file @
1582cde1
#!/usr/bin/env python3
from
typing
import
List
from
taskgraph
import
*
def
parallel_width_assuming_mapreduce
(
taskgraph
:
List
[
Task
])
->
int
:
max_width
=
1
current_width
=
0
current_predecessors
=
None
for
task
in
taskgraph
:
# check for one row in the graph
if
task
.
inDegree
==
1
and
(
current_predecessors
==
None
or
current_predecessors
==
task
.
predecessors
):
current_width
+=
1
current_predecessors
=
task
.
predecessors
else
:
current_predecessors
=
None
current_width
=
0
max_width
=
max
(
current_width
,
max_width
)
return
max_width
def
best_performance_under_limit
(
taskgraph
:
List
[
Task
],
prices
:
List
[
float
],
limit
:
float
)
->
List
[
float
]:
pass
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