Skip to content

Commit 31cfd12

Browse files
authored
Expose compilation timeout programatically (#114)
1 parent 457a8c2 commit 31cfd12

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

compiler_opt/rl/compilation_runner.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@ def is_priority_method(cls, method_name: str) -> bool:
283283
def __init__(self,
284284
clang_path: Optional[str] = None,
285285
launcher_path: Optional[str] = None,
286-
moving_average_decay_rate: float = 1):
286+
moving_average_decay_rate: float = 1,
287+
compilation_timeout=None):
287288
"""Initialization of CompilationRunner class.
288289
289290
Args:
@@ -294,7 +295,9 @@ def __init__(self,
294295
self._clang_path = clang_path
295296
self._launcher_path = launcher_path
296297
self._moving_average_decay_rate = moving_average_decay_rate
297-
self._compilation_timeout = _COMPILATION_TIMEOUT.value
298+
# Avoid reading the flag during the first interpretation of this module.
299+
self._compilation_timeout = (
300+
compilation_timeout or _COMPILATION_TIMEOUT.value)
298301
self._cancellation_manager = WorkerCancellationManager()
299302

300303
# re-allow the cancellation manager accept work.
@@ -319,8 +322,6 @@ def collect_data(
319322
module_spec: a ModuleSpec.
320323
tf_policy_path: path to the tensorflow policy.
321324
reward_stat: reward stat of this module, None if unknown.
322-
cancellation_token: a CancellationToken through which workers may be
323-
signaled early termination
324325
325326
Returns:
326327
A CompilationResult. In particular:

0 commit comments

Comments
 (0)