36
36
JSON ,
37
37
)
38
38
39
- # This script simluates a user triggering Azul endpoints via the data browser GUI.
39
+ # This script simluates a user triggering Azul endpoints via the data browser
40
+ # GUI.
40
41
# To run:
41
42
# - `locust -f scripts/locust/service.py`
42
43
# - in browser go to localhost:8089
@@ -65,7 +66,10 @@ def parallel_requests():
65
66
group .join ()
66
67
67
68
68
- def browse_page (client : HttpSession , index_name : str , filters : JSON , ** extra_index_params ):
69
+ def browse_page (client : HttpSession ,
70
+ index_name : str ,
71
+ filters : JSON ,
72
+ ** extra_index_params ):
69
73
filters = json .dumps (filters )
70
74
with parallel_requests () as group :
71
75
group .spawn (lambda : client .get (endpoint ('/repository/summary' ,
@@ -94,7 +98,10 @@ def projects_start_page(self):
94
98
95
99
@task
96
100
def filter_mtx_files (self ):
97
- browse_page (self .client , 'projects' , {"fileFormat" : {"is" : ["mtx" ]}}, ** browser_search_params )
101
+ browse_page (self .client ,
102
+ 'projects' ,
103
+ {"fileFormat" : {"is" : ["mtx" ]}},
104
+ ** browser_search_params )
98
105
99
106
100
107
class ManifestTaskSet (SequentialTaskSet ):
@@ -104,7 +111,11 @@ class ManifestTaskSet(SequentialTaskSet):
104
111
105
112
# Select islet of Langerhans since it's present in the develop deployment.
106
113
organ_part_filter = {"organPart" : {"is" : ["islet of Langerhans" ]}}
107
- manifest_file_format_filter = {"fileFormat" : {"is" : ["fastq.gz" , "bai" , "bam" , "csv" , "results" , "txt" ]}}
114
+ manifest_file_format_filter = {
115
+ "fileFormat" : {
116
+ "is" : ["fastq.gz" , "bai" , "bam" , "csv" , "results" , "txt" ]
117
+ }
118
+ }
108
119
109
120
@task
110
121
def start_page (self ):
@@ -119,7 +130,8 @@ def filter_organ_part(self):
119
130
120
131
@task
121
132
def download_manifest (self ):
122
- self .client .get (endpoint ('/repository/summary' , filters = json .dumps (self .organ_part_filter )),
133
+ self .client .get (endpoint ('/repository/summary' ,
134
+ filters = json .dumps (self .organ_part_filter )),
123
135
name = '/repository/summary' )
124
136
export_url = endpoint ('/manifest/files' ,
125
137
filters = json .dumps ({** self .organ_part_filter ,
@@ -129,7 +141,8 @@ def download_manifest(self):
129
141
name = '/manifest/files' ,
130
142
catch_response = True ,
131
143
allow_redirects = False ) as response :
132
- # This is necessary because non 2xx response are counted as failures unless specified like this
144
+ # This is necessary because non 2xx response are counted as failures
145
+ # unless specified like this
133
146
if response .status_code == 301 or 200 <= response .status_code < 300 :
134
147
response .success ()
135
148
while response .status_code == 301 :
@@ -201,7 +214,7 @@ def dos(self):
201
214
202
215
203
216
class ServiceLocust (HttpUser ):
204
- host = 'https://service.integration.explore.data.humancellatlas.org'
217
+ host = config . service_endpoint ()
205
218
tasks = {
206
219
MatrixTaskSet : 1 ,
207
220
GA4GHTaskSet : 1 ,
0 commit comments