elody 0.0.179__py3-none-any.whl → 0.0.180__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.
elody/job.py CHANGED
@@ -6,7 +6,34 @@ _create = _config.crud()["creator"]
6
6
  _post_crud_hook = _config.crud()["post_crud_hook"]
7
7
 
8
8
 
9
- def start_job(
9
+ def add_document_to_job(
10
+ id,
11
+ id_of_document_job_was_initiated_for,
12
+ type_of_document_job_was_initiated_for,
13
+ *,
14
+ get_rabbit,
15
+ ):
16
+ relations = []
17
+ if id_of_document_job_was_initiated_for and type_of_document_job_was_initiated_for:
18
+ relations.append(
19
+ {"key": id_of_document_job_was_initiated_for, "type": "isJobFor"}
20
+ )
21
+ document = {
22
+ "id": id,
23
+ "patch": {
24
+ "relations": (relations),
25
+ },
26
+ }
27
+ _post_crud_hook(crud="update", document=document, get_rabbit=get_rabbit)
28
+ __patch_document_job_was_initiated_for(
29
+ id,
30
+ id_of_document_job_was_initiated_for,
31
+ type_of_document_job_was_initiated_for,
32
+ get_rabbit,
33
+ )
34
+
35
+
36
+ def init_job(
10
37
  name,
11
38
  job_type,
12
39
  *,
@@ -29,7 +56,7 @@ def start_job(
29
56
  {
30
57
  "metadata": [
31
58
  {"key": "name", "value": name},
32
- {"key": "status", "value": "running"},
59
+ {"key": "status", "value": "queued"},
33
60
  {"key": "type", "value": job_type},
34
61
  ],
35
62
  "relations": relations,
@@ -44,6 +71,7 @@ def start_job(
44
71
  crud="create", document=job, parent_id=parent_id, get_rabbit=get_rabbit
45
72
  )
46
73
  __patch_document_job_was_initiated_for(
74
+ job["_id"],
47
75
  id_of_document_job_was_initiated_for,
48
76
  type_of_document_job_was_initiated_for,
49
77
  get_rabbit,
@@ -51,26 +79,22 @@ def start_job(
51
79
  return job["_id"]
52
80
 
53
81
 
54
- def add_document_to_job(
82
+ def start_job(
55
83
  id,
56
- id_of_document_job_was_initiated_for,
57
- type_of_document_job_was_initiated_for,
84
+ id_of_document_job_was_initiated_for=None,
85
+ type_of_document_job_was_initiated_for=None,
58
86
  *,
59
87
  get_rabbit,
60
88
  ):
61
- relations = []
62
- if id_of_document_job_was_initiated_for and type_of_document_job_was_initiated_for:
63
- relations.append(
64
- {"key": id_of_document_job_was_initiated_for, "type": "isJobFor"}
65
- )
66
89
  document = {
67
90
  "id": id,
68
91
  "patch": {
69
- "relations": (relations),
92
+ "metadata": [{"key": "status", "value": "running"}],
93
+ "relations": ([] if id_of_document_job_was_initiated_for else []),
70
94
  },
71
95
  }
72
96
  _post_crud_hook(crud="update", document=document, get_rabbit=get_rabbit)
73
- __patch_document_job_was_initiated_for_v2(
97
+ __patch_document_job_was_initiated_for(
74
98
  id,
75
99
  id_of_document_job_was_initiated_for,
76
100
  type_of_document_job_was_initiated_for,
@@ -94,6 +118,7 @@ def finish_job(
94
118
  }
95
119
  _post_crud_hook(crud="update", document=document, get_rabbit=get_rabbit)
96
120
  __patch_document_job_was_initiated_for(
121
+ id,
97
122
  id_of_document_job_was_initiated_for,
98
123
  type_of_document_job_was_initiated_for,
99
124
  get_rabbit,
@@ -113,16 +138,7 @@ def fail_job(id, exception_message, *, get_rabbit):
113
138
  _post_crud_hook(crud="update", document=document, get_rabbit=get_rabbit)
114
139
 
115
140
 
116
- def __patch_document_job_was_initiated_for(id, type, get_rabbit):
117
- if id and type:
118
- document = {
119
- "document_info_job_was_initiated_for": {"id": id, "type": type},
120
- "patch": {"relations": [{"key": id, "type": "hasJob"}]},
121
- }
122
- _post_crud_hook(crud="update", document=document, get_rabbit=get_rabbit)
123
-
124
-
125
- def __patch_document_job_was_initiated_for_v2(job_id, document_id, type, get_rabbit):
141
+ def __patch_document_job_was_initiated_for(job_id, document_id, type, get_rabbit):
126
142
  if id and type:
127
143
  document = {
128
144
  "document_info_job_was_initiated_for": {"id": document_id, "type": type},
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: elody
3
- Version: 0.0.179
3
+ Version: 0.0.180
4
4
  Summary: elody SDK for Python
5
5
  Author-email: Inuits <developers@inuits.eu>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -4,7 +4,7 @@ elody/client.py,sha256=VFjUUaE9edtK1XuAF5T3ayem2UEBr-Anww8AhITYLdI,8575
4
4
  elody/csv.py,sha256=7ZTqwmB4CQzqN3ddoaTOKPgFHpk2UyJte-oN2994dIg,15911
5
5
  elody/error_codes.py,sha256=7ZLY69YScCB0Ghxqf2LiCt-U_JCYA_T8jTMlIDlvv2s,4179
6
6
  elody/exceptions.py,sha256=5KSw2sPCZz3lDIJX4LiR2iL9n4m4KIil04D1d3X5rd0,968
7
- elody/job.py,sha256=wpq1dSxYxMv1Jv1hSvyxvFI1qNbRkDNghRLhndo57rU,3923
7
+ elody/job.py,sha256=0nBCxupyxpVO-aqLd7yekgR0SsREkuON-30i0VdArAs,4216
8
8
  elody/loader.py,sha256=Mr7zyP5DP5psYerf2-DnP90GiqtFlKZpcLIPD7P4pSU,5242
9
9
  elody/schemas.py,sha256=WtKdZEAX-PtEuAaRohyS3Md8H4-8yKVXMkHfCQ2SDR4,4676
10
10
  elody/util.py,sha256=3tqzRmeff3rZhvU1ceurzw06tHhSIc3h2v1IvVoPjFo,8753
@@ -40,8 +40,8 @@ tests/data.py,sha256=Q3oxduf-E3m-Z5G_p3fcs8jVy6g10I7zXKL1m94UVMI,2906
40
40
  tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
41
  tests/unit/test_csv.py,sha256=NQaOhehfQ4GuXku0Y1SA8DYjJeqqidbF50zEHAi8RZA,15923
42
42
  tests/unit/test_utils.py,sha256=g63szcEZyHhCOtrW4BnNbcgVca3oYPIOLjBdIzNwwN0,8784
43
- elody-0.0.179.dist-info/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
44
- elody-0.0.179.dist-info/METADATA,sha256=4Kb7mlZGeCFnIX6T_27wFLYSQmK0Fc3NQOAHM1B2IsQ,23336
45
- elody-0.0.179.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
46
- elody-0.0.179.dist-info/top_level.txt,sha256=E0mImupLj0KmtUUCXRYEoLDRaSkuiGaOIIseAa0oQ-M,21
47
- elody-0.0.179.dist-info/RECORD,,
43
+ elody-0.0.180.dist-info/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
44
+ elody-0.0.180.dist-info/METADATA,sha256=6bvX_huqrHIYLQqjDNL2tcDzvHCF1yCz2Up1vjxXgMw,23336
45
+ elody-0.0.180.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
46
+ elody-0.0.180.dist-info/top_level.txt,sha256=E0mImupLj0KmtUUCXRYEoLDRaSkuiGaOIIseAa0oQ-M,21
47
+ elody-0.0.180.dist-info/RECORD,,