Skip to content

Commit

Permalink
[fuzzing-decision] Use cycle time to determine deadline
Browse files Browse the repository at this point in the history
Allows restarting fuzzing tasks at any time until the next cycle.
This matters a lot for pools where max_run_time << cycle_time
  • Loading branch information
jschwartzentruber committed Nov 13, 2024
1 parent da8e4b9 commit 0b3751b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions services/fuzzing-decision/src/fuzzing_decision/decision/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,13 +431,12 @@ def build_tasks(

preprocess = cast(PoolConfiguration, self.create_preprocess())
if preprocess is not None:
assert preprocess.cycle_time is not None
assert preprocess.max_run_time is not None
task = yaml.safe_load(
FUZZING_TASK.substitute(
created=stringDate(now),
deadline=stringDate(
now + timedelta(seconds=preprocess.max_run_time)
),
deadline=stringDate(now + timedelta(seconds=preprocess.cycle_time)),
description=DESCRIPTION.replace("\n", "\\n"),
expires=stringDate(fromNow("4 weeks", now)),
max_run_time=preprocess.max_run_time,
Expand All @@ -456,13 +455,14 @@ def build_tasks(
preprocess_task_id = slugId()
yield preprocess_task_id, task

assert self.cycle_time is not None
assert self.max_run_time is not None
assert self.tasks is not None
for i in range(1, self.tasks + 1):
task = yaml.safe_load(
FUZZING_TASK.substitute(
created=stringDate(now),
deadline=stringDate(now + timedelta(seconds=self.max_run_time)),
deadline=stringDate(now + timedelta(seconds=self.cycle_time)),
description=DESCRIPTION.replace("\n", "\\n"),
expires=stringDate(fromNow("4 weeks", now)),
max_run_time=self.max_run_time,
Expand Down Expand Up @@ -609,13 +609,14 @@ def build_tasks(
now = datetime.now(timezone.utc)

for pool in self.iterpools():
assert pool.cycle_time is not None
assert pool.max_run_time is not None
assert pool.tasks is not None
for i in range(1, pool.tasks + 1):
task = yaml.safe_load(
FUZZING_TASK.substitute(
created=stringDate(now),
deadline=stringDate(now + timedelta(seconds=pool.max_run_time)),
deadline=stringDate(now + timedelta(seconds=pool.cycle_time)),
description=DESCRIPTION.replace("\n", "\\n"),
expires=stringDate(fromNow("4 weeks", now)),
max_run_time=pool.max_run_time,
Expand Down

0 comments on commit 0b3751b

Please sign in to comment.