Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a --manual_seed flag to the CLI #1445

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add a --manual_seed flag to the Morpheus CLI allowing the manual seed…
… to be set prior to executing a pipeline
  • Loading branch information
dagardner-nv committed Dec 19, 2023
commit 67d68b2d0165bb1f28457d8b5138fc1d79daa7ac
11 changes: 10 additions & 1 deletion morpheus/cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,22 @@ def install(**kwargs):
type=bool,
help=("Whether or not to use C++ node and message types or to prefer python. "
"Only use as a last resort if bugs are encountered"))
@click.option('--manual_seed',
default=None,
type=click.IntRange(min=1),
envvar="MORPHEUS_MANUAL_SEED",
help=("Manually seed the random number generators used by Morpheus, useful for testing."))
@prepare_command(parse_config=True)
def run(ctx: click.Context, **kwargs):
"""Run subcommand, used for running a pipeline"""
# Since the option isnt the same name as `should_use_cpp` anymore, manually set the value here.
CppConfig.set_should_use_cpp(kwargs.pop("use_cpp", CppConfig.get_should_use_cpp()))

pass
manual_seed_val = kwargs.pop("manual_seed", None)
if manual_seed_val is not None:
from morpheus.utils.seed import manual_seed
logger.debug("Manually seeding random number generators to %d", manual_seed_val)
manual_seed(manual_seed_val)


@click.group(chain=True,
Expand Down