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 optional --endpoints argument to rasa train #11102

Merged
merged 4 commits into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions changelog/11102.improvement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add `--endpoints` command line parameter to `rasa train` parser.
indam23 marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 4 additions & 0 deletions rasa/cli/arguments/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
add_nlu_data_param,
add_out_param,
add_domain_param,
add_endpoint_param,
)
from rasa.graph_components.providers.training_tracker_provider import (
TrainingTrackerProvider,
Expand All @@ -33,6 +34,9 @@ def set_train_arguments(parser: argparse.ArgumentParser) -> None:
add_persist_nlu_data_param(parser)
add_force_param(parser)
add_finetune_params(parser)
add_endpoint_param(
parser, help_text="Configuration file for the connectors as a yml file."
)


def set_train_core_arguments(parser: argparse.ArgumentParser) -> None:
Expand Down
19 changes: 16 additions & 3 deletions tests/cli/test_rasa_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from _pytest.capture import CaptureFixture
import pytest
from typing import Callable
from typing import Callable, List
from _pytest.pytester import RunResult
from _pytest.tmpdir import TempPathFactory

Expand All @@ -31,7 +31,19 @@
import rasa.utils.io


def test_train(run_in_simple_project: Callable[..., RunResult], tmp_path: Path):
@pytest.mark.parametrize(
"optional_arguments",
[
["--endpoints", "endpoints.yml"],
["--endpoints", "non_existent_endpoints.yml"],
indam23 marked this conversation as resolved.
Show resolved Hide resolved
[],
],
)
def test_train(
run_in_simple_project: Callable[..., RunResult],
tmp_path: Path,
optional_arguments: List,
):
temp_dir = os.getcwd()

run_in_simple_project(
Expand All @@ -46,6 +58,7 @@ def test_train(run_in_simple_project: Callable[..., RunResult], tmp_path: Path):
"train_models",
"--fixed-model-name",
"test-model",
*optional_arguments,
)

models_dir = Path(temp_dir, "train_models")
Expand Down Expand Up @@ -422,7 +435,7 @@ def test_train_help(run: Callable[..., RunResult]):
[--num-threads NUM_THREADS]
[--fixed-model-name FIXED_MODEL_NAME] [--persist-nlu-data]
[--force] [--finetune [FINETUNE]]
[--epoch-fraction EPOCH_FRACTION]
[--epoch-fraction EPOCH_FRACTION] [--endpoints ENDPOINTS]
{core,nlu} ..."""

lines = help_text.split("\n")
Expand Down