django-to-galaxy 0.6.9.6__py3-none-any.whl → 0.6.9.8__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 +4 -4
- django_to_galaxy/migrations/0011_rename__step_jobs_count_workflow__step_count_and_more.py +23 -0
- django_to_galaxy/models/invocation.py +41 -12
- django_to_galaxy/models/workflow.py +7 -30
- django_to_galaxy/settings.py +2 -2
- django_to_galaxy/version.py +1 -1
- {django_to_galaxy-0.6.9.6.dist-info → django_to_galaxy-0.6.9.8.dist-info}/METADATA +3 -2
- {django_to_galaxy-0.6.9.6.dist-info → django_to_galaxy-0.6.9.8.dist-info}/RECORD +10 -9
- {django_to_galaxy-0.6.9.6.dist-info → django_to_galaxy-0.6.9.8.dist-info}/WHEEL +1 -1
- {django_to_galaxy-0.6.9.6.dist-info → django_to_galaxy-0.6.9.8.dist-info}/LICENSE +0 -0
|
@@ -14,7 +14,7 @@ class WorkflowAdmin(GalaxyElementAdmin):
|
|
|
14
14
|
"annotation",
|
|
15
15
|
"galaxy_id",
|
|
16
16
|
"get_is_meta",
|
|
17
|
-
"
|
|
17
|
+
"get_step_count",
|
|
18
18
|
"published",
|
|
19
19
|
"galaxy_owner",
|
|
20
20
|
"get_tags",
|
|
@@ -25,7 +25,7 @@ class WorkflowAdmin(GalaxyElementAdmin):
|
|
|
25
25
|
"annotation",
|
|
26
26
|
"galaxy_id",
|
|
27
27
|
"get_is_meta",
|
|
28
|
-
"
|
|
28
|
+
"get_step_count",
|
|
29
29
|
"published",
|
|
30
30
|
"galaxy_owner",
|
|
31
31
|
"get_tags",
|
|
@@ -34,8 +34,8 @@ class WorkflowAdmin(GalaxyElementAdmin):
|
|
|
34
34
|
def get_is_meta(self, obj):
|
|
35
35
|
return obj.get_is_meta()
|
|
36
36
|
|
|
37
|
-
def
|
|
38
|
-
return obj.
|
|
37
|
+
def get_step_count(self, obj):
|
|
38
|
+
return obj.get_step_count()
|
|
39
39
|
|
|
40
40
|
def get_tags(self, obj):
|
|
41
41
|
return ", ".join([p.label for p in obj.tags.all()])
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Generated by Django 5.2.3 on 2025-07-18 14:07
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
("django_to_galaxy", "0010_workflow__is_meta_workflow__step_jobs_count"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.RenameField(
|
|
14
|
+
model_name="workflow",
|
|
15
|
+
old_name="_step_jobs_count",
|
|
16
|
+
new_name="_step_count",
|
|
17
|
+
),
|
|
18
|
+
migrations.AlterField(
|
|
19
|
+
model_name="workflow",
|
|
20
|
+
name="_is_meta",
|
|
21
|
+
field=models.BooleanField(blank=True, default=None, null=True),
|
|
22
|
+
),
|
|
23
|
+
]
|
|
@@ -57,7 +57,7 @@ class Invocation(models.Model):
|
|
|
57
57
|
step_job_summary["states"] = {}
|
|
58
58
|
step_job_summary["id"] = step_job.job_id
|
|
59
59
|
step_job_summary["states"][
|
|
60
|
-
self.
|
|
60
|
+
self.galaxy_invocation.gi.jobs.get(step_job.job_id).state
|
|
61
61
|
] = 1
|
|
62
62
|
step_jobs_summary.append(step_job_summary)
|
|
63
63
|
|
|
@@ -88,37 +88,66 @@ class Invocation(models.Model):
|
|
|
88
88
|
|
|
89
89
|
@property
|
|
90
90
|
def percentage_done(self) -> float:
|
|
91
|
-
"""Retrieve percentage of
|
|
91
|
+
"""Retrieve percentage of steps done for the invocation."""
|
|
92
92
|
if self.status == DONE:
|
|
93
93
|
return 100.0
|
|
94
94
|
self.step_jobs_summary = self.step_jobs_summary()
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
inv_steps = self.galaxy_invocation.steps
|
|
97
|
+
for step in inv_steps:
|
|
97
98
|
if "subworkflow_invocation_id" in step.wrapped:
|
|
98
99
|
if step.wrapped["subworkflow_invocation_id"]:
|
|
99
100
|
self.complet_jobs_summary(step)
|
|
100
101
|
|
|
101
|
-
|
|
102
|
+
count_job_states = defaultdict(int)
|
|
102
103
|
for step in self.step_jobs_summary:
|
|
103
104
|
for key in step["states"].keys():
|
|
104
|
-
|
|
105
|
+
count_job_states[key] += 1
|
|
106
|
+
count_scheduled_steps = sum(step.state == "scheduled" for step in inv_steps)
|
|
107
|
+
wf_step_count = self.workflow._step_count
|
|
105
108
|
try:
|
|
106
|
-
percentage_done =
|
|
107
|
-
count_states.get("ok", 0) / self.workflow.get_step_jobs_count()
|
|
108
|
-
)
|
|
109
|
+
percentage_done = count_scheduled_steps / wf_step_count
|
|
109
110
|
except ZeroDivisionError:
|
|
110
111
|
percentage_done = 0
|
|
111
112
|
if percentage_done == 1:
|
|
112
|
-
|
|
113
|
-
self.
|
|
114
|
-
|
|
113
|
+
last_job = inv_steps[wf_step_count - 1]
|
|
114
|
+
if self.check_if_last_job_is_ok(last_job):
|
|
115
|
+
self.status = DONE
|
|
116
|
+
self.save()
|
|
117
|
+
else:
|
|
118
|
+
try:
|
|
119
|
+
percentage_done = (count_scheduled_steps - 1) / wf_step_count
|
|
120
|
+
except ZeroDivisionError:
|
|
121
|
+
percentage_done = 0
|
|
122
|
+
if "error" in count_job_states.keys():
|
|
115
123
|
self.status = ERROR
|
|
116
124
|
self.save()
|
|
117
|
-
elif "paused" in
|
|
125
|
+
elif "paused" in count_job_states.keys():
|
|
118
126
|
self.status = PAUSED
|
|
119
127
|
self.save()
|
|
120
128
|
return percentage_done * 100
|
|
121
129
|
|
|
130
|
+
def check_if_last_job_is_ok(self, last_job):
|
|
131
|
+
"""Checks if the very last job is done"""
|
|
132
|
+
if last_job.job_id:
|
|
133
|
+
return self.galaxy_invocation.gi.jobs.get(last_job.job_id).state == "ok"
|
|
134
|
+
if (
|
|
135
|
+
"subworkflow_invocation_id" in last_job.wrapped
|
|
136
|
+
and last_job.wrapped["subworkflow_invocation_id"]
|
|
137
|
+
and len(
|
|
138
|
+
self.galaxy_invocation.gi.invocations.get(
|
|
139
|
+
last_job.wrapped["subworkflow_invocation_id"]
|
|
140
|
+
).steps
|
|
141
|
+
)
|
|
142
|
+
> 0
|
|
143
|
+
):
|
|
144
|
+
return self.check_if_last_job_is_ok(
|
|
145
|
+
self.galaxy_invocation.gi.invocations.get(
|
|
146
|
+
last_job.wrapped["subworkflow_invocation_id"]
|
|
147
|
+
).steps[-1]
|
|
148
|
+
)
|
|
149
|
+
return False
|
|
150
|
+
|
|
122
151
|
@property
|
|
123
152
|
def job_id_to_tools(self) -> Dict[str, dict]:
|
|
124
153
|
"""Dict of job_id to wrapped tool."""
|
|
@@ -15,8 +15,8 @@ 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
|
-
|
|
19
|
-
"""Number of
|
|
18
|
+
_step_count = models.PositiveIntegerField(default=0)
|
|
19
|
+
"""Number of steps in the workflow."""
|
|
20
20
|
_is_meta = models.BooleanField(null=True, default=None, blank=True)
|
|
21
21
|
"""Indicates whether the workflow is a meta (i.e., has sub-workflows) or not."""
|
|
22
22
|
|
|
@@ -43,35 +43,12 @@ class Workflow(GalaxyElement):
|
|
|
43
43
|
self.save(update_fields=["_is_meta"])
|
|
44
44
|
return self._is_meta
|
|
45
45
|
|
|
46
|
-
def
|
|
46
|
+
def get_step_count(self):
|
|
47
47
|
"""Sets / returns _step_jobs_count value."""
|
|
48
|
-
if self.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
|
48
|
+
if self._step_count == 0:
|
|
49
|
+
self._step_count = len(self.galaxy_workflow.steps)
|
|
50
|
+
self.save(update_fields=["_step_count"])
|
|
51
|
+
return self._step_count
|
|
75
52
|
|
|
76
53
|
def invoke(self, datamap: dict, history: History) -> wrappers.Invocation:
|
|
77
54
|
"""
|
django_to_galaxy/settings.py
CHANGED
django_to_galaxy/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: django-to-galaxy
|
|
3
|
-
Version: 0.6.9.
|
|
3
|
+
Version: 0.6.9.8
|
|
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
|
|
@@ -11,5 +11,6 @@ Requires-Dist: Django (>=5.1.1,<6.0.0)
|
|
|
11
11
|
Requires-Dist: Markdown (>=3.3.6,<4.0.0)
|
|
12
12
|
Requires-Dist: bioblend (>=0.16.0,<0.17.0)
|
|
13
13
|
Requires-Dist: djangorestframework (>=3.13.1,<4.0.0)
|
|
14
|
-
Requires-Dist: pydantic (>=
|
|
14
|
+
Requires-Dist: pydantic (>=2.11.0,<3.0.0)
|
|
15
|
+
Requires-Dist: pydantic-settings (>=2.9.0,<3.0.0)
|
|
15
16
|
Requires-Dist: requests-cache (>=0.9.5,<0.10.0)
|
|
@@ -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=mV4xUGBSM8_YgvJK7Qr_7617q9xQyu_0GvWcuVHpjJ0,1596
|
|
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
|
|
@@ -39,6 +39,7 @@ django_to_galaxy/migrations/0007_format_alter_history_tags_alter_workflow_tags_a
|
|
|
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
41
|
django_to_galaxy/migrations/0010_workflow__is_meta_workflow__step_jobs_count.py,sha256=rESj9tXHrhRdN0V-kc11VSvIwL-TN6sVR3B9zYpaX3w,608
|
|
42
|
+
django_to_galaxy/migrations/0011_rename__step_jobs_count_workflow__step_count_and_more.py,sha256=_mkNLEMwRAR4vZ7HI0YGRaCcgq2S2xIsMJyjycE9Dc0,604
|
|
42
43
|
django_to_galaxy/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
43
44
|
django_to_galaxy/models/__init__.py,sha256=5e1Fw1G-mWZnj4vUUY_lO_DH6lQL_P9nO6GYkyyS3zk,370
|
|
44
45
|
django_to_galaxy/models/accepted_input.py,sha256=hIR9rlOaVKdUax21PEpaMzdwj9yOceRaFyFsbRO1C6g,889
|
|
@@ -47,16 +48,16 @@ django_to_galaxy/models/galaxy_instance.py,sha256=931iyrqJxK6YCbkaC6FPdqMRI_hhGQ
|
|
|
47
48
|
django_to_galaxy/models/galaxy_output_file.py,sha256=oAq7HZBk3svG88NagFpkpiB5TQoncbpGFxCCTFoCzyo,1915
|
|
48
49
|
django_to_galaxy/models/galaxy_user.py,sha256=Cz6wmyD3PvltFi2yKEKr2z7YTsxlmnNV8xwA0Gltu_o,3264
|
|
49
50
|
django_to_galaxy/models/history.py,sha256=-u0DDrwsNprYf-CMAut4q5eu2IzWXXLoKmuBpac7DKs,2647
|
|
50
|
-
django_to_galaxy/models/invocation.py,sha256=
|
|
51
|
-
django_to_galaxy/models/workflow.py,sha256=
|
|
51
|
+
django_to_galaxy/models/invocation.py,sha256=rUlec3a-xmzOTN7shp9W21hMJ_-eag2MuhwSzIAda3o,9589
|
|
52
|
+
django_to_galaxy/models/workflow.py,sha256=1VdBKLIlay9DbyJdTD1YD_TVa4Xfrb85-f8esr6oHVI,2848
|
|
52
53
|
django_to_galaxy/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
54
|
django_to_galaxy/schemas/dataset.py,sha256=yjwLJGb487VJDXoXGg8fG_TW6TJPeyeGtd9vofU-7HI,396
|
|
54
|
-
django_to_galaxy/settings.py,sha256=
|
|
55
|
+
django_to_galaxy/settings.py,sha256=5obYQz55omr6_tfaO3ap_K7LmWvFcljv2UAL82SvL8s,152
|
|
55
56
|
django_to_galaxy/templates/admin/import_workflows.html,sha256=YB101H99EOR8td_DzfNshhJYpXpGD9aJNh8t4mKPgEQ,2389
|
|
56
57
|
django_to_galaxy/urls.py,sha256=ydMl_0qSyz8GSGkWpiSzU3khqj9mPyZacx532JybLHk,106
|
|
57
58
|
django_to_galaxy/utils.py,sha256=gjUzzqfpili66CY7vFyseqHOD9vqWg_2tzWAiTe3pNE,1625
|
|
58
|
-
django_to_galaxy/version.py,sha256=
|
|
59
|
-
django_to_galaxy-0.6.9.
|
|
60
|
-
django_to_galaxy-0.6.9.
|
|
61
|
-
django_to_galaxy-0.6.9.
|
|
62
|
-
django_to_galaxy-0.6.9.
|
|
59
|
+
django_to_galaxy/version.py,sha256=jFggpPY_442cuhBhBYt7tGqTcH3F-_IRnweBZxuv7iU,114
|
|
60
|
+
django_to_galaxy-0.6.9.8.dist-info/LICENSE,sha256=Er3Bp2y6Wf31e0s1-Tdu_d6Gd89FtTizmGUJzGQkWvo,34498
|
|
61
|
+
django_to_galaxy-0.6.9.8.dist-info/METADATA,sha256=pxke7QYKD0duVoNpOBaj5U4eEnK0NolhjunSGEzTLOQ,663
|
|
62
|
+
django_to_galaxy-0.6.9.8.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
63
|
+
django_to_galaxy-0.6.9.8.dist-info/RECORD,,
|
|
File without changes
|