django-to-galaxy 0.6.9.4__py3-none-any.whl → 0.6.9.6__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/workflow.py +10 -0
- django_to_galaxy/migrations/0010_workflow__is_meta_workflow__step_jobs_count.py +23 -0
- django_to_galaxy/models/history.py +1 -1
- django_to_galaxy/models/invocation.py +7 -11
- django_to_galaxy/models/workflow.py +46 -0
- django_to_galaxy/version.py +1 -1
- {django_to_galaxy-0.6.9.4.dist-info → django_to_galaxy-0.6.9.6.dist-info}/METADATA +2 -2
- {django_to_galaxy-0.6.9.4.dist-info → django_to_galaxy-0.6.9.6.dist-info}/RECORD +10 -9
- {django_to_galaxy-0.6.9.4.dist-info → django_to_galaxy-0.6.9.6.dist-info}/WHEEL +1 -1
- {django_to_galaxy-0.6.9.4.dist-info → django_to_galaxy-0.6.9.6.dist-info}/LICENSE +0 -0
|
@@ -13,6 +13,8 @@ class WorkflowAdmin(GalaxyElementAdmin):
|
|
|
13
13
|
"name",
|
|
14
14
|
"annotation",
|
|
15
15
|
"galaxy_id",
|
|
16
|
+
"get_is_meta",
|
|
17
|
+
"get_step_jobs_count",
|
|
16
18
|
"published",
|
|
17
19
|
"galaxy_owner",
|
|
18
20
|
"get_tags",
|
|
@@ -22,11 +24,19 @@ class WorkflowAdmin(GalaxyElementAdmin):
|
|
|
22
24
|
"name",
|
|
23
25
|
"annotation",
|
|
24
26
|
"galaxy_id",
|
|
27
|
+
"get_is_meta",
|
|
28
|
+
"get_step_jobs_count",
|
|
25
29
|
"published",
|
|
26
30
|
"galaxy_owner",
|
|
27
31
|
"get_tags",
|
|
28
32
|
)
|
|
29
33
|
|
|
34
|
+
def get_is_meta(self, obj):
|
|
35
|
+
return obj.get_is_meta()
|
|
36
|
+
|
|
37
|
+
def get_step_jobs_count(self, obj):
|
|
38
|
+
return obj.get_step_jobs_count()
|
|
39
|
+
|
|
30
40
|
def get_tags(self, obj):
|
|
31
41
|
return ", ".join([p.label for p in obj.tags.all()])
|
|
32
42
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Generated by Django 4.1 on 2025-02-12 13:28
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
("django_to_galaxy", "0009_galaxyoutputfile_unique_galaxy_id_per_invocation"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AddField(
|
|
14
|
+
model_name="workflow",
|
|
15
|
+
name="_is_meta",
|
|
16
|
+
field=models.BooleanField(default=None, null=True),
|
|
17
|
+
),
|
|
18
|
+
migrations.AddField(
|
|
19
|
+
model_name="workflow",
|
|
20
|
+
name="_step_jobs_count",
|
|
21
|
+
field=models.PositiveIntegerField(default=0),
|
|
22
|
+
),
|
|
23
|
+
]
|
|
@@ -46,7 +46,7 @@ class History(GalaxyElement):
|
|
|
46
46
|
|
|
47
47
|
def delete(self, **kwargs):
|
|
48
48
|
"""Overloaded method to also delete history on Galaxy side."""
|
|
49
|
-
self.galaxy_owner.obj_gi.histories.delete(id_=self.galaxy_id)
|
|
49
|
+
self.galaxy_owner.obj_gi.histories.delete(id_=self.galaxy_id, purge=True)
|
|
50
50
|
return super().delete(**kwargs)
|
|
51
51
|
|
|
52
52
|
def synchronize(self):
|
|
@@ -12,7 +12,6 @@ from django_to_galaxy.utils import enabled_cache
|
|
|
12
12
|
|
|
13
13
|
from django.core.exceptions import ObjectDoesNotExist
|
|
14
14
|
|
|
15
|
-
READY = "ready"
|
|
16
15
|
RUNNING = "running"
|
|
17
16
|
DONE = "done"
|
|
18
17
|
ERROR = "error"
|
|
@@ -75,19 +74,17 @@ class Invocation(models.Model):
|
|
|
75
74
|
"""Get galaxy object using bioblend."""
|
|
76
75
|
return self.workflow.galaxy_owner.obj_gi.invocations.get(self.galaxy_id)
|
|
77
76
|
|
|
78
|
-
def complet_jobs_summary(self, step
|
|
77
|
+
def complet_jobs_summary(self, step):
|
|
79
78
|
subinv = self.galaxy_invocation.gi.invocations.get(
|
|
80
79
|
step.wrapped["subworkflow_invocation_id"]
|
|
81
80
|
)
|
|
82
|
-
if subinv.state != READY or not subinv.steps:
|
|
83
|
-
subworkflow_invocation_state = subinv.state
|
|
84
81
|
sub_jobs_summary = subinv.step_jobs_summary()
|
|
85
82
|
for job in sub_jobs_summary:
|
|
86
83
|
self.step_jobs_summary.append(job)
|
|
87
84
|
for sub in subinv.steps:
|
|
88
85
|
if "subworkflow_invocation_id" in sub.wrapped:
|
|
89
86
|
if sub.wrapped["subworkflow_invocation_id"]:
|
|
90
|
-
self.complet_jobs_summary(sub
|
|
87
|
+
self.complet_jobs_summary(sub)
|
|
91
88
|
|
|
92
89
|
@property
|
|
93
90
|
def percentage_done(self) -> float:
|
|
@@ -96,23 +93,22 @@ class Invocation(models.Model):
|
|
|
96
93
|
return 100.0
|
|
97
94
|
self.step_jobs_summary = self.step_jobs_summary()
|
|
98
95
|
|
|
99
|
-
subworkflow_invocation_state = None
|
|
100
|
-
if self.galaxy_invocation.state != READY:
|
|
101
|
-
subworkflow_invocation_state = PAUSED
|
|
102
96
|
for step in self.galaxy_invocation.steps:
|
|
103
97
|
if "subworkflow_invocation_id" in step.wrapped:
|
|
104
98
|
if step.wrapped["subworkflow_invocation_id"]:
|
|
105
|
-
self.complet_jobs_summary(step
|
|
99
|
+
self.complet_jobs_summary(step)
|
|
106
100
|
|
|
107
101
|
count_states = defaultdict(int)
|
|
108
102
|
for step in self.step_jobs_summary:
|
|
109
103
|
for key in step["states"].keys():
|
|
110
104
|
count_states[key] += 1
|
|
111
105
|
try:
|
|
112
|
-
percentage_done =
|
|
106
|
+
percentage_done = (
|
|
107
|
+
count_states.get("ok", 0) / self.workflow.get_step_jobs_count()
|
|
108
|
+
)
|
|
113
109
|
except ZeroDivisionError:
|
|
114
110
|
percentage_done = 0
|
|
115
|
-
if percentage_done == 1
|
|
111
|
+
if percentage_done == 1:
|
|
116
112
|
self.status = DONE
|
|
117
113
|
self.save()
|
|
118
114
|
if "error" in count_states.keys():
|
|
@@ -15,6 +15,10 @@ class Workflow(GalaxyElement):
|
|
|
15
15
|
"GalaxyUser", null=False, on_delete=models.CASCADE, related_name="workflows"
|
|
16
16
|
)
|
|
17
17
|
"""Galaxy user that owns the workflow."""
|
|
18
|
+
_step_jobs_count = models.PositiveIntegerField(default=0)
|
|
19
|
+
"""Number of step jobs of the workflow."""
|
|
20
|
+
_is_meta = models.BooleanField(null=True, default=None, blank=True)
|
|
21
|
+
"""Indicates whether the workflow is a meta (i.e., has sub-workflows) or not."""
|
|
18
22
|
|
|
19
23
|
@property
|
|
20
24
|
def galaxy_workflow(self) -> wrappers.Workflow:
|
|
@@ -27,6 +31,48 @@ class Workflow(GalaxyElement):
|
|
|
27
31
|
"""Get galaxy object using bioblend."""
|
|
28
32
|
return self.galaxy_owner.obj_gi.workflows.get(self.galaxy_id)
|
|
29
33
|
|
|
34
|
+
def get_is_meta(self):
|
|
35
|
+
"""Sets / returns _is_meta value."""
|
|
36
|
+
if self._is_meta is None:
|
|
37
|
+
self._is_meta = False
|
|
38
|
+
for key, step_dict in self.galaxy_workflow.steps.items():
|
|
39
|
+
w = step_dict.wrapped
|
|
40
|
+
if "workflow_id" in w:
|
|
41
|
+
self._is_meta = True
|
|
42
|
+
break
|
|
43
|
+
self.save(update_fields=["_is_meta"])
|
|
44
|
+
return self._is_meta
|
|
45
|
+
|
|
46
|
+
def get_step_jobs_count(self):
|
|
47
|
+
"""Sets / returns _step_jobs_count value."""
|
|
48
|
+
if self._step_jobs_count == 0:
|
|
49
|
+
galaxy_wf = self.galaxy_workflow
|
|
50
|
+
step_jobs_count = 0
|
|
51
|
+
if self.get_is_meta():
|
|
52
|
+
# Total step jobs count for a meta wf
|
|
53
|
+
galaxy_client = self.galaxy_owner.obj_gi.gi
|
|
54
|
+
for key, step_dict in galaxy_wf.steps.items():
|
|
55
|
+
w = step_dict.wrapped
|
|
56
|
+
if "workflow_id" in w:
|
|
57
|
+
sub_wf = galaxy_client.make_get_request(
|
|
58
|
+
galaxy_client.base_url
|
|
59
|
+
+ f"/api/workflows/{w['workflow_id']}",
|
|
60
|
+
params={"instance": "true"},
|
|
61
|
+
).json()
|
|
62
|
+
for j in range(len(sub_wf["steps"])):
|
|
63
|
+
step = sub_wf["steps"][str(j)]
|
|
64
|
+
if "input" not in step["type"]:
|
|
65
|
+
step_jobs_count += 1
|
|
66
|
+
else:
|
|
67
|
+
# Total step jobs count for a simple wf
|
|
68
|
+
for key, step_dict in galaxy_wf.steps.items():
|
|
69
|
+
w = step_dict.wrapped
|
|
70
|
+
if "input" not in w["type"]:
|
|
71
|
+
step_jobs_count += 1
|
|
72
|
+
self._step_jobs_count = step_jobs_count
|
|
73
|
+
self.save(update_fields=["_step_jobs_count"])
|
|
74
|
+
return self._step_jobs_count
|
|
75
|
+
|
|
30
76
|
def invoke(self, datamap: dict, history: History) -> wrappers.Invocation:
|
|
31
77
|
"""
|
|
32
78
|
Invoke workflow using bioblend.
|
django_to_galaxy/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: django-to-galaxy
|
|
3
|
-
Version: 0.6.9.
|
|
3
|
+
Version: 0.6.9.6
|
|
4
4
|
Summary: Django extension that eases communication with Galaxy instance to execute workflows.
|
|
5
5
|
Author: Kenzo-Hugo Hillion
|
|
6
6
|
Author-email: hillion.kenzo@posteo.net
|
|
@@ -7,7 +7,7 @@ django_to_galaxy/admin/galaxy_user.py,sha256=A_VBW0LlPoEHfPhPbo21H6YNhWlTgPCyzPx
|
|
|
7
7
|
django_to_galaxy/admin/history.py,sha256=eVN-ZCAju0_1ygeSnHEie3a7iy7LoW3bOhWQyU20XTw,2562
|
|
8
8
|
django_to_galaxy/admin/invocation.py,sha256=Rgtkyyl2WrDZN-fF_u5lPlicGe341UGwBMbI06nZG78,4821
|
|
9
9
|
django_to_galaxy/admin/tag.py,sha256=jqQ64sLieq4CSRFHesNt33SqTNnA-z3oiQuj7Ncx_jU,315
|
|
10
|
-
django_to_galaxy/admin/workflow.py,sha256=
|
|
10
|
+
django_to_galaxy/admin/workflow.py,sha256=5rnP7NdxhFVKk8pMkpeJdcZWJoNrgQev0LB7wO6nyt4,1616
|
|
11
11
|
django_to_galaxy/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
django_to_galaxy/api/serializers/asymetricslugrelatedfield.py,sha256=BKdbkblCA5PKodsBqgwg6W_gTSrrmoGBElh_CNVd7dY,1079
|
|
13
13
|
django_to_galaxy/api/serializers/galaxy_instance.py,sha256=r_W9seqc2afc3tFrsWTyZ50-CThsHXutO7TwhYFnyXE,257
|
|
@@ -38,6 +38,7 @@ django_to_galaxy/migrations/0006_tag_history_tags_workflow_tags.py,sha256=Zv4Fzm
|
|
|
38
38
|
django_to_galaxy/migrations/0007_format_alter_history_tags_alter_workflow_tags_and_more.py,sha256=_nKYmJmw6EAoAj3oOCcbDKYPeQYY30Fq1SvguU1V7fs,2000
|
|
39
39
|
django_to_galaxy/migrations/0008_workflowinput_label.py,sha256=UisIOkD73J2dgQXB12eU91g8c9nTkQdHEy111nObN7c,481
|
|
40
40
|
django_to_galaxy/migrations/0009_galaxyoutputfile_unique_galaxy_id_per_invocation.py,sha256=a3zgC01TVtUeuTlISOe4vZ-oJj1opIMkN_8UIvFFjvc,500
|
|
41
|
+
django_to_galaxy/migrations/0010_workflow__is_meta_workflow__step_jobs_count.py,sha256=rESj9tXHrhRdN0V-kc11VSvIwL-TN6sVR3B9zYpaX3w,608
|
|
41
42
|
django_to_galaxy/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
42
43
|
django_to_galaxy/models/__init__.py,sha256=5e1Fw1G-mWZnj4vUUY_lO_DH6lQL_P9nO6GYkyyS3zk,370
|
|
43
44
|
django_to_galaxy/models/accepted_input.py,sha256=hIR9rlOaVKdUax21PEpaMzdwj9yOceRaFyFsbRO1C6g,889
|
|
@@ -45,17 +46,17 @@ django_to_galaxy/models/galaxy_element.py,sha256=55qUtUks-rC4A7O1DFjeUUm-AN0-qNm
|
|
|
45
46
|
django_to_galaxy/models/galaxy_instance.py,sha256=931iyrqJxK6YCbkaC6FPdqMRI_hhGQ-UokhW5-N7swk,723
|
|
46
47
|
django_to_galaxy/models/galaxy_output_file.py,sha256=oAq7HZBk3svG88NagFpkpiB5TQoncbpGFxCCTFoCzyo,1915
|
|
47
48
|
django_to_galaxy/models/galaxy_user.py,sha256=Cz6wmyD3PvltFi2yKEKr2z7YTsxlmnNV8xwA0Gltu_o,3264
|
|
48
|
-
django_to_galaxy/models/history.py,sha256
|
|
49
|
-
django_to_galaxy/models/invocation.py,sha256=
|
|
50
|
-
django_to_galaxy/models/workflow.py,sha256=
|
|
49
|
+
django_to_galaxy/models/history.py,sha256=-u0DDrwsNprYf-CMAut4q5eu2IzWXXLoKmuBpac7DKs,2647
|
|
50
|
+
django_to_galaxy/models/invocation.py,sha256=huskr6NTonoqPp-GVL-cOjPxFY2MlaOC3MVj8Trs43U,8359
|
|
51
|
+
django_to_galaxy/models/workflow.py,sha256=tWa27SQhZDZVPSg95BJHI_SOKMD9Wyiv5dYqU52Nv1o,4021
|
|
51
52
|
django_to_galaxy/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
52
53
|
django_to_galaxy/schemas/dataset.py,sha256=yjwLJGb487VJDXoXGg8fG_TW6TJPeyeGtd9vofU-7HI,396
|
|
53
54
|
django_to_galaxy/settings.py,sha256=Jn1gznlxhlu57D_cdbAhBQTTN9jq4GIb31czhQQUtJo,138
|
|
54
55
|
django_to_galaxy/templates/admin/import_workflows.html,sha256=YB101H99EOR8td_DzfNshhJYpXpGD9aJNh8t4mKPgEQ,2389
|
|
55
56
|
django_to_galaxy/urls.py,sha256=ydMl_0qSyz8GSGkWpiSzU3khqj9mPyZacx532JybLHk,106
|
|
56
57
|
django_to_galaxy/utils.py,sha256=gjUzzqfpili66CY7vFyseqHOD9vqWg_2tzWAiTe3pNE,1625
|
|
57
|
-
django_to_galaxy/version.py,sha256=
|
|
58
|
-
django_to_galaxy-0.6.9.
|
|
59
|
-
django_to_galaxy-0.6.9.
|
|
60
|
-
django_to_galaxy-0.6.9.
|
|
61
|
-
django_to_galaxy-0.6.9.
|
|
58
|
+
django_to_galaxy/version.py,sha256=SWpc-6Xmr8gQ3xBhFnZzJC9V1ErahXEoMU_Gq5UjoDg,114
|
|
59
|
+
django_to_galaxy-0.6.9.6.dist-info/LICENSE,sha256=Er3Bp2y6Wf31e0s1-Tdu_d6Gd89FtTizmGUJzGQkWvo,34498
|
|
60
|
+
django_to_galaxy-0.6.9.6.dist-info/METADATA,sha256=yIFRA2hXY993G0MFhEIBl-3FB4fWi5ja8Uu88NQbRBM,612
|
|
61
|
+
django_to_galaxy-0.6.9.6.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
|
62
|
+
django_to_galaxy-0.6.9.6.dist-info/RECORD,,
|
|
File without changes
|