django-to-galaxy 0.6.9.5__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.

@@ -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
+ ]
@@ -103,7 +103,9 @@ class Invocation(models.Model):
103
103
  for key in step["states"].keys():
104
104
  count_states[key] += 1
105
105
  try:
106
- percentage_done = count_states.get("ok", 0) / len(self.step_jobs_summary)
106
+ percentage_done = (
107
+ count_states.get("ok", 0) / self.workflow.get_step_jobs_count()
108
+ )
107
109
  except ZeroDivisionError:
108
110
  percentage_done = 0
109
111
  if percentage_done == 1:
@@ -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.
@@ -1,3 +1,3 @@
1
1
  """Handle library versioning."""
2
- version_info = (0, 6, 9, 5)
2
+ version_info = (0, 6, 9, 6)
3
3
  __version__ = ".".join(str(c) for c in version_info)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: django-to-galaxy
3
- Version: 0.6.9.5
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=6t9z7JQPv-D7tzyi9WNUxEQXdetGlNCSzNIoX1SCAdM,1360
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
@@ -46,16 +47,16 @@ django_to_galaxy/models/galaxy_instance.py,sha256=931iyrqJxK6YCbkaC6FPdqMRI_hhGQ
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
49
  django_to_galaxy/models/history.py,sha256=-u0DDrwsNprYf-CMAut4q5eu2IzWXXLoKmuBpac7DKs,2647
49
- django_to_galaxy/models/invocation.py,sha256=kexyKXY2I5QaPlBUs9cva1jzsN2EczIwcPKElgG6Sng,8319
50
- django_to_galaxy/models/workflow.py,sha256=1Ok0TSSIM-LJbaY1Vm19YVg_WwDxznbLDcXI71S_IL8,1891
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=-mvkaTH9aOCqLazgP3snDMg-hrtcjBkwNC0P-BhxtAY,114
58
- django_to_galaxy-0.6.9.5.dist-info/LICENSE,sha256=Er3Bp2y6Wf31e0s1-Tdu_d6Gd89FtTizmGUJzGQkWvo,34498
59
- django_to_galaxy-0.6.9.5.dist-info/METADATA,sha256=FOprcHMGUv9XcLucKaCuNjKRZkrG1audhpauvg3Dxwk,612
60
- django_to_galaxy-0.6.9.5.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
61
- django_to_galaxy-0.6.9.5.dist-info/RECORD,,
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,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.1
2
+ Generator: poetry-core 2.0.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any