Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F29967356
raw.txt
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
MSantos
Aug 5 2019, 8:05 PM
2019-08-05 20:05:24 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
raw.txt
View Options
from locust import HttpLocust, TaskSet, task
import random
def random_year():
return random.randrange(2016,2019)
def random_month():
month = random.randrange(1,13)
if month < 10:
return "0%d" % (month)
else:
return "%d" % (month)
def random_day():
day = random.randrange(1, 29)
if day < 10:
return "0%d" % (day)
else:
return "%d" % (day)
class UserBehavior(TaskSet):
def on_start(self):
""" on_start is called when a Locust start before any task is scheduled """
def on_stop(self):
""" on_stop is called when the TaskSet is stopping """
@task(1)
def announcements(self):
self.client.get("/en.wikipedia.org/v1/feed/announcements")
@task(0)
def availability(self):
self.client.get("/en.wikipedia.org/v1/feed/availability")
@task(1)
def news(self):
self.client.get("/en.wikipedia.org/v1/page/news")
@task(23)
def random(self):
self.client.get("/en.wikipedia.org/v1/page/random/title")
@task(8)
def onthisday(self):
self.client.get("/en.wikipedia.org/v1/feed/onthisday/selected/%s/%s" % (random_month(), random_day()))
@task(3)
def featured(self):
self.client.get("/en.wikipedia.org/v1/page/featured/%d/%s/%s" % (random_year(), random_month(), random_day()))
@task(3)
def image_featured(self):
self.client.get("/en.wikipedia.org/v1/media/image/featured/%d/%s/%s" % (random_year(), random_month(), random_day()))
@task(3)
def most_read(self):
self.client.get("/en.wikipedia.org/v1/page/most-read/%d/%s/%s" % (random_year(), random_month(), random_day()))
class WebsiteUser(HttpLocust):
task_set = UserBehavior
min_wait = 10000
max_wait = 60000
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
7825538
Default Alt Text
raw.txt (1 KB)
Attached To
Mode
P8863 locust script for wikifeeds profiling
Attached
Detach File
Event Timeline
Log In to Comment