Skip to content

Instantly share code, notes, and snippets.

View snackattas's full-sized avatar

Zach Attas snackattas

View GitHub Profile
@snackattas
snackattas / tasks.py
Last active August 17, 2020 17:05
Sample invoke task to run locust test
from invoke import task
import logging
from os import environ, mkdir, path
# Default options
environ['ENV'] = environ.get('ENV', 'QA')
environ['ACCOUNT_ID'] = environ.get('ACCOUNT_ID', 'abc')
environ['RUNTIME'] = environ.get('RUNTIME', '5m')
environ['NUM_USERS'] = environ.get('NUM_USERS', '200')
environ['HATCH_RATE'] = environ.get('HATCH_RATE', '5')
@snackattas
snackattas / locust.py
Created August 17, 2020 17:07
Sample locust taskset showing off Setup happening outside locust hooks
class Setup(object):
ACCOUNT_ID = None
USER_SESSION = None
LOCATION_IDS = None
REVIEW_IDS = None
def __init__(self):
self.ACCOUNT_ID = environ.get('ACCOUNT_ID')
self.USER_SESSION = self.create_user_session()
self.LOCATION_IDS = self.get_location_ids_from_db()