Skip to content

Commit

Permalink
dont crash if locust-plugins isnt installed
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberw committed Jan 19, 2024
1 parent d5688f1 commit 60b5927
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions locust_swarm/swarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from datetime import datetime, timezone
import psutil
import configargparse
import locust_plugins
import locust.util.timespan
from locust_swarm._version import version

Expand Down Expand Up @@ -251,11 +250,16 @@ def cleanup(server_list):
def upload(server):
files = [args.locustfile or "locustfile.py"] + args.extra_files
if not args.skip_plugins:
files.append(os.path.dirname(locust_plugins.__file__))
try:
files.append(os.path.dirname(svs_locust.__file__))
except NameError:
pass
import locust_plugins

files.append(os.path.dirname(locust_plugins.__file__))
try:
files.append(os.path.dirname(svs_locust.__file__))
except NameError:
pass
except ImportError:
pass # locust-plugins wasnt installed
if len(files) > 1:
filestr = "{" + ",".join(files) + "}"
else:
Expand Down

0 comments on commit 60b5927

Please sign in to comment.