Skip to content

Commit

Permalink
Ruff format.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberw committed Feb 19, 2024
1 parent 8daa48e commit 7829487
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 36 deletions.
52 changes: 25 additions & 27 deletions locust_swarm/swarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
Example: swarm -f test.py --loadgen-list loadgen1.domain.com,loadgen2.domain.com --users 50""",
epilog="""Any parameters not listed here are forwarded to locust master unmodified, so go ahead and use things like --users, --host, --run-time, ...
Swarm config can also be set using config file (~/.locust.conf, locust.conf, ~/.swarm.conf or swarm.conf).
Parameters specified on command line override env vars, which in turn override config files.""",
add_config_file_help=False,
Expand Down Expand Up @@ -318,7 +318,7 @@ def start_worker_process(server, port):
"-R",
f"{port}:localhost:{port}",
"-R",
f"{port+1}:localhost:{port+1}",
f"{port + 1}:localhost:{port + 1}",
]
ensure_remote_kill = ["& read; kill -9 $!"]
nohup = []
Expand All @@ -336,31 +336,29 @@ def start_worker_process(server, port):
if args.test_env:
extra_env.append("LOCUST_TEST_ENV=" + args.test_env)

cmd = " ".join(
[
"ssh",
"-q",
*port_forwarding_parameters,
server,
"'",
*extra_env,
*nohup,
"locust",
"--worker",
"--processes",
str(args.processes),
"--master-port",
str(port),
*master_parameters,
"--headless",
"--expect-workers-max-wait",
"30",
"-f",
"-",
*ensure_remote_kill,
"'",
]
)
cmd = " ".join([
"ssh",
"-q",
*port_forwarding_parameters,
server,
"'",
*extra_env,
*nohup,
"locust",
"--worker",
"--processes",
str(args.processes),
"--master-port",
str(port),
*master_parameters,
"--headless",
"--expect-workers-max-wait",
"30",
"-f",
"-",
*ensure_remote_kill,
"'",
])

logging.info("workers started " + cmd)
procs.append(
Expand Down
9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
[tool.ruff]
line-length = 120
select = ["E", "F", "W", "UP", "FA102", "I001"]
extend-select = [
lint.select = ["E", "F", "W", "UP", "FA102", "I"]
lint.extend-select = [
"D419", # empty-docstring
# "E501", # line-too-long
"W291", # trailing-whitespace
"PLC0414", # useless-import-alias
"PLC2401", # non-ascii-name
Expand All @@ -20,13 +19,13 @@ extend-select = [
"PLE0605", # invalid-all-format
"PLE0704", # misplaced-bare-raise
]

ignore = [
lint.ignore = [
"PLR0912", # too-many-branches
"PLR0913", # too-many-arguments
"PLR0914", # too-many-locals
"PLR0915", # too-many-statements
"PLW0603", # global-statement
"E501", # line-too-long
]

[tool.mypy]
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys

from setuptools import find_packages, setup
from setuptools.command.install import install
from setuptools.command.egg_info import egg_info
from setuptools.command.develop import develop
from setuptools.command.egg_info import egg_info
from setuptools.command.install import install


def install_check(self, command):
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ envlist = py{38,39,310,311,312}

[testenv]
deps =
ruff
ruff==0.2.2
mypy==1.8.0
commands =
ruff check --preview
Expand Down

0 comments on commit 7829487

Please sign in to comment.