fluidattacks_success_indicators 2.0.0__tar.gz

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.
Files changed (28) hide show
  1. fluidattacks_success_indicators-2.0.0/.envrc +2 -0
  2. fluidattacks_success_indicators-2.0.0/PKG-INFO +12 -0
  3. fluidattacks_success_indicators-2.0.0/build/default.nix +17 -0
  4. fluidattacks_success_indicators-2.0.0/build/filter.nix +12 -0
  5. fluidattacks_success_indicators-2.0.0/flake.lock +351 -0
  6. fluidattacks_success_indicators-2.0.0/flake.nix +19 -0
  7. fluidattacks_success_indicators-2.0.0/fluidattacks_success_indicators/__init__.py +20 -0
  8. fluidattacks_success_indicators-2.0.0/fluidattacks_success_indicators/_cli/__init__.py +15 -0
  9. fluidattacks_success_indicators-2.0.0/fluidattacks_success_indicators/_cli/_sub_cmds.py +115 -0
  10. fluidattacks_success_indicators-2.0.0/fluidattacks_success_indicators/_core.py +62 -0
  11. fluidattacks_success_indicators-2.0.0/fluidattacks_success_indicators/_db_client/__init__.py +17 -0
  12. fluidattacks_success_indicators-2.0.0/fluidattacks_success_indicators/_db_client/_client_1.py +252 -0
  13. fluidattacks_success_indicators-2.0.0/fluidattacks_success_indicators/_db_client/_connection.py +27 -0
  14. fluidattacks_success_indicators-2.0.0/fluidattacks_success_indicators/_db_client/_core.py +34 -0
  15. fluidattacks_success_indicators-2.0.0/fluidattacks_success_indicators/_db_client/_creds.py +41 -0
  16. fluidattacks_success_indicators-2.0.0/fluidattacks_success_indicators/_factory/__init__.py +68 -0
  17. fluidattacks_success_indicators-2.0.0/fluidattacks_success_indicators/_factory/_connection.py +64 -0
  18. fluidattacks_success_indicators-2.0.0/fluidattacks_success_indicators/_logger.py +34 -0
  19. fluidattacks_success_indicators-2.0.0/fluidattacks_success_indicators/py.typed +0 -0
  20. fluidattacks_success_indicators-2.0.0/mypy.ini +30 -0
  21. fluidattacks_success_indicators-2.0.0/pyproject.toml +37 -0
  22. fluidattacks_success_indicators-2.0.0/ruff.toml +29 -0
  23. fluidattacks_success_indicators-2.0.0/tests/__init__.py +0 -0
  24. fluidattacks_success_indicators-2.0.0/tests/arch/__init__.py +0 -0
  25. fluidattacks_success_indicators-2.0.0/tests/arch/arch.py +47 -0
  26. fluidattacks_success_indicators-2.0.0/tests/arch/test_arch.py +48 -0
  27. fluidattacks_success_indicators-2.0.0/tests/py.typed +0 -0
  28. fluidattacks_success_indicators-2.0.0/uv.lock +1303 -0
@@ -0,0 +1,2 @@
1
+ ln -f ../../common/mypy.ini ./mypy.ini
2
+ use_flake ".#python311.devShell"
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: fluidattacks_success_indicators
3
+ Version: 2.0.0
4
+ Summary: job last success reporter
5
+ Author-email: Product Team <development@fluidattacks.com>
6
+ Requires-Python: >=3.11
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Requires-Dist: click >=8.3.0, <9.0.0
9
+ Requires-Dist: fa-purity >=2.5.2, <3.0.0
10
+ Requires-Dist: fluidattacks-connection-manager >=1.0.0, <2.0.0
11
+ Requires-Dist: fluidattacks-etl-utils >=1.0.0, <2.0.0
12
+ Requires-Dist: fluidattacks-utils-logger >=1.0.0, <2.0.0
@@ -0,0 +1,17 @@
1
+ { nixpkgs, builders, scripts, src, }:
2
+ let
3
+ build_bin = bundle:
4
+ nixpkgs.writeShellApplication {
5
+ name = "success-indicators";
6
+ runtimeInputs = [ bundle.env.runtime ];
7
+ text = ''
8
+ success-indicators "''${@}"
9
+ '';
10
+ };
11
+ in {
12
+ inherit src;
13
+ root_path = "observes/job/success-indicators";
14
+ module_name = "fluidattacks_success_indicators";
15
+ pypi_token_var = "SUCCESS_INDICATORS_TOKEN";
16
+ override = bundle: bundle // { bin = build_bin bundle; };
17
+ }
@@ -0,0 +1,12 @@
1
+ path_filter: src:
2
+ path_filter {
3
+ root = src;
4
+ include = [
5
+ "fluidattacks_success_indicators"
6
+ "tests"
7
+ "pyproject.toml"
8
+ "ruff.toml"
9
+ "mypy.ini"
10
+ "uv.lock"
11
+ ];
12
+ }
@@ -0,0 +1,351 @@
1
+ {
2
+ "nodes": {
3
+ "flake-parts": {
4
+ "inputs": {
5
+ "nixpkgs-lib": "nixpkgs-lib"
6
+ },
7
+ "locked": {
8
+ "lastModified": 1754487366,
9
+ "narHash": "sha256-pHYj8gUBapuUzKV/kN/tR3Zvqc7o6gdFB9XKXIp1SQ8=",
10
+ "owner": "hercules-ci",
11
+ "repo": "flake-parts",
12
+ "rev": "af66ad14b28a127c5c0f3bbb298218fc63528a18",
13
+ "type": "github"
14
+ },
15
+ "original": {
16
+ "owner": "hercules-ci",
17
+ "repo": "flake-parts",
18
+ "type": "github"
19
+ }
20
+ },
21
+ "nix_filter": {
22
+ "locked": {
23
+ "lastModified": 1731533336,
24
+ "narHash": "sha256-oRam5PS1vcrr5UPgALW0eo1m/5/pls27Z/pabHNy2Ms=",
25
+ "owner": "numtide",
26
+ "repo": "nix-filter",
27
+ "rev": "f7653272fd234696ae94229839a99b73c9ab7de0",
28
+ "type": "github"
29
+ },
30
+ "original": {
31
+ "owner": "numtide",
32
+ "repo": "nix-filter",
33
+ "type": "github"
34
+ }
35
+ },
36
+ "nix_filter_2": {
37
+ "locked": {
38
+ "lastModified": 1731533336,
39
+ "narHash": "sha256-oRam5PS1vcrr5UPgALW0eo1m/5/pls27Z/pabHNy2Ms=",
40
+ "owner": "numtide",
41
+ "repo": "nix-filter",
42
+ "rev": "f7653272fd234696ae94229839a99b73c9ab7de0",
43
+ "type": "github"
44
+ },
45
+ "original": {
46
+ "owner": "numtide",
47
+ "repo": "nix-filter",
48
+ "type": "github"
49
+ }
50
+ },
51
+ "nixpkgs": {
52
+ "locked": {
53
+ "lastModified": 1736441877,
54
+ "narHash": "sha256-m3+PhBFkDwqo9lBplG4AyMW8P4/KcioJRS1UG8N7okM=",
55
+ "owner": "nixos",
56
+ "repo": "nixpkgs",
57
+ "rev": "ce3899414dab3297cf025bfa356dc2da426feefd",
58
+ "type": "github"
59
+ },
60
+ "original": {
61
+ "owner": "nixos",
62
+ "repo": "nixpkgs",
63
+ "type": "github"
64
+ }
65
+ },
66
+ "nixpkgs-lib": {
67
+ "locked": {
68
+ "lastModified": 1753579242,
69
+ "narHash": "sha256-zvaMGVn14/Zz8hnp4VWT9xVnhc8vuL3TStRqwk22biA=",
70
+ "owner": "nix-community",
71
+ "repo": "nixpkgs.lib",
72
+ "rev": "0f36c44e01a6129be94e3ade315a5883f0228a6e",
73
+ "type": "github"
74
+ },
75
+ "original": {
76
+ "owner": "nix-community",
77
+ "repo": "nixpkgs.lib",
78
+ "type": "github"
79
+ }
80
+ },
81
+ "nixpkgs_2": {
82
+ "locked": {
83
+ "lastModified": 1758690382,
84
+ "narHash": "sha256-NY3kSorgqE5LMm1LqNwGne3ZLMF2/ILgLpFr1fS4X3o=",
85
+ "owner": "nixos",
86
+ "repo": "nixpkgs",
87
+ "rev": "e643668fd71b949c53f8626614b21ff71a07379d",
88
+ "type": "github"
89
+ },
90
+ "original": {
91
+ "owner": "nixos",
92
+ "ref": "nixos-unstable",
93
+ "repo": "nixpkgs",
94
+ "type": "github"
95
+ }
96
+ },
97
+ "nixpkgs_3": {
98
+ "locked": {
99
+ "lastModified": 1758690382,
100
+ "narHash": "sha256-NY3kSorgqE5LMm1LqNwGne3ZLMF2/ILgLpFr1fS4X3o=",
101
+ "owner": "nixos",
102
+ "repo": "nixpkgs",
103
+ "rev": "e643668fd71b949c53f8626614b21ff71a07379d",
104
+ "type": "github"
105
+ },
106
+ "original": {
107
+ "owner": "nixos",
108
+ "ref": "nixos-unstable",
109
+ "repo": "nixpkgs",
110
+ "type": "github"
111
+ }
112
+ },
113
+ "nixpkgs_4": {
114
+ "locked": {
115
+ "lastModified": 1761373498,
116
+ "narHash": "sha256-Q/uhWNvd7V7k1H1ZPMy/vkx3F8C13ZcdrKjO7Jv7v0c=",
117
+ "owner": "nixos",
118
+ "repo": "nixpkgs",
119
+ "rev": "6a08e6bb4e46ff7fcbb53d409b253f6bad8a28ce",
120
+ "type": "github"
121
+ },
122
+ "original": {
123
+ "owner": "nixos",
124
+ "ref": "nixos-unstable",
125
+ "repo": "nixpkgs",
126
+ "type": "github"
127
+ }
128
+ },
129
+ "nixpkgs_flake": {
130
+ "locked": {
131
+ "lastModified": 1756313514,
132
+ "narHash": "sha256-3Xbak0pXR8ziNv1ghHyJ5a5Ti2kt/LWq6hKZVJTvjBs=",
133
+ "owner": "nixos",
134
+ "repo": "nixpkgs",
135
+ "rev": "181464235b2daff8725773fef43ffc9d6b02e1c2",
136
+ "type": "github"
137
+ },
138
+ "original": {
139
+ "owner": "nixos",
140
+ "repo": "nixpkgs",
141
+ "type": "github"
142
+ }
143
+ },
144
+ "observes_flake_builder": {
145
+ "inputs": {
146
+ "nix_filter": "nix_filter",
147
+ "nixpkgs_flake": "nixpkgs_flake",
148
+ "pynix_flake": "pynix_flake",
149
+ "pyproject-build-systems": "pyproject-build-systems",
150
+ "pyproject-nix": "pyproject-nix_2",
151
+ "shell-helpers": "shell-helpers",
152
+ "uv2nix": "uv2nix_2"
153
+ },
154
+ "locked": {
155
+ "dir": "observes/common/std_flake_2",
156
+ "lastModified": 1762278223,
157
+ "narHash": "sha256-MW3HitewaVFCSOpjv7+eu1xqA0rxJ6zeiQSWFl0oLJI=",
158
+ "owner": "fluidattacks",
159
+ "repo": "universe",
160
+ "rev": "41ea58333c8fbb68499a470444b6619023f74a2b",
161
+ "type": "github"
162
+ },
163
+ "original": {
164
+ "dir": "observes/common/std_flake_2",
165
+ "owner": "fluidattacks",
166
+ "repo": "universe",
167
+ "rev": "41ea58333c8fbb68499a470444b6619023f74a2b",
168
+ "type": "github"
169
+ }
170
+ },
171
+ "pynix_flake": {
172
+ "inputs": {
173
+ "nix_filter": "nix_filter_2",
174
+ "nixpkgs": "nixpkgs"
175
+ },
176
+ "locked": {
177
+ "lastModified": 1758642502,
178
+ "narHash": "sha256-PD/bQMz2dqZSkydHyvRh+jS/0qoV8SdcIVs6sassteQ=",
179
+ "owner": "dmurciaatfluid",
180
+ "repo": "python_nix_builder",
181
+ "rev": "809aafe2e1995e72c15378d099bf251b78f04a20",
182
+ "type": "gitlab"
183
+ },
184
+ "original": {
185
+ "owner": "dmurciaatfluid",
186
+ "repo": "python_nix_builder",
187
+ "type": "gitlab"
188
+ }
189
+ },
190
+ "pyproject-build-systems": {
191
+ "inputs": {
192
+ "nixpkgs": "nixpkgs_2",
193
+ "pyproject-nix": "pyproject-nix",
194
+ "uv2nix": "uv2nix"
195
+ },
196
+ "locked": {
197
+ "lastModified": 1761781027,
198
+ "narHash": "sha256-YDvxPAm2WnxrznRqWwHLjryBGG5Ey1ATEJXrON+TWt8=",
199
+ "owner": "pyproject-nix",
200
+ "repo": "build-system-pkgs",
201
+ "rev": "795a980d25301e5133eca37adae37283ec3c8e66",
202
+ "type": "github"
203
+ },
204
+ "original": {
205
+ "owner": "pyproject-nix",
206
+ "repo": "build-system-pkgs",
207
+ "type": "github"
208
+ }
209
+ },
210
+ "pyproject-nix": {
211
+ "inputs": {
212
+ "nixpkgs": [
213
+ "observes_flake_builder",
214
+ "pyproject-build-systems",
215
+ "nixpkgs"
216
+ ]
217
+ },
218
+ "locked": {
219
+ "lastModified": 1758265079,
220
+ "narHash": "sha256-amLaLNwKSZPShQHzfgmc/9o76dU8xzN0743dWgvYlr8=",
221
+ "owner": "nix-community",
222
+ "repo": "pyproject.nix",
223
+ "rev": "02e9418fd4af638447dca4b17b1280da95527fc9",
224
+ "type": "github"
225
+ },
226
+ "original": {
227
+ "owner": "nix-community",
228
+ "repo": "pyproject.nix",
229
+ "type": "github"
230
+ }
231
+ },
232
+ "pyproject-nix_2": {
233
+ "inputs": {
234
+ "nixpkgs": "nixpkgs_3"
235
+ },
236
+ "locked": {
237
+ "lastModified": 1760402624,
238
+ "narHash": "sha256-jF6UKLs2uGc2rtved8Vrt58oTWjTQoAssuYs/0578Z4=",
239
+ "owner": "pyproject-nix",
240
+ "repo": "pyproject.nix",
241
+ "rev": "84c4ea102127c77058ea1ed7be7300261fafc7d2",
242
+ "type": "github"
243
+ },
244
+ "original": {
245
+ "owner": "pyproject-nix",
246
+ "repo": "pyproject.nix",
247
+ "type": "github"
248
+ }
249
+ },
250
+ "pyproject-nix_3": {
251
+ "inputs": {
252
+ "nixpkgs": [
253
+ "observes_flake_builder",
254
+ "uv2nix",
255
+ "nixpkgs"
256
+ ]
257
+ },
258
+ "locked": {
259
+ "lastModified": 1760402624,
260
+ "narHash": "sha256-jF6UKLs2uGc2rtved8Vrt58oTWjTQoAssuYs/0578Z4=",
261
+ "owner": "pyproject-nix",
262
+ "repo": "pyproject.nix",
263
+ "rev": "84c4ea102127c77058ea1ed7be7300261fafc7d2",
264
+ "type": "github"
265
+ },
266
+ "original": {
267
+ "owner": "pyproject-nix",
268
+ "repo": "pyproject.nix",
269
+ "type": "github"
270
+ }
271
+ },
272
+ "root": {
273
+ "inputs": {
274
+ "observes_flake_builder": "observes_flake_builder"
275
+ }
276
+ },
277
+ "shell-helpers": {
278
+ "inputs": {
279
+ "flake-parts": "flake-parts",
280
+ "nixpkgs": [
281
+ "observes_flake_builder",
282
+ "nixpkgs_flake"
283
+ ]
284
+ },
285
+ "locked": {
286
+ "dir": "common/utils/shell-helpers",
287
+ "lastModified": 1752896460,
288
+ "narHash": "sha256-AsyTatXMx839cGsF6knwTrDZHk3Eue2QD3eSP7bkmpg=",
289
+ "owner": "fluidattacks",
290
+ "repo": "universe",
291
+ "rev": "27749d2c3a2b018eb010a322e5e1352f993c9e86",
292
+ "type": "github"
293
+ },
294
+ "original": {
295
+ "dir": "common/utils/shell-helpers",
296
+ "owner": "fluidattacks",
297
+ "repo": "universe",
298
+ "rev": "27749d2c3a2b018eb010a322e5e1352f993c9e86",
299
+ "type": "github"
300
+ }
301
+ },
302
+ "uv2nix": {
303
+ "inputs": {
304
+ "nixpkgs": [
305
+ "observes_flake_builder",
306
+ "pyproject-build-systems",
307
+ "nixpkgs"
308
+ ],
309
+ "pyproject-nix": [
310
+ "observes_flake_builder",
311
+ "pyproject-build-systems",
312
+ "pyproject-nix"
313
+ ]
314
+ },
315
+ "locked": {
316
+ "lastModified": 1758933732,
317
+ "narHash": "sha256-HAmm1GBS1myZCFuog0DC2ZLaynvZtiUI2Crmo+cdQI0=",
318
+ "owner": "pyproject-nix",
319
+ "repo": "uv2nix",
320
+ "rev": "273ce18f913d8559e0d04f820d724308966d7c4d",
321
+ "type": "github"
322
+ },
323
+ "original": {
324
+ "owner": "pyproject-nix",
325
+ "repo": "uv2nix",
326
+ "type": "github"
327
+ }
328
+ },
329
+ "uv2nix_2": {
330
+ "inputs": {
331
+ "nixpkgs": "nixpkgs_4",
332
+ "pyproject-nix": "pyproject-nix_3"
333
+ },
334
+ "locked": {
335
+ "lastModified": 1761872265,
336
+ "narHash": "sha256-i25GRgp2vUOebY70L3NTAgkd+Pr1hnn5xM3qHxH0ONU=",
337
+ "owner": "pyproject-nix",
338
+ "repo": "uv2nix",
339
+ "rev": "74dfb62871be152ad3673b143b0cc56105a4f3c5",
340
+ "type": "github"
341
+ },
342
+ "original": {
343
+ "owner": "pyproject-nix",
344
+ "repo": "uv2nix",
345
+ "type": "github"
346
+ }
347
+ }
348
+ },
349
+ "root": "root",
350
+ "version": 7
351
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ description = "Fluidattacks ETLs success indicators";
3
+
4
+ inputs = {
5
+ observes_flake_builder = {
6
+ url =
7
+ "github:fluidattacks/universe/41ea58333c8fbb68499a470444b6619023f74a2b?shallow=1&dir=observes/common/std_flake_2";
8
+ };
9
+ };
10
+
11
+ outputs = { self, ... }@inputs:
12
+ let
13
+ build_args = { system, python_version, nixpkgs, builders, scripts }:
14
+ import ./build {
15
+ inherit nixpkgs builders scripts;
16
+ src = import ./build/filter.nix nixpkgs.nix-filter self;
17
+ };
18
+ in { packages = inputs.observes_flake_builder.outputs.build build_args; };
19
+ }
@@ -0,0 +1,20 @@
1
+ from fa_purity import (
2
+ Unsafe,
3
+ )
4
+
5
+ from ._core import CompoundJob, IndicatorsClient, SingleJob
6
+ from ._factory import ClientFactory
7
+ from ._logger import (
8
+ set_logger,
9
+ )
10
+
11
+ __version__ = "2.0.0"
12
+
13
+ Unsafe.compute(set_logger(__name__, __version__))
14
+
15
+ __all__ = [
16
+ "ClientFactory",
17
+ "CompoundJob",
18
+ "IndicatorsClient",
19
+ "SingleJob",
20
+ ]
@@ -0,0 +1,15 @@
1
+ import click
2
+
3
+ from . import (
4
+ _sub_cmds,
5
+ )
6
+
7
+
8
+ @click.group()
9
+ def main() -> None:
10
+ # main entrypoint group
11
+ pass
12
+
13
+
14
+ main.add_command(_sub_cmds.single_job)
15
+ main.add_command(_sub_cmds.compound_job)
@@ -0,0 +1,115 @@
1
+ import inspect
2
+
3
+ import click
4
+ from fa_purity import (
5
+ Cmd,
6
+ Maybe,
7
+ ResultE,
8
+ cast_exception,
9
+ )
10
+ from fa_purity._core.utils import raise_exception
11
+ from fluidattacks_connection_manager import ConnectionConf, Databases, Roles, Warehouses
12
+ from fluidattacks_etl_utils import smash
13
+ from fluidattacks_etl_utils.bug import Bug
14
+ from fluidattacks_etl_utils.typing import (
15
+ NoReturn,
16
+ Tuple,
17
+ )
18
+ from snowflake_client import SnowflakeCredentials
19
+
20
+ from fluidattacks_success_indicators._core import CompoundJob, SingleJob
21
+ from fluidattacks_success_indicators._db_client import (
22
+ JobName,
23
+ )
24
+ from fluidattacks_success_indicators._factory import ClientFactory
25
+
26
+
27
+ def _decode_conf(
28
+ raw_warehouse: str | None,
29
+ raw_role: str | None,
30
+ raw_user: str | None,
31
+ raw_account: str | None,
32
+ raw_private_key: str | None,
33
+ ) -> ResultE[Tuple[ConnectionConf, SnowflakeCredentials]]:
34
+ warehouse = (
35
+ Maybe.from_optional(raw_warehouse)
36
+ .to_result()
37
+ .alt(lambda _: ValueError("missing warehouse"))
38
+ .alt(cast_exception)
39
+ .bind(Warehouses.from_raw)
40
+ )
41
+ role = (
42
+ Maybe.from_optional(raw_role)
43
+ .to_result()
44
+ .alt(lambda _: ValueError("missing role"))
45
+ .alt(cast_exception)
46
+ .bind(Roles.from_raw)
47
+ )
48
+ conf = smash.smash_result_2(
49
+ warehouse,
50
+ role,
51
+ ).map(
52
+ lambda t: ConnectionConf(*t, Databases.OBSERVES),
53
+ )
54
+ user = (
55
+ Maybe.from_optional(raw_user)
56
+ .to_result()
57
+ .alt(lambda _: ValueError("missing user"))
58
+ .alt(cast_exception)
59
+ )
60
+ key = (
61
+ Maybe.from_optional(raw_private_key)
62
+ .to_result()
63
+ .alt(lambda _: ValueError("missing private key"))
64
+ .alt(cast_exception)
65
+ )
66
+ account = (
67
+ Maybe.from_optional(raw_account)
68
+ .to_result()
69
+ .alt(lambda _: ValueError("missing account"))
70
+ .alt(cast_exception)
71
+ )
72
+ creds = smash.smash_result_3(user, key, account).map(lambda t: SnowflakeCredentials(*t))
73
+ return smash.smash_result_2(conf, creds)
74
+
75
+
76
+ @click.command()
77
+ @click.option("--job", type=str, required=True)
78
+ @click.option("--warehouse", type=str, required=False, envvar="SNOWFLAKE_WAREHOUSE")
79
+ @click.option("--role", type=str, required=False, envvar="SNOWFLAKE_ROLE")
80
+ @click.option("--user", type=str, required=False, envvar="SNOWFLAKE_USER")
81
+ @click.option("--account", type=str, required=False, envvar="SNOWFLAKE_ACCOUNT")
82
+ @click.option("--private-key", type=str, required=False, envvar="SNOWFLAKE_PRIVATE_KEY")
83
+ def single_job( # noqa: PLR0913
84
+ job: str,
85
+ warehouse: str | None,
86
+ role: str | None,
87
+ user: str | None,
88
+ account: str | None,
89
+ private_key: str | None,
90
+ ) -> NoReturn:
91
+ decoded_job = SingleJob.decode(job).alt(raise_exception).to_union()
92
+ if private_key is None:
93
+ cmd: Cmd[None] = ClientFactory.observes_client().update_single_job(decoded_job)
94
+ cmd.compute()
95
+ else:
96
+ conf, creds = Bug.assume_success(
97
+ "_decode_conf",
98
+ inspect.currentframe(),
99
+ (str(warehouse), str(role), str(user), str(account)),
100
+ _decode_conf(warehouse, role, user, account, private_key),
101
+ )
102
+ cmd_2: Cmd[None] = ClientFactory.custom_client(conf, creds).update_single_job(decoded_job)
103
+ cmd_2.compute()
104
+
105
+
106
+ @click.command()
107
+ @click.option("--job", type=str, required=True)
108
+ @click.option("--child", type=str, required=True)
109
+ def compound_job(job: str, child: str) -> None:
110
+ decoded_job = CompoundJob.decode(job).alt(raise_exception).to_union()
111
+ cmd: Cmd[None] = ClientFactory.observes_client().update_compound_job(
112
+ decoded_job,
113
+ JobName(child),
114
+ )
115
+ cmd.compute()
@@ -0,0 +1,62 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Callable
4
+ from dataclasses import dataclass
5
+ from enum import Enum
6
+
7
+ from fa_purity import (
8
+ Cmd,
9
+ Result,
10
+ ResultE,
11
+ )
12
+
13
+ from ._db_client import (
14
+ JobName,
15
+ )
16
+
17
+ ChildJob = JobName
18
+
19
+
20
+ class SingleJob(Enum):
21
+ batch_etl = "batch_etl"
22
+ bugsnag = "bugsnag"
23
+ ce_etl = "ce_etl"
24
+ checkly = "checkly"
25
+ cloudwatch_etl = "cloudwatch_etl"
26
+ compute_bills = "compute_bills"
27
+ delighted = "delighted"
28
+ determine_dynamo_schema = "determine_dynamo_schema"
29
+ flow_etl = "flow_etl"
30
+ gitlab_datahub = "gitlab_datahub"
31
+ gitlab_universe = "gitlab_universe"
32
+ gitlab_dora = "gitlab_dora"
33
+ sorts_lead_scoring = "sorts_lead_scoring"
34
+ timedoctor_backup = "timedoctor_backup"
35
+ timedoctor_etl = "timedoctor_etl"
36
+ zoho_crm_etl = "zoho_crm_etl"
37
+ zoho_crm_prepare = "zoho_crm_prepare"
38
+
39
+ @staticmethod
40
+ def decode(raw: str) -> ResultE[SingleJob]:
41
+ try:
42
+ return Result.success(SingleJob(raw))
43
+ except ValueError as err:
44
+ return Result.failure(err)
45
+
46
+
47
+ class CompoundJob(Enum):
48
+ code_upload = "code_upload"
49
+ code_upload_snowflake = "code_upload_snowflake"
50
+
51
+ @staticmethod
52
+ def decode(raw: str) -> ResultE[CompoundJob]:
53
+ try:
54
+ return Result.success(CompoundJob(raw))
55
+ except ValueError as err:
56
+ return Result.failure(err)
57
+
58
+
59
+ @dataclass(frozen=True)
60
+ class IndicatorsClient:
61
+ update_single_job: Callable[[SingleJob], Cmd[None]]
62
+ update_compound_job: Callable[[CompoundJob, ChildJob], Cmd[None]]
@@ -0,0 +1,17 @@
1
+ from ._client_1 import (
2
+ new_compound_job_client,
3
+ new_job_client,
4
+ )
5
+ from ._core import (
6
+ Client,
7
+ JobLastSuccess,
8
+ JobName,
9
+ )
10
+
11
+ __all__ = [
12
+ "Client",
13
+ "JobLastSuccess",
14
+ "JobName",
15
+ "new_compound_job_client",
16
+ "new_job_client",
17
+ ]