Skip to content

Commit 7d176ff

Browse files
committed
add: set default interval and warm up steps for checking
1 parent cdca52e commit 7d176ff

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

traincheck/collect_trace.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ def main():
390390
parser.add_argument(
391391
"--warm-up-steps",
392392
type=int,
393-
default=0,
393+
default=None,
394394
help="Number of initial steps to always instrument.",
395395
)
396396

@@ -413,6 +413,13 @@ def main():
413413
value = os.path.join(path_prefix, value)
414414
setattr(args, key, value)
415415

416+
# Set conditional defaults based on invariants presence
417+
if args.invariants:
418+
if args.sampling_interval is None:
419+
args.sampling_interval = config.DEFAULT_CHECKING_POLICY["interval"]
420+
if args.warm_up_steps is None:
421+
args.warm_up_steps = config.DEFAULT_CHECKING_POLICY["warm_up"]
422+
416423
# set up logging
417424
if args.debug_mode:
418425
logging.basicConfig(level=logging.DEBUG)

traincheck/config/config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@
100100
"warm_up": 1, # default to 1 to ensure the first step is always instrumented: before warm-up is depleted, we do instrumentation with interval=1, after warm-up is depleted, we do instrumentation with the specified interval
101101
}
102102

103+
DEFAULT_CHECKING_POLICY = {
104+
"interval": 10,
105+
"warm_up": 10,
106+
}
107+
103108
DISABLE_WRAPPER = False
104109

105110

0 commit comments

Comments
 (0)