django-to-galaxy 0.6.7__py3-none-any.whl → 0.6.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.

@@ -157,14 +157,15 @@ class GalaxyUserAdmin(admin.ModelAdmin):
157
157
  label=elem_dict["label"],
158
158
  workflow=wf,
159
159
  )
160
- for format in step_dict.tool_inputs["format"]:
161
- (
162
- winputformat,
163
- created,
164
- ) = Format.objects.get_or_create(
165
- format=format.strip()
166
- )
167
- workflowinput.formats.add(winputformat.id)
160
+ if hasattr(step_dict.tool_inputs, "format"):
161
+ for format in step_dict.tool_inputs["format"]:
162
+ (
163
+ winputformat,
164
+ created,
165
+ ) = Format.objects.get_or_create(
166
+ format=format.strip()
167
+ )
168
+ workflowinput.formats.add(winputformat.id)
168
169
  workflowinput.optional = step_dict.tool_inputs[
169
170
  "optional"
170
171
  ]
@@ -36,22 +36,13 @@ class InvocationAdmin(GalaxyElementAdmin):
36
36
 
37
37
  @admin.display(description="Percentage Done")
38
38
  def display_percentage_done(self, obj):
39
- try:
40
- return format_html(
41
- """
42
- <progress value="{0}" max="100"></progress>
43
- <span style="font-weight:bold">{0}%</span>
44
- """,
45
- obj.percentage_done,
46
- )
47
- except ZeroDivisionError:
48
- return format_html(
49
- """
50
- <progress value="{0}" max="100"></progress>
51
- <span style="font-weight:bold">{0}%</span>
52
- """,
53
- 0,
54
- )
39
+ return format_html(
40
+ """
41
+ <progress value="{0}" max="100"></progress>
42
+ <span style="font-weight:bold">{0}%</span>
43
+ """,
44
+ obj.percentage_done,
45
+ )
55
46
 
56
47
  def _get_message_invocation(
57
48
  self,
@@ -1,7 +1,7 @@
1
1
  import logging
2
2
  from collections import defaultdict
3
3
  from time import sleep
4
- from typing import List, Dict
4
+ from typing import Any, List, Dict
5
5
 
6
6
  from bioblend.galaxy.objects import wrappers
7
7
  from django.db import models
@@ -48,6 +48,21 @@ class Invocation(models.Model):
48
48
  create_time = models.DateTimeField()
49
49
  """Time the invocation was created."""
50
50
 
51
+ def step_jobs_summary(self) -> List[Dict[str, Any]]:
52
+ """Workaround self.galaxy_invocation.step_jobs_summary() due to v24.0 db issue"""
53
+ step_jobs_summary = []
54
+ for step_job in self.galaxy_invocation.steps:
55
+ if step_job.job_id is not None:
56
+ step_job_summary = {}
57
+ step_job_summary["states"] = {}
58
+ step_job_summary["id"] = step_job.job_id
59
+ step_job_summary["states"][
60
+ self.workflow.galaxy_owner.obj_gi.jobs.get(step_job.job_id).state
61
+ ] = 1
62
+ step_jobs_summary.append(step_job_summary)
63
+
64
+ return step_jobs_summary
65
+
51
66
  @property
52
67
  def galaxy_invocation(self) -> wrappers.Invocation:
53
68
  """Galaxy object using bioblend."""
@@ -76,7 +91,7 @@ class Invocation(models.Model):
76
91
  """Retrieve percentage of jobs done for the invocation."""
77
92
  if self.status == DONE:
78
93
  return 100.0
79
- self.step_jobs_summary = self.galaxy_invocation.step_jobs_summary()
94
+ self.step_jobs_summary = self.step_jobs_summary()
80
95
 
81
96
  for step in self.galaxy_invocation.steps:
82
97
  if "subworkflow_invocation_id" in step.wrapped:
@@ -87,7 +102,10 @@ class Invocation(models.Model):
87
102
  for step in self.step_jobs_summary:
88
103
  for key in step["states"].keys():
89
104
  count_states[key] += 1
90
- percentage_done = count_states.get("ok", 0) / len(self.step_jobs_summary)
105
+ try:
106
+ percentage_done = count_states.get("ok", 0) / len(self.step_jobs_summary)
107
+ except ZeroDivisionError:
108
+ percentage_done = 0
91
109
  if percentage_done == 1:
92
110
  self.status = DONE
93
111
  self.save()
@@ -107,7 +125,7 @@ class Invocation(models.Model):
107
125
  return self._job_id_to_tools
108
126
 
109
127
  def _build_job_id_to_tools(self) -> Dict[str, dict]:
110
- step_jobs_summary = self.galaxy_invocation.step_jobs_summary()
128
+ step_jobs_summary = self.step_jobs_summary()
111
129
  job_id_to_tools = {}
112
130
  for step in step_jobs_summary:
113
131
  job_id = step["id"]
@@ -122,7 +140,7 @@ class Invocation(models.Model):
122
140
  @property
123
141
  def detailed_step_jobs_summary(self) -> List[dict]:
124
142
  """Retrive `step_jobs_summary` with details of tool used."""
125
- step_jobs_summary = self.galaxy_invocation.step_jobs_summary()
143
+ step_jobs_summary = self.step_jobs_summary()
126
144
  detailed_jobs_summary = []
127
145
  for step in step_jobs_summary:
128
146
  detailed_step = step
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-to-galaxy
3
- Version: 0.6.7
3
+ Version: 0.6.9
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
@@ -3,9 +3,9 @@ django_to_galaxy/admin/__init__.py,sha256=Rf8utzaDbRa3MAFmerhMC8kybejbiUlDFt8mbF
3
3
  django_to_galaxy/admin/galaxy_element.py,sha256=pDdFWQO5BHt251kIW8Gawe0M0O8r5z4cI6EJqQsDBqI,159
4
4
  django_to_galaxy/admin/galaxy_instance.py,sha256=yVlbA5fVbMQBKyKwaFJM3CRFQ2HDjzYHsni_l8MBndU,834
5
5
  django_to_galaxy/admin/galaxy_output_file.py,sha256=bnpwlAH8cQe6nkWIln8iSFDtVyr0kqI5P-QNbISWCfE,2321
6
- django_to_galaxy/admin/galaxy_user.py,sha256=NO0qzhsk6WVnWwvXuodGPLi0o4CPbg0yTZh4VxYvH0k,7278
6
+ django_to_galaxy/admin/galaxy_user.py,sha256=A_VBW0LlPoEHfPhPbo21H6YNhWlTgPCyzPxQM-3Yv84,7387
7
7
  django_to_galaxy/admin/history.py,sha256=eVN-ZCAju0_1ygeSnHEie3a7iy7LoW3bOhWQyU20XTw,2562
8
- django_to_galaxy/admin/invocation.py,sha256=BsVrgMlnEisGcK3ni5oBbcL__yH0PsXYUkPNkIPpEsQ,5121
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
10
  django_to_galaxy/admin/workflow.py,sha256=6t9z7JQPv-D7tzyi9WNUxEQXdetGlNCSzNIoX1SCAdM,1360
11
11
  django_to_galaxy/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -46,7 +46,7 @@ django_to_galaxy/models/galaxy_instance.py,sha256=931iyrqJxK6YCbkaC6FPdqMRI_hhGQ
46
46
  django_to_galaxy/models/galaxy_output_file.py,sha256=oAq7HZBk3svG88NagFpkpiB5TQoncbpGFxCCTFoCzyo,1915
47
47
  django_to_galaxy/models/galaxy_user.py,sha256=Cz6wmyD3PvltFi2yKEKr2z7YTsxlmnNV8xwA0Gltu_o,3264
48
48
  django_to_galaxy/models/history.py,sha256=RF661ULnSMO6wvEutZ-qVDY-9vxu-JcWiGbN7MwdVvI,2635
49
- django_to_galaxy/models/invocation.py,sha256=VfNeP_yplKlh0Uzx9ZYMOErpX7uH2yVOHvZhN94zN00,7620
49
+ django_to_galaxy/models/invocation.py,sha256=kexyKXY2I5QaPlBUs9cva1jzsN2EczIwcPKElgG6Sng,8319
50
50
  django_to_galaxy/models/workflow.py,sha256=1Ok0TSSIM-LJbaY1Vm19YVg_WwDxznbLDcXI71S_IL8,1891
51
51
  django_to_galaxy/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
52
  django_to_galaxy/schemas/dataset.py,sha256=yjwLJGb487VJDXoXGg8fG_TW6TJPeyeGtd9vofU-7HI,396
@@ -55,7 +55,7 @@ django_to_galaxy/templates/admin/import_workflows.html,sha256=YB101H99EOR8td_Dzf
55
55
  django_to_galaxy/urls.py,sha256=ydMl_0qSyz8GSGkWpiSzU3khqj9mPyZacx532JybLHk,106
56
56
  django_to_galaxy/utils.py,sha256=gjUzzqfpili66CY7vFyseqHOD9vqWg_2tzWAiTe3pNE,1625
57
57
  django_to_galaxy/version.py,sha256=O9WfyDkb-iJLGWlnKx2K7kFtcDgFCboBiFm553-3Sjk,111
58
- django_to_galaxy-0.6.7.dist-info/LICENSE,sha256=Er3Bp2y6Wf31e0s1-Tdu_d6Gd89FtTizmGUJzGQkWvo,34498
59
- django_to_galaxy-0.6.7.dist-info/METADATA,sha256=wnFfuwrnXc-YA10ZGhBsgac0XRE5I9bojn3IhYwzO08,764
60
- django_to_galaxy-0.6.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
61
- django_to_galaxy-0.6.7.dist-info/RECORD,,
58
+ django_to_galaxy-0.6.9.dist-info/LICENSE,sha256=Er3Bp2y6Wf31e0s1-Tdu_d6Gd89FtTizmGUJzGQkWvo,34498
59
+ django_to_galaxy-0.6.9.dist-info/METADATA,sha256=egbQux6CxINf3spU2jrz2LzRslamR4T6JtvoLnzPm3U,764
60
+ django_to_galaxy-0.6.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
61
+ django_to_galaxy-0.6.9.dist-info/RECORD,,