django-to-galaxy 0.6.9.8__py3-none-any.whl → 0.6.9.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of django-to-galaxy might be problematic. Click here for more details.
- django_to_galaxy/admin/__init__.py +7 -1
- django_to_galaxy/admin/galaxy_user.py +21 -35
- django_to_galaxy/admin/utils.py +112 -0
- django_to_galaxy/admin/workflow.py +57 -2
- django_to_galaxy/api/serializers/create_dataset_collection.py +118 -0
- django_to_galaxy/api/serializers/create_history.py +6 -0
- django_to_galaxy/api/serializers/invocation.py +5 -0
- django_to_galaxy/api/serializers/invoke_workflow.py +4 -0
- django_to_galaxy/api/serializers/workflow.py +6 -0
- django_to_galaxy/api/urls.py +15 -0
- django_to_galaxy/api/views/create_dataset_collection.py +461 -0
- django_to_galaxy/api/views/create_history.py +3 -0
- django_to_galaxy/api/views/invocation.py +6 -1
- django_to_galaxy/api/views/invoke_workflow.py +23 -21
- django_to_galaxy/migrations/0012_workflowinput_collection_type_and_more.py +136 -0
- django_to_galaxy/models/__init__.py +1 -1
- django_to_galaxy/models/accepted_input.py +113 -2
- django_to_galaxy/models/galaxy_instance.py +1 -1
- django_to_galaxy/models/workflow.py +360 -1
- django_to_galaxy/version.py +1 -1
- {django_to_galaxy-0.6.9.8.dist-info → django_to_galaxy-0.6.9.9.dist-info}/METADATA +4 -3
- {django_to_galaxy-0.6.9.8.dist-info → django_to_galaxy-0.6.9.9.dist-info}/RECORD +24 -19
- {django_to_galaxy-0.6.9.8.dist-info → django_to_galaxy-0.6.9.9.dist-info}/WHEEL +1 -1
- {django_to_galaxy-0.6.9.8.dist-info → django_to_galaxy-0.6.9.9.dist-info/licenses}/LICENSE +0 -0
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
from django.core.exceptions import ObjectDoesNotExist
|
|
2
|
+
from drf_yasg.utils import swagger_auto_schema
|
|
3
|
+
from drf_yasg import openapi
|
|
4
|
+
from rest_framework.response import Response
|
|
5
|
+
|
|
6
|
+
from rest_framework.generics import GenericAPIView
|
|
7
|
+
from rest_framework.status import HTTP_404_NOT_FOUND
|
|
8
|
+
|
|
9
|
+
from django_to_galaxy.models import History
|
|
10
|
+
from django_to_galaxy.api.serializers.create_dataset_collection import (
|
|
11
|
+
CollectionListSerializer,
|
|
12
|
+
CollectionListPairedSerializer,
|
|
13
|
+
CollectionPairedSerializer,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
from bioblend import ConnectionError
|
|
17
|
+
|
|
18
|
+
example_payload_list = {
|
|
19
|
+
"200": openapi.Response(
|
|
20
|
+
description="Dataset collection created successfully.",
|
|
21
|
+
examples={
|
|
22
|
+
"application/json": {
|
|
23
|
+
"summary": "Example payload",
|
|
24
|
+
"description": "An example of a payload to create a dataset collection.",
|
|
25
|
+
"value": {
|
|
26
|
+
"history_id": 1,
|
|
27
|
+
"collection_name": "My Dataset Collection",
|
|
28
|
+
"elements_names": ["dataset1", "dataset2"],
|
|
29
|
+
"elements_ids": ["f4b5e6d8a9c0b1e2", "a1b2c3d4e5f60708"],
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
example_payload_list_paired = {
|
|
37
|
+
"200": openapi.Response(
|
|
38
|
+
description="Dataset collection created successfully.",
|
|
39
|
+
examples={
|
|
40
|
+
"application/json": {
|
|
41
|
+
"summary": "Example payload",
|
|
42
|
+
"description": "An example of a payload to create a paired dataset collection.",
|
|
43
|
+
"value": {
|
|
44
|
+
"history_id": 1,
|
|
45
|
+
"collection_name": "My Paired Collection",
|
|
46
|
+
"pairs_names": ["pair1", "pair2"],
|
|
47
|
+
"first_elements_ids": ["id1", "id2"],
|
|
48
|
+
"second_elements_ids": ["id3", "id4"],
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
example_payload_paired = {
|
|
56
|
+
"200": openapi.Response(
|
|
57
|
+
description="Dataset collection created successfully.",
|
|
58
|
+
examples={
|
|
59
|
+
"application/json": {
|
|
60
|
+
"summary": "Example payload",
|
|
61
|
+
"description": "An example of a payload to create a paired dataset collection.",
|
|
62
|
+
"value": {
|
|
63
|
+
"history_id": 1,
|
|
64
|
+
"collection_name": "My Paired Collection",
|
|
65
|
+
"first_element_id": "id1",
|
|
66
|
+
"second_element_id": "id2",
|
|
67
|
+
},
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class CreateDatasetListCollectionView(GenericAPIView):
|
|
75
|
+
"""
|
|
76
|
+
API endpoint to create a dataset collection (list) in a Galaxy history.
|
|
77
|
+
|
|
78
|
+
- POST: Creates a dataset collection in a specified Galaxy history.
|
|
79
|
+
- Serializer: CollectionListSerializer
|
|
80
|
+
- Returns: JSON response with collection details or connection errors.
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
serializer_class = CollectionListSerializer
|
|
84
|
+
|
|
85
|
+
@swagger_auto_schema(
|
|
86
|
+
operation_description="Create a dataset collection with dataset of an Galaxy history.",
|
|
87
|
+
operation_summary="Create a dataset collection with dataset of an Galaxy history.",
|
|
88
|
+
tags=["collections"],
|
|
89
|
+
responses=example_payload_list,
|
|
90
|
+
request_body=openapi.Schema(
|
|
91
|
+
type=openapi.TYPE_OBJECT,
|
|
92
|
+
properties={
|
|
93
|
+
"history_id": openapi.Schema(type=openapi.TYPE_INTEGER, example=1),
|
|
94
|
+
"collection_name": openapi.Schema(
|
|
95
|
+
type=openapi.TYPE_STRING, example="My Dataset Collection"
|
|
96
|
+
),
|
|
97
|
+
"elements_names": openapi.Schema(
|
|
98
|
+
type=openapi.TYPE_ARRAY,
|
|
99
|
+
items=openapi.Items(type=openapi.TYPE_STRING),
|
|
100
|
+
example=["dataset1", "dataset2"],
|
|
101
|
+
),
|
|
102
|
+
"elements_ids": openapi.Schema(
|
|
103
|
+
type=openapi.TYPE_ARRAY,
|
|
104
|
+
items=openapi.Items(type=openapi.TYPE_STRING),
|
|
105
|
+
example=["f4b5e6d8a9c0b1e2", "a1b2c3d4e5f60708"],
|
|
106
|
+
),
|
|
107
|
+
},
|
|
108
|
+
required=[
|
|
109
|
+
"history_id",
|
|
110
|
+
"collection_name",
|
|
111
|
+
"elements_names",
|
|
112
|
+
"elements_ids",
|
|
113
|
+
],
|
|
114
|
+
),
|
|
115
|
+
)
|
|
116
|
+
def post(self, request):
|
|
117
|
+
serializer_class = self.get_serializer_class()
|
|
118
|
+
serializer = serializer_class(data=request.data, context={"request": request})
|
|
119
|
+
serializer.is_valid(raise_exception=True)
|
|
120
|
+
data = serializer.data
|
|
121
|
+
# Retrieve history
|
|
122
|
+
try:
|
|
123
|
+
history = History.objects.get(id=data["history_id"])
|
|
124
|
+
except ObjectDoesNotExist:
|
|
125
|
+
return Response(
|
|
126
|
+
{
|
|
127
|
+
"message": (
|
|
128
|
+
"Galaxy history with id ",
|
|
129
|
+
f"<{data['history_id']}> not found!",
|
|
130
|
+
)
|
|
131
|
+
},
|
|
132
|
+
status=HTTP_404_NOT_FOUND,
|
|
133
|
+
)
|
|
134
|
+
# Collect ConnectionError exceptions
|
|
135
|
+
connection_errors = []
|
|
136
|
+
datasets = []
|
|
137
|
+
# Check each dataset id
|
|
138
|
+
for i in range(len(data.get("elements_names", []))):
|
|
139
|
+
try:
|
|
140
|
+
dataset = history.galaxy_owner.obj_gi.gi.datasets.show_dataset(
|
|
141
|
+
data["elements_ids"][i]
|
|
142
|
+
)
|
|
143
|
+
datasets.append(dataset)
|
|
144
|
+
except ConnectionError as e:
|
|
145
|
+
connection_errors.append(
|
|
146
|
+
{
|
|
147
|
+
"index": i,
|
|
148
|
+
"type": "elements_ids",
|
|
149
|
+
"id": data["elements_ids"][i],
|
|
150
|
+
"error": str(e),
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
datasets.append(None)
|
|
154
|
+
|
|
155
|
+
# If any errors, return them as final response
|
|
156
|
+
if connection_errors:
|
|
157
|
+
return Response({"connection_errors": connection_errors}, status=400)
|
|
158
|
+
|
|
159
|
+
# Retrieve file & file path
|
|
160
|
+
collection_datamap = {
|
|
161
|
+
"name": data["collection_name"],
|
|
162
|
+
"collection_type": "list",
|
|
163
|
+
"element_identifiers": [],
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
for i in range(len(data.get("elements_names", []))):
|
|
167
|
+
if datasets[i] is not None:
|
|
168
|
+
collection_datamap["element_identifiers"].append(
|
|
169
|
+
{
|
|
170
|
+
"name": data["elements_names"][i],
|
|
171
|
+
"src": "hda",
|
|
172
|
+
"id": data["elements_ids"][i],
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
try:
|
|
176
|
+
history_association = history.galaxy_history.create_dataset_collection(
|
|
177
|
+
collection_description=collection_datamap
|
|
178
|
+
)
|
|
179
|
+
except ConnectionError as e:
|
|
180
|
+
connection_errors.append(
|
|
181
|
+
{"type": "create_dataset_collection", "error": str(e)}
|
|
182
|
+
)
|
|
183
|
+
return Response({"connection_errors": connection_errors}, status=400)
|
|
184
|
+
|
|
185
|
+
message = (
|
|
186
|
+
"Collection of list of dataset has "
|
|
187
|
+
f"been created to Galaxy History <{str(history)}>"
|
|
188
|
+
)
|
|
189
|
+
return Response(
|
|
190
|
+
{
|
|
191
|
+
"message": message,
|
|
192
|
+
"history_association_id": history_association.id,
|
|
193
|
+
"history_id": history.id,
|
|
194
|
+
}
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
class CreateDatasetListPairedCollectionView(GenericAPIView):
|
|
199
|
+
"""
|
|
200
|
+
API endpoint to create a paired dataset collection (list:paired) in a Galaxy history.
|
|
201
|
+
|
|
202
|
+
- POST: Creates a paired dataset collection in a specified Galaxy history.
|
|
203
|
+
- Serializer: CollectionListPairedSerializer
|
|
204
|
+
- Returns: JSON response with collection details or connection errors.
|
|
205
|
+
"""
|
|
206
|
+
|
|
207
|
+
serializer_class = CollectionListPairedSerializer
|
|
208
|
+
|
|
209
|
+
@swagger_auto_schema(
|
|
210
|
+
operation_description=(
|
|
211
|
+
"Create a paired dataset collection " "(list:paired) in a Galaxy history."
|
|
212
|
+
),
|
|
213
|
+
operation_summary="Create a paired dataset collection (list:paired) in a Galaxy history.",
|
|
214
|
+
tags=["collections"],
|
|
215
|
+
responses=example_payload_list_paired,
|
|
216
|
+
request_body=openapi.Schema(
|
|
217
|
+
type=openapi.TYPE_OBJECT,
|
|
218
|
+
properties={
|
|
219
|
+
"history_id": openapi.Schema(type=openapi.TYPE_INTEGER, example=1),
|
|
220
|
+
"collection_name": openapi.Schema(
|
|
221
|
+
type=openapi.TYPE_STRING, example="My Paired Collection"
|
|
222
|
+
),
|
|
223
|
+
"pairs_names": openapi.Schema(
|
|
224
|
+
type=openapi.TYPE_ARRAY,
|
|
225
|
+
items=openapi.Items(type=openapi.TYPE_STRING),
|
|
226
|
+
example=["pair1", "pair2"],
|
|
227
|
+
),
|
|
228
|
+
"first_elements_ids": openapi.Schema(
|
|
229
|
+
type=openapi.TYPE_ARRAY,
|
|
230
|
+
items=openapi.Items(type=openapi.TYPE_STRING),
|
|
231
|
+
example=["id1", "id2"],
|
|
232
|
+
),
|
|
233
|
+
"second_elements_ids": openapi.Schema(
|
|
234
|
+
type=openapi.TYPE_ARRAY,
|
|
235
|
+
items=openapi.Items(type=openapi.TYPE_STRING),
|
|
236
|
+
example=["id3", "id4"],
|
|
237
|
+
),
|
|
238
|
+
},
|
|
239
|
+
required=[
|
|
240
|
+
"history_id",
|
|
241
|
+
"collection_name",
|
|
242
|
+
"pairs_names",
|
|
243
|
+
"first_elements_ids",
|
|
244
|
+
"second_elements_ids",
|
|
245
|
+
],
|
|
246
|
+
),
|
|
247
|
+
)
|
|
248
|
+
def post(self, request):
|
|
249
|
+
serializer_class = self.get_serializer_class()
|
|
250
|
+
serializer = serializer_class(data=request.data, context={"request": request})
|
|
251
|
+
serializer.is_valid(raise_exception=True)
|
|
252
|
+
data = serializer.data
|
|
253
|
+
# Retrieve history
|
|
254
|
+
try:
|
|
255
|
+
history = History.objects.get(id=data["history_id"])
|
|
256
|
+
except ObjectDoesNotExist:
|
|
257
|
+
return Response(
|
|
258
|
+
{
|
|
259
|
+
"message": (
|
|
260
|
+
"Galaxy history with id ",
|
|
261
|
+
f"<{data['history_id']}> not found!",
|
|
262
|
+
)
|
|
263
|
+
},
|
|
264
|
+
status=HTTP_404_NOT_FOUND,
|
|
265
|
+
)
|
|
266
|
+
# Collect ConnectionError exceptions
|
|
267
|
+
connection_errors = []
|
|
268
|
+
first_datasets = []
|
|
269
|
+
second_datasets = []
|
|
270
|
+
# Check each dataset id
|
|
271
|
+
for i in range(len(data.get("pairs_names", []))):
|
|
272
|
+
try:
|
|
273
|
+
first_dataset = history.galaxy_owner.obj_gi.gi.datasets.show_dataset(
|
|
274
|
+
data["first_elements_ids"][i]
|
|
275
|
+
)
|
|
276
|
+
first_datasets.append(first_dataset)
|
|
277
|
+
except ConnectionError as e:
|
|
278
|
+
connection_errors.append(
|
|
279
|
+
{
|
|
280
|
+
"index": i,
|
|
281
|
+
"type": "first_elements_ids",
|
|
282
|
+
"id": data["first_elements_ids"][i],
|
|
283
|
+
"error": str(e),
|
|
284
|
+
}
|
|
285
|
+
)
|
|
286
|
+
first_datasets.append(None)
|
|
287
|
+
try:
|
|
288
|
+
second_dataset = history.galaxy_owner.obj_gi.gi.datasets.show_dataset(
|
|
289
|
+
data["second_elements_ids"][i]
|
|
290
|
+
)
|
|
291
|
+
second_datasets.append(second_dataset)
|
|
292
|
+
except ConnectionError as e:
|
|
293
|
+
connection_errors.append(
|
|
294
|
+
{
|
|
295
|
+
"index": i,
|
|
296
|
+
"type": "second_elements_ids",
|
|
297
|
+
"id": data["second_elements_ids"][i],
|
|
298
|
+
"error": str(e),
|
|
299
|
+
}
|
|
300
|
+
)
|
|
301
|
+
second_datasets.append(None)
|
|
302
|
+
|
|
303
|
+
# If any errors, return them as final response
|
|
304
|
+
if connection_errors:
|
|
305
|
+
return Response({"connection_errors": connection_errors}, status=400)
|
|
306
|
+
|
|
307
|
+
# Retrieve file & file path
|
|
308
|
+
collection_datamap = {
|
|
309
|
+
"name": data["collection_name"],
|
|
310
|
+
"collection_type": "list:paired",
|
|
311
|
+
"element_identifiers": [],
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
for i in range(len(data.get("pairs_names", []))):
|
|
315
|
+
if first_datasets[i] is not None and second_datasets[i] is not None:
|
|
316
|
+
collection_datamap["element_identifiers"].append(
|
|
317
|
+
{
|
|
318
|
+
"name": data["pairs_names"][i],
|
|
319
|
+
"src": "new_collection",
|
|
320
|
+
"collection_type": "paired",
|
|
321
|
+
"element_identifiers": [
|
|
322
|
+
{
|
|
323
|
+
"name": "forward",
|
|
324
|
+
"src": "hda",
|
|
325
|
+
"id": data["first_elements_ids"][i],
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"name": "reverse",
|
|
329
|
+
"src": "hda",
|
|
330
|
+
"id": data["second_elements_ids"][i],
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
}
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
try:
|
|
337
|
+
history_association = history.galaxy_history.create_dataset_collection(
|
|
338
|
+
collection_description=collection_datamap
|
|
339
|
+
)
|
|
340
|
+
except ConnectionError as e:
|
|
341
|
+
connection_errors.append(
|
|
342
|
+
{"type": "create_dataset_collection", "error": str(e)}
|
|
343
|
+
)
|
|
344
|
+
return Response({"connection_errors": connection_errors}, status=400)
|
|
345
|
+
|
|
346
|
+
message = (
|
|
347
|
+
"Collection of paired dataset has been "
|
|
348
|
+
f"created to Galaxy History <{str(history)}>"
|
|
349
|
+
)
|
|
350
|
+
return Response(
|
|
351
|
+
{
|
|
352
|
+
"message": message,
|
|
353
|
+
"history_association_id": history_association.id,
|
|
354
|
+
"history_id": history.id,
|
|
355
|
+
}
|
|
356
|
+
)
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
class CreateDatasetPairedCollectionView(GenericAPIView):
|
|
360
|
+
"""
|
|
361
|
+
API endpoint to create a paired dataset collection in a Galaxy history.
|
|
362
|
+
|
|
363
|
+
- POST: Creates a paired dataset collection in a specified Galaxy history.
|
|
364
|
+
- Serializer: CollectionPairedSerializer
|
|
365
|
+
- Returns: JSON response with collection details or connection errors.
|
|
366
|
+
"""
|
|
367
|
+
|
|
368
|
+
serializer_class = CollectionPairedSerializer
|
|
369
|
+
|
|
370
|
+
@swagger_auto_schema(
|
|
371
|
+
operation_description="Create a paired dataset collection in a Galaxy history.",
|
|
372
|
+
operation_summary="Create a paired dataset collection in a Galaxy history.",
|
|
373
|
+
tags=["collections"],
|
|
374
|
+
responses=example_payload_paired,
|
|
375
|
+
request_body=openapi.Schema(
|
|
376
|
+
type=openapi.TYPE_OBJECT,
|
|
377
|
+
properties={
|
|
378
|
+
"history_id": openapi.Schema(type=openapi.TYPE_INTEGER, example=1),
|
|
379
|
+
"collection_name": openapi.Schema(
|
|
380
|
+
type=openapi.TYPE_STRING, example="My Paired Collection"
|
|
381
|
+
),
|
|
382
|
+
"first_element_id": openapi.Schema(
|
|
383
|
+
type=openapi.TYPE_STRING, example="id1"
|
|
384
|
+
),
|
|
385
|
+
"second_element_id": openapi.Schema(
|
|
386
|
+
type=openapi.TYPE_STRING, example="id2"
|
|
387
|
+
),
|
|
388
|
+
},
|
|
389
|
+
required=[
|
|
390
|
+
"history_id",
|
|
391
|
+
"collection_name",
|
|
392
|
+
"first_element_id",
|
|
393
|
+
"second_element_id",
|
|
394
|
+
],
|
|
395
|
+
),
|
|
396
|
+
)
|
|
397
|
+
def post(self, request):
|
|
398
|
+
serializer_class = self.get_serializer_class()
|
|
399
|
+
serializer = serializer_class(data=request.data, context={"request": request})
|
|
400
|
+
serializer.is_valid(raise_exception=True)
|
|
401
|
+
data = serializer.data
|
|
402
|
+
# Retrieve history
|
|
403
|
+
try:
|
|
404
|
+
history = History.objects.get(id=data["history_id"])
|
|
405
|
+
except ObjectDoesNotExist:
|
|
406
|
+
return Response(
|
|
407
|
+
{
|
|
408
|
+
"message": (
|
|
409
|
+
"Galaxy history with id ",
|
|
410
|
+
f"<{data['history_id']}> not found!",
|
|
411
|
+
)
|
|
412
|
+
},
|
|
413
|
+
status=HTTP_404_NOT_FOUND,
|
|
414
|
+
)
|
|
415
|
+
|
|
416
|
+
# Check each dataset id
|
|
417
|
+
try:
|
|
418
|
+
history.galaxy_owner.obj_gi.gi.datasets.show_dataset(
|
|
419
|
+
data["first_element_id"]
|
|
420
|
+
)
|
|
421
|
+
except ConnectionError:
|
|
422
|
+
return Response({"message": "first_element_id is not valid"}, status=400)
|
|
423
|
+
|
|
424
|
+
try:
|
|
425
|
+
history.galaxy_owner.obj_gi.gi.datasets.show_dataset(
|
|
426
|
+
data["second_element_id"]
|
|
427
|
+
)
|
|
428
|
+
except ConnectionError:
|
|
429
|
+
return Response({"message": "second_element_id is not valid"}, status=400)
|
|
430
|
+
|
|
431
|
+
# Retrieve file & file path
|
|
432
|
+
collection_datamap = {
|
|
433
|
+
"name": data["collection_name"],
|
|
434
|
+
"collection_type": "paired",
|
|
435
|
+
"element_identifiers": [
|
|
436
|
+
{"name": "forward", "src": "hda", "id": data["first_element_id"]},
|
|
437
|
+
{"name": "reverse", "src": "hda", "id": data["second_element_id"]},
|
|
438
|
+
],
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
try:
|
|
442
|
+
history_association = history.galaxy_history.create_dataset_collection(
|
|
443
|
+
collection_description=collection_datamap
|
|
444
|
+
)
|
|
445
|
+
except ConnectionError as e:
|
|
446
|
+
return Response(
|
|
447
|
+
{"message": str(e)},
|
|
448
|
+
status=400,
|
|
449
|
+
)
|
|
450
|
+
message = (
|
|
451
|
+
"Collection of paired dataset has been "
|
|
452
|
+
f"created to Galaxy History <{str(history)}>"
|
|
453
|
+
)
|
|
454
|
+
|
|
455
|
+
return Response(
|
|
456
|
+
{
|
|
457
|
+
"message": message,
|
|
458
|
+
"history_association_id": history_association.id,
|
|
459
|
+
"history_id": history.id,
|
|
460
|
+
}
|
|
461
|
+
)
|
|
@@ -3,15 +3,18 @@ from rest_framework.response import Response
|
|
|
3
3
|
from rest_framework.generics import RetrieveAPIView
|
|
4
4
|
|
|
5
5
|
from django_to_galaxy.models import GalaxyUser
|
|
6
|
+
from django_to_galaxy.api.serializers.create_history import HistoryCreatedSerializer
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class CreateHistoryView(RetrieveAPIView):
|
|
9
10
|
queryset = GalaxyUser.objects.all()
|
|
11
|
+
serializer_class = None
|
|
10
12
|
|
|
11
13
|
@swagger_auto_schema(
|
|
12
14
|
operation_description="Create history from a user.",
|
|
13
15
|
operation_summary="Create history from a user.",
|
|
14
16
|
tags=["galaxy_users"],
|
|
17
|
+
responses={200: HistoryCreatedSerializer},
|
|
15
18
|
)
|
|
16
19
|
def get(self, request, *args, **kwargs):
|
|
17
20
|
instance = self.get_object()
|
|
@@ -4,7 +4,10 @@ from rest_framework.response import Response
|
|
|
4
4
|
from rest_framework.generics import RetrieveAPIView
|
|
5
5
|
|
|
6
6
|
from django_to_galaxy.models.invocation import Invocation
|
|
7
|
-
from django_to_galaxy.api.serializers.invocation import
|
|
7
|
+
from django_to_galaxy.api.serializers.invocation import (
|
|
8
|
+
InvocationSerializer,
|
|
9
|
+
UpdateOutputFilesResponseSerializer,
|
|
10
|
+
)
|
|
8
11
|
|
|
9
12
|
|
|
10
13
|
class InvocationViewSet(viewsets.ReadOnlyModelViewSet):
|
|
@@ -18,11 +21,13 @@ class InvocationViewSet(viewsets.ReadOnlyModelViewSet):
|
|
|
18
21
|
|
|
19
22
|
class UpdateOutputFilesView(RetrieveAPIView):
|
|
20
23
|
queryset = Invocation.objects.all()
|
|
24
|
+
serializer_class = UpdateOutputFilesResponseSerializer
|
|
21
25
|
|
|
22
26
|
@swagger_auto_schema(
|
|
23
27
|
operation_description="Update output files from an invocation.",
|
|
24
28
|
operation_summary="Update output files from an invocation.",
|
|
25
29
|
tags=["invocations"],
|
|
30
|
+
responses={200: UpdateOutputFilesResponseSerializer},
|
|
26
31
|
)
|
|
27
32
|
def get(self, request, *args, **kwargs):
|
|
28
33
|
instance = self.get_object()
|
|
@@ -11,6 +11,7 @@ from django_to_galaxy.models import History, Workflow, GalaxyUser
|
|
|
11
11
|
from django_to_galaxy.api.serializers.invoke_workflow import (
|
|
12
12
|
InvokeWorkflowSerializer,
|
|
13
13
|
ExecuteWorkflowSerializer,
|
|
14
|
+
GenericDictSerializer,
|
|
14
15
|
)
|
|
15
16
|
|
|
16
17
|
|
|
@@ -61,35 +62,36 @@ class InvokeWorkflowView(GenericAPIView):
|
|
|
61
62
|
|
|
62
63
|
class GetWorkflowDatamapTemplateView(RetrieveAPIView):
|
|
63
64
|
queryset = Workflow.objects.all()
|
|
65
|
+
serializer_class = GenericDictSerializer
|
|
64
66
|
|
|
65
67
|
@swagger_auto_schema(
|
|
66
68
|
operation_description="Get workflow datamap to prepare workflow invocation.",
|
|
67
69
|
operation_summary="Get workflow datamap to prepare workflow invocation.",
|
|
68
70
|
tags=["workflows"],
|
|
71
|
+
responses={200: GenericDictSerializer},
|
|
69
72
|
)
|
|
70
73
|
def get(self, request, *args, **kwargs):
|
|
71
74
|
instance = self.get_object()
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return Response(
|
|
91
|
-
|
|
92
|
-
)
|
|
75
|
+
datamap = instance.get_workflow_datamap_template()
|
|
76
|
+
|
|
77
|
+
return Response(data=datamap)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
"""
|
|
81
|
+
class GetWorkflowInputsView(RetrieveAPIView):
|
|
82
|
+
queryset = Workflow.objects.all()
|
|
83
|
+
|
|
84
|
+
@swagger_auto_schema(
|
|
85
|
+
operation_description="Get workflow inputs information from Galaxy.",
|
|
86
|
+
operation_summary="Get workflow inputs information from Galaxy.",
|
|
87
|
+
tags=["workflows"],
|
|
88
|
+
)
|
|
89
|
+
def get(self, request, *args, **kwargs):
|
|
90
|
+
instance = self.get_object()
|
|
91
|
+
data = instance.get_workflow_inputs()
|
|
92
|
+
|
|
93
|
+
return Response(data=data)
|
|
94
|
+
"""
|
|
93
95
|
|
|
94
96
|
|
|
95
97
|
class ExecuteWorkflowView(GenericAPIView):
|