datasette-enrichments-slow 0.2__py3-none-any.whl → 0.3__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- datasette_enrichments_slow/__init__.py +16 -0
- {datasette_enrichments_slow-0.2.dist-info → datasette_enrichments_slow-0.3.dist-info}/METADATA +2 -2
- datasette_enrichments_slow-0.3.dist-info/RECORD +7 -0
- datasette_enrichments_slow-0.2.dist-info/RECORD +0 -7
- {datasette_enrichments_slow-0.2.dist-info → datasette_enrichments_slow-0.3.dist-info}/LICENSE +0 -0
- {datasette_enrichments_slow-0.2.dist-info → datasette_enrichments_slow-0.3.dist-info}/WHEEL +0 -0
- {datasette_enrichments_slow-0.2.dist-info → datasette_enrichments_slow-0.3.dist-info}/entry_points.txt +0 -0
- {datasette_enrichments_slow-0.2.dist-info → datasette_enrichments_slow-0.3.dist-info}/top_level.txt +0 -0
@@ -31,6 +31,16 @@ class SlowEnrichment(Enrichment):
|
|
31
31
|
description="What portion of rows should be errors? Between 0 and 1.0",
|
32
32
|
default=0,
|
33
33
|
)
|
34
|
+
pause_rate = FloatField(
|
35
|
+
"Pause rate",
|
36
|
+
description="Chance an item should pause the run, 0 to 1.0",
|
37
|
+
default=0,
|
38
|
+
)
|
39
|
+
cancel_rate = FloatField(
|
40
|
+
"Cancel rate",
|
41
|
+
description="Chance an item should cancel the run, 0 to 1.0",
|
42
|
+
default=0,
|
43
|
+
)
|
34
44
|
|
35
45
|
return ConfigForm
|
36
46
|
|
@@ -43,7 +53,13 @@ class SlowEnrichment(Enrichment):
|
|
43
53
|
config,
|
44
54
|
):
|
45
55
|
error_rate = config.get("error_rate") or 0
|
56
|
+
cancel_rate = config.get("cancel_rate") or 0
|
57
|
+
pause_rate = config.get("pause_rate") or 0
|
46
58
|
for row in rows:
|
47
59
|
if error_rate and random.random() < error_rate:
|
48
60
|
raise ValueError("Error rate")
|
61
|
+
if cancel_rate and random.random() < cancel_rate:
|
62
|
+
raise self.Cancel()
|
63
|
+
if pause_rate and random.random() < pause_rate:
|
64
|
+
raise self.Pause()
|
49
65
|
await asyncio.sleep(config["delay"])
|
{datasette_enrichments_slow-0.2.dist-info → datasette_enrichments_slow-0.3.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: datasette-enrichments-slow
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.3
|
4
4
|
Summary: An enrichment on a slow loop to help debug progress bars
|
5
5
|
Author: Simon Willison
|
6
6
|
License: Apache-2.0
|
@@ -14,7 +14,7 @@ Requires-Python: >=3.9
|
|
14
14
|
Description-Content-Type: text/markdown
|
15
15
|
License-File: LICENSE
|
16
16
|
Requires-Dist: datasette
|
17
|
-
Requires-Dist: datasette-enrichments
|
17
|
+
Requires-Dist: datasette-enrichments>=0.5
|
18
18
|
Provides-Extra: test
|
19
19
|
Requires-Dist: pytest; extra == "test"
|
20
20
|
Requires-Dist: pytest-asyncio; extra == "test"
|
@@ -0,0 +1,7 @@
|
|
1
|
+
datasette_enrichments_slow/__init__.py,sha256=oLtRUwe3rzp8KX1mu1BLwST_f53Lb2BtwNrQ90aQRMg,1962
|
2
|
+
datasette_enrichments_slow-0.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
3
|
+
datasette_enrichments_slow-0.3.dist-info/METADATA,sha256=DTBKLQUV1pLjRCwr83jVltX6UfmD7_FAVZfXGrpLpjc,2298
|
4
|
+
datasette_enrichments_slow-0.3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
5
|
+
datasette_enrichments_slow-0.3.dist-info/entry_points.txt,sha256=cvHA2Xq1fpH6lmAljMedKADFzSa_4Lj7Px38hCoqHDQ,58
|
6
|
+
datasette_enrichments_slow-0.3.dist-info/top_level.txt,sha256=o-W1XO60TGFcagSJ9HljP25g_m1q_qnZxSJ9ftY70XQ,27
|
7
|
+
datasette_enrichments_slow-0.3.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
datasette_enrichments_slow/__init__.py,sha256=cPnIhtqLPq6mcohBVryJfHFa32WYM3DssRUwgDCp5pY,1292
|
2
|
-
datasette_enrichments_slow-0.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
3
|
-
datasette_enrichments_slow-0.2.dist-info/METADATA,sha256=ynTMyO8aqfOJFMOzJlVkJYzYxKhjNMeimK-2fpJJpd8,2293
|
4
|
-
datasette_enrichments_slow-0.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
5
|
-
datasette_enrichments_slow-0.2.dist-info/entry_points.txt,sha256=cvHA2Xq1fpH6lmAljMedKADFzSa_4Lj7Px38hCoqHDQ,58
|
6
|
-
datasette_enrichments_slow-0.2.dist-info/top_level.txt,sha256=o-W1XO60TGFcagSJ9HljP25g_m1q_qnZxSJ9ftY70XQ,27
|
7
|
-
datasette_enrichments_slow-0.2.dist-info/RECORD,,
|
{datasette_enrichments_slow-0.2.dist-info → datasette_enrichments_slow-0.3.dist-info}/LICENSE
RENAMED
File without changes
|
File without changes
|
File without changes
|
{datasette_enrichments_slow-0.2.dist-info → datasette_enrichments_slow-0.3.dist-info}/top_level.txt
RENAMED
File without changes
|