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

Integrations for Locust Cloud #2824

Merged
merged 1 commit into from
Aug 2, 2024
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
6 changes: 5 additions & 1 deletion locust/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@
from .util.load_locustfile import load_locustfile
from .util.timespan import parse_timespan

# import external plugins if installed to allow for registering custom arguments etc
try:
# import locust_plugins if it is installed, to allow it to register custom arguments etc
import locust_plugins # pyright: ignore[reportMissingImports]
except ModuleNotFoundError:
pass
try:
import locust_cloud # pyright: ignore[reportMissingImports]
except ModuleNotFoundError:
pass

version = locust.__version__

Expand Down
4 changes: 4 additions & 0 deletions locust/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from .stats import StatsCSV, StatsCSVFileWriter, StatsErrorDict, sort_stats
from .user.inspectuser import get_ratio
from .util.cache import memoize
from .util.date import format_utc_timestamp
from .util.timespan import parse_timespan

if TYPE_CHECKING:
Expand Down Expand Up @@ -617,6 +618,8 @@ def update_template_args(self):
else None
)

start_time = format_utc_timestamp(stats.start_time)

self.template_args = {
"locustfile": self.environment.locustfile,
"state": self.environment.runner.state,
Expand All @@ -634,6 +637,7 @@ def update_template_args(self):
and not (self.userclass_picker_is_active or self.environment.shape_class.use_common_options)
),
"stats_history_enabled": options and options.stats_history_enabled,
"start_time": start_time,
"tasks": dumps({}),
"extra_options": extra_options,
"run_time": options and options.run_time,
Expand Down
1 change: 1 addition & 0 deletions locust/webui/src/redux/slice/swarm.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface ISwarmState {
runTime?: string | number;
showUserclassPicker: boolean;
spawnRate: number | null;
startTime: string;
state: string;
statsHistoryEnabled: boolean;
tasks: string;
Expand Down
1 change: 1 addition & 0 deletions locust/webui/src/test/mocks/swarmState.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const swarmStateMock = {
showUserclassPicker: false,
spawnRate: null,
state: 'ready',
startTime: '',
percentilesToChart: percentilesToChart,
statsHistoryEnabled: false,
tasks: '{}',
Expand Down
Loading