Skip to content

Commit

Permalink
Skip generation of release times if no invocations were requested.
Browse files Browse the repository at this point in the history
  • Loading branch information
sukritkalra committed Dec 29, 2023
1 parent 4a7eb1e commit f718020
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions workload/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,15 @@ class JobGraph(Graph[Job]):
deadline can be dithered on top of the actual execution time.
"""

RELEASE_POLICIES = (
"periodic",
"fixed",
"poisson",
"gamma",
"closed_loop",
"fixed_gamma",
)

class ReleasePolicyType(Enum):
"""Represents the different release policies supported by a JobGraph."""

Expand Down Expand Up @@ -254,6 +263,10 @@ def get_release_times(self, completion_time: EventTime) -> List[EventTime]:
needs to be extrapolated.
"""
releases = []
if self._fixed_invocation_nums == 0:
# If there are no invocations, we return an empty list.
return releases

if self._policy_type == JobGraph.ReleasePolicyType.PERIODIC:
releases.extend(
map(
Expand Down Expand Up @@ -649,6 +662,14 @@ def concurrency(self) -> int:
def start_time(self) -> EventTime:
return self._start

def __str__(self) -> str:
return (
f"ReleasePolicy(policy_type={self.policy_type}, period={self._period}, "
f"num_invocations={self._fixed_invocation_nums}, "
f"rate={self._variable_arrival_rate}, coefficient={self._coefficient}, "
f"concurrency={self._concurrency}, start_time={self.start_time})"
)

def __init__(
self,
name: str,
Expand Down

0 comments on commit f718020

Please sign in to comment.