aiojournal 0.0.1__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.
@@ -0,0 +1,18 @@
1
+ # Codecov params
2
+
3
+ coverage:
4
+ status:
5
+ project:
6
+ default: false # disable the default status that measures entire project
7
+ tests:
8
+ paths:
9
+ - "tests/"
10
+ target: 70%
11
+ source:
12
+ paths:
13
+ - "scr/"
14
+ target: 75%
15
+ threshold: 0.5%
16
+ patch:
17
+ default:
18
+ enabled: no # target: 75% # new contributions should have a coverage at least equal to target
@@ -0,0 +1,12 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "github-actions"
9
+ directory: "/"
10
+ schedule:
11
+ # Check for updates to GitHub Actions every week
12
+ interval: "weekly"
@@ -0,0 +1,21 @@
1
+ name: Lint
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ lint:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v7
14
+ - uses: astral-sh/setup-uv@v7
15
+ with:
16
+ enable-cache: true
17
+ - run: uv sync --extra tests
18
+ - run: uv run ruff check
19
+ env:
20
+ RUFF_OUTPUT_FORMAT: github
21
+ - run: uv run ty check --output-format github
@@ -0,0 +1,57 @@
1
+ # This workflow will upload a Python Package using Twine when a release is created
2
+ # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3
+
4
+ # This workflow uses actions that are not certified by GitHub.
5
+ # They are provided by a third-party and are governed by
6
+ # separate terms of service, privacy policy, and support
7
+ # documentation.
8
+
9
+ name: Publish package on PyPI
10
+
11
+ on:
12
+ release:
13
+ types: [published]
14
+ workflow_dispatch:
15
+
16
+ jobs:
17
+ build:
18
+ name: Build distribution
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@v7
22
+ - name: Set up Python
23
+ uses: actions/setup-python@v7
24
+ with:
25
+ python-version: "3.x"
26
+ - name: Install hatch
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ python -m pip install hatch
30
+ - name: Build a binary wheel and a source tarball
31
+ run: hatch build
32
+ - name: Store the distribution packages
33
+ uses: actions/upload-artifact@v7
34
+ with:
35
+ name: python-package-distributions
36
+ path: dist/
37
+
38
+ pypi-publish:
39
+ name: Upload release to PyPI
40
+ needs:
41
+ - build
42
+ runs-on: ubuntu-latest
43
+ environment:
44
+ name: pypi-release
45
+ url: https://pypi.org/p/aiojournal
46
+ permissions:
47
+ id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
48
+ steps:
49
+ # retrieve your distributions here
50
+ - name: Download all the dists
51
+ uses: actions/download-artifact@v8
52
+ with:
53
+ name: python-package-distributions
54
+ path: dist/
55
+
56
+ - name: Publish package distributions to PyPI
57
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,37 @@
1
+ # PyTest workflow
2
+
3
+ name: Tests
4
+
5
+ on:
6
+ push:
7
+ branches: [main]
8
+ pull_request:
9
+ branches: [main]
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ${{ matrix.os }}
14
+ strategy:
15
+ matrix:
16
+ python-version: ["3.10", "3.14"]
17
+ os: [ ubuntu-latest, macos-latest, windows-latest ]
18
+
19
+ steps:
20
+ - uses: actions/checkout@v7
21
+
22
+ - name: Install uv
23
+ uses: astral-sh/setup-uv@v7
24
+ with:
25
+ enable-cache: true
26
+ python-version: ${{ matrix.python-version }}
27
+
28
+ - name: Install the project
29
+ run: uv sync --extra tests
30
+
31
+ - name: Run tests
32
+ run: uv run pytest tests --cov=src --cov-report=xml -n logical --durations=0 --reruns=3
33
+
34
+ #- name: Codecov
35
+ # uses: codecov/codecov-action@v5.4.0
36
+ # with:
37
+ # token: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,121 @@
1
+ Creative Commons Legal Code
2
+
3
+ CC0 1.0 Universal
4
+
5
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12
+ HEREUNDER.
13
+
14
+ Statement of Purpose
15
+
16
+ The laws of most jurisdictions throughout the world automatically confer
17
+ exclusive Copyright and Related Rights (defined below) upon the creator
18
+ and subsequent owner(s) (each and all, an "owner") of an original work of
19
+ authorship and/or a database (each, a "Work").
20
+
21
+ Certain owners wish to permanently relinquish those rights to a Work for
22
+ the purpose of contributing to a commons of creative, cultural and
23
+ scientific works ("Commons") that the public can reliably and without fear
24
+ of later claims of infringement build upon, modify, incorporate in other
25
+ works, reuse and redistribute as freely as possible in any form whatsoever
26
+ and for any purposes, including without limitation commercial purposes.
27
+ These owners may contribute to the Commons to promote the ideal of a free
28
+ culture and the further production of creative, cultural and scientific
29
+ works, or to gain reputation or greater distribution for their Work in
30
+ part through the use and efforts of others.
31
+
32
+ For these and/or other purposes and motivations, and without any
33
+ expectation of additional consideration or compensation, the person
34
+ associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35
+ is an owner of Copyright and Related Rights in the Work, voluntarily
36
+ elects to apply CC0 to the Work and publicly distribute the Work under its
37
+ terms, with knowledge of his or her Copyright and Related Rights in the
38
+ Work and the meaning and intended legal effect of CC0 on those rights.
39
+
40
+ 1. Copyright and Related Rights. A Work made available under CC0 may be
41
+ protected by copyright and related or neighboring rights ("Copyright and
42
+ Related Rights"). Copyright and Related Rights include, but are not
43
+ limited to, the following:
44
+
45
+ i. the right to reproduce, adapt, distribute, perform, display,
46
+ communicate, and translate a Work;
47
+ ii. moral rights retained by the original author(s) and/or performer(s);
48
+ iii. publicity and privacy rights pertaining to a person's image or
49
+ likeness depicted in a Work;
50
+ iv. rights protecting against unfair competition in regards to a Work,
51
+ subject to the limitations in paragraph 4(a), below;
52
+ v. rights protecting the extraction, dissemination, use and reuse of data
53
+ in a Work;
54
+ vi. database rights (such as those arising under Directive 96/9/EC of the
55
+ European Parliament and of the Council of 11 March 1996 on the legal
56
+ protection of databases, and under any national implementation
57
+ thereof, including any amended or successor version of such
58
+ directive); and
59
+ vii. other similar, equivalent or corresponding rights throughout the
60
+ world based on applicable law or treaty, and any national
61
+ implementations thereof.
62
+
63
+ 2. Waiver. To the greatest extent permitted by, but not in contravention
64
+ of, applicable law, Affirmer hereby overtly, fully, permanently,
65
+ irrevocably and unconditionally waives, abandons, and surrenders all of
66
+ Affirmer's Copyright and Related Rights and associated claims and causes
67
+ of action, whether now known or unknown (including existing as well as
68
+ future claims and causes of action), in the Work (i) in all territories
69
+ worldwide, (ii) for the maximum duration provided by applicable law or
70
+ treaty (including future time extensions), (iii) in any current or future
71
+ medium and for any number of copies, and (iv) for any purpose whatsoever,
72
+ including without limitation commercial, advertising or promotional
73
+ purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74
+ member of the public at large and to the detriment of Affirmer's heirs and
75
+ successors, fully intending that such Waiver shall not be subject to
76
+ revocation, rescission, cancellation, termination, or any other legal or
77
+ equitable action to disrupt the quiet enjoyment of the Work by the public
78
+ as contemplated by Affirmer's express Statement of Purpose.
79
+
80
+ 3. Public License Fallback. Should any part of the Waiver for any reason
81
+ be judged legally invalid or ineffective under applicable law, then the
82
+ Waiver shall be preserved to the maximum extent permitted taking into
83
+ account Affirmer's express Statement of Purpose. In addition, to the
84
+ extent the Waiver is so judged Affirmer hereby grants to each affected
85
+ person a royalty-free, non transferable, non sublicensable, non exclusive,
86
+ irrevocable and unconditional license to exercise Affirmer's Copyright and
87
+ Related Rights in the Work (i) in all territories worldwide, (ii) for the
88
+ maximum duration provided by applicable law or treaty (including future
89
+ time extensions), (iii) in any current or future medium and for any number
90
+ of copies, and (iv) for any purpose whatsoever, including without
91
+ limitation commercial, advertising or promotional purposes (the
92
+ "License"). The License shall be deemed effective as of the date CC0 was
93
+ applied by Affirmer to the Work. Should any part of the License for any
94
+ reason be judged legally invalid or ineffective under applicable law, such
95
+ partial invalidity or ineffectiveness shall not invalidate the remainder
96
+ of the License, and in such case Affirmer hereby affirms that he or she
97
+ will not (i) exercise any of his or her remaining Copyright and Related
98
+ Rights in the Work or (ii) assert any associated claims and causes of
99
+ action with respect to the Work, in either case contrary to Affirmer's
100
+ express Statement of Purpose.
101
+
102
+ 4. Limitations and Disclaimers.
103
+
104
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
105
+ surrendered, licensed or otherwise affected by this document.
106
+ b. Affirmer offers the Work as-is and makes no representations or
107
+ warranties of any kind concerning the Work, express, implied,
108
+ statutory or otherwise, including without limitation warranties of
109
+ title, merchantability, fitness for a particular purpose, non
110
+ infringement, or the absence of latent or other defects, accuracy, or
111
+ the present or absence of errors, whether or not discoverable, all to
112
+ the greatest extent permissible under applicable law.
113
+ c. Affirmer disclaims responsibility for clearing rights of other persons
114
+ that may apply to the Work or any use thereof, including without
115
+ limitation any person's Copyright and Related Rights in the Work.
116
+ Further, Affirmer disclaims responsibility for obtaining any necessary
117
+ consents, permissions or other rights required for any use of the
118
+ Work.
119
+ d. Affirmer understands and acknowledges that Creative Commons is not a
120
+ party to this document and has no duty or obligation with respect to
121
+ this CC0 or use of the Work.
@@ -0,0 +1,219 @@
1
+ Metadata-Version: 2.5
2
+ Name: aiojournal
3
+ Version: 0.0.1
4
+ Summary: Simple runner to perform batches of asynchronous tasks.
5
+ Author: Nathan Fradet
6
+ License: Creative Commons Legal Code
7
+
8
+ CC0 1.0 Universal
9
+
10
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
11
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
12
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
13
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
14
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
15
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
16
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
17
+ HEREUNDER.
18
+
19
+ Statement of Purpose
20
+
21
+ The laws of most jurisdictions throughout the world automatically confer
22
+ exclusive Copyright and Related Rights (defined below) upon the creator
23
+ and subsequent owner(s) (each and all, an "owner") of an original work of
24
+ authorship and/or a database (each, a "Work").
25
+
26
+ Certain owners wish to permanently relinquish those rights to a Work for
27
+ the purpose of contributing to a commons of creative, cultural and
28
+ scientific works ("Commons") that the public can reliably and without fear
29
+ of later claims of infringement build upon, modify, incorporate in other
30
+ works, reuse and redistribute as freely as possible in any form whatsoever
31
+ and for any purposes, including without limitation commercial purposes.
32
+ These owners may contribute to the Commons to promote the ideal of a free
33
+ culture and the further production of creative, cultural and scientific
34
+ works, or to gain reputation or greater distribution for their Work in
35
+ part through the use and efforts of others.
36
+
37
+ For these and/or other purposes and motivations, and without any
38
+ expectation of additional consideration or compensation, the person
39
+ associating CC0 with a Work (the "Affirmer"), to the extent that he or she
40
+ is an owner of Copyright and Related Rights in the Work, voluntarily
41
+ elects to apply CC0 to the Work and publicly distribute the Work under its
42
+ terms, with knowledge of his or her Copyright and Related Rights in the
43
+ Work and the meaning and intended legal effect of CC0 on those rights.
44
+
45
+ 1. Copyright and Related Rights. A Work made available under CC0 may be
46
+ protected by copyright and related or neighboring rights ("Copyright and
47
+ Related Rights"). Copyright and Related Rights include, but are not
48
+ limited to, the following:
49
+
50
+ i. the right to reproduce, adapt, distribute, perform, display,
51
+ communicate, and translate a Work;
52
+ ii. moral rights retained by the original author(s) and/or performer(s);
53
+ iii. publicity and privacy rights pertaining to a person's image or
54
+ likeness depicted in a Work;
55
+ iv. rights protecting against unfair competition in regards to a Work,
56
+ subject to the limitations in paragraph 4(a), below;
57
+ v. rights protecting the extraction, dissemination, use and reuse of data
58
+ in a Work;
59
+ vi. database rights (such as those arising under Directive 96/9/EC of the
60
+ European Parliament and of the Council of 11 March 1996 on the legal
61
+ protection of databases, and under any national implementation
62
+ thereof, including any amended or successor version of such
63
+ directive); and
64
+ vii. other similar, equivalent or corresponding rights throughout the
65
+ world based on applicable law or treaty, and any national
66
+ implementations thereof.
67
+
68
+ 2. Waiver. To the greatest extent permitted by, but not in contravention
69
+ of, applicable law, Affirmer hereby overtly, fully, permanently,
70
+ irrevocably and unconditionally waives, abandons, and surrenders all of
71
+ Affirmer's Copyright and Related Rights and associated claims and causes
72
+ of action, whether now known or unknown (including existing as well as
73
+ future claims and causes of action), in the Work (i) in all territories
74
+ worldwide, (ii) for the maximum duration provided by applicable law or
75
+ treaty (including future time extensions), (iii) in any current or future
76
+ medium and for any number of copies, and (iv) for any purpose whatsoever,
77
+ including without limitation commercial, advertising or promotional
78
+ purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
79
+ member of the public at large and to the detriment of Affirmer's heirs and
80
+ successors, fully intending that such Waiver shall not be subject to
81
+ revocation, rescission, cancellation, termination, or any other legal or
82
+ equitable action to disrupt the quiet enjoyment of the Work by the public
83
+ as contemplated by Affirmer's express Statement of Purpose.
84
+
85
+ 3. Public License Fallback. Should any part of the Waiver for any reason
86
+ be judged legally invalid or ineffective under applicable law, then the
87
+ Waiver shall be preserved to the maximum extent permitted taking into
88
+ account Affirmer's express Statement of Purpose. In addition, to the
89
+ extent the Waiver is so judged Affirmer hereby grants to each affected
90
+ person a royalty-free, non transferable, non sublicensable, non exclusive,
91
+ irrevocable and unconditional license to exercise Affirmer's Copyright and
92
+ Related Rights in the Work (i) in all territories worldwide, (ii) for the
93
+ maximum duration provided by applicable law or treaty (including future
94
+ time extensions), (iii) in any current or future medium and for any number
95
+ of copies, and (iv) for any purpose whatsoever, including without
96
+ limitation commercial, advertising or promotional purposes (the
97
+ "License"). The License shall be deemed effective as of the date CC0 was
98
+ applied by Affirmer to the Work. Should any part of the License for any
99
+ reason be judged legally invalid or ineffective under applicable law, such
100
+ partial invalidity or ineffectiveness shall not invalidate the remainder
101
+ of the License, and in such case Affirmer hereby affirms that he or she
102
+ will not (i) exercise any of his or her remaining Copyright and Related
103
+ Rights in the Work or (ii) assert any associated claims and causes of
104
+ action with respect to the Work, in either case contrary to Affirmer's
105
+ express Statement of Purpose.
106
+
107
+ 4. Limitations and Disclaimers.
108
+
109
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
110
+ surrendered, licensed or otherwise affected by this document.
111
+ b. Affirmer offers the Work as-is and makes no representations or
112
+ warranties of any kind concerning the Work, express, implied,
113
+ statutory or otherwise, including without limitation warranties of
114
+ title, merchantability, fitness for a particular purpose, non
115
+ infringement, or the absence of latent or other defects, accuracy, or
116
+ the present or absence of errors, whether or not discoverable, all to
117
+ the greatest extent permissible under applicable law.
118
+ c. Affirmer disclaims responsibility for clearing rights of other persons
119
+ that may apply to the Work or any use thereof, including without
120
+ limitation any person's Copyright and Related Rights in the Work.
121
+ Further, Affirmer disclaims responsibility for obtaining any necessary
122
+ consents, permissions or other rights required for any use of the
123
+ Work.
124
+ d. Affirmer understands and acknowledges that Creative Commons is not a
125
+ party to this document and has no duty or obligation with respect to
126
+ this CC0 or use of the Work.
127
+ License-File: LICENSE
128
+ Keywords: asyncio,batch-processing,concurrency,journaling
129
+ Classifier: Intended Audience :: Developers
130
+ Classifier: Operating System :: OS Independent
131
+ Classifier: Programming Language :: Python
132
+ Classifier: Programming Language :: Python :: 3 :: Only
133
+ Classifier: Programming Language :: Python :: 3.10
134
+ Classifier: Programming Language :: Python :: 3.11
135
+ Classifier: Programming Language :: Python :: 3.12
136
+ Classifier: Programming Language :: Python :: 3.13
137
+ Classifier: Programming Language :: Python :: 3.14
138
+ Requires-Python: >=3.10.0
139
+ Requires-Dist: tqdm
140
+ Provides-Extra: tests
141
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'tests'
142
+ Requires-Dist: pytest-cov>=5; extra == 'tests'
143
+ Requires-Dist: pytest-rerunfailures>=14; extra == 'tests'
144
+ Requires-Dist: pytest-xdist>=3; extra == 'tests'
145
+ Requires-Dist: pytest>=8; extra == 'tests'
146
+ Requires-Dist: ruff>=0.12; extra == 'tests'
147
+ Requires-Dist: ty>=0.0.66; extra == 'tests'
148
+ Description-Content-Type: text/markdown
149
+
150
+ # aiojournal
151
+
152
+ An asynchronous batch execution runner with results persistence and resumability.
153
+
154
+ Especially useful when making concurrent API calls while directly saving each request's result, for example when benchmarking LLM models, from big providers or inference engines.
155
+ It is minimal and lightweight, only dependency is [tqdm](https://github.com/tqdm/tqdm).
156
+
157
+ ```bash
158
+ pip install aiojournal
159
+ ```
160
+
161
+ ## Example
162
+
163
+ ```python
164
+ import asyncio
165
+ from pathlib import Path
166
+
167
+ from aiojournal import AsyncBatchRunner
168
+
169
+
170
+ async def describe(value: int) -> dict[str, int | str]:
171
+ await asyncio.sleep(0.1)
172
+ return {
173
+ "result": value * 2,
174
+ "input": value,
175
+ "parity": "even" if value % 2 == 0 else "odd",
176
+ }
177
+
178
+
179
+ async def main() -> None:
180
+ runner = AsyncBatchRunner(
181
+ max_concurrency=2,
182
+ results_file_path=Path("tasks.csv"),
183
+ )
184
+ results = await runner.map(
185
+ describe,
186
+ args_list=[{"value": 1}, {"value": 2}, {"value": 3}],
187
+ task_ids=["one", "two", "three"],
188
+ )
189
+ # {"result": 2, "input": 1, "parity": "odd"}
190
+ # {"result": 4, "input": 2, "parity": "even"}
191
+ # {"result": 6, "input": 3, "parity": "odd"}
192
+
193
+
194
+ asyncio.run(main())
195
+ ```
196
+
197
+
198
+ Each task appends a row to `tasks.csv`. The journal can be read without loading the whole file:
199
+
200
+ ```python
201
+ for result in runner.read_results_csv():
202
+ print(result["task_id"], result["success"], result["result"])
203
+ ```
204
+
205
+ And will look like this (with different timestamps and durations):
206
+
207
+ ```csv
208
+ task_id,start_time,end_time,duration_seconds,success,result,error,input,parity
209
+ one,2026-08-23T16:00:00+00:00,2026-08-23T16:00:00.100000+00:00,0.1000,True,2,,1,odd
210
+ two,2026-08-23T16:00:00+00:00,2026-08-23T16:00:00.100000+00:00,0.1000,True,4,,2,even
211
+ three,2026-08-23T16:00:00.100000+00:00,2026-08-23T16:00:00.200000+00:00,0.1000,True,6,,3,odd
212
+ ```
213
+
214
+ Columns names are inferred from the dictionary returned by the function provided to the
215
+ `map` method. The function may also return plain text, which in this case will be
216
+ written in a `result` column.
217
+
218
+ By default, if a task fails, `map` and `gather` returns/saves it's exception while
219
+ running the rest of the batch.
@@ -0,0 +1,70 @@
1
+ # aiojournal
2
+
3
+ An asynchronous batch execution runner with results persistence and resumability.
4
+
5
+ Especially useful when making concurrent API calls while directly saving each request's result, for example when benchmarking LLM models, from big providers or inference engines.
6
+ It is minimal and lightweight, only dependency is [tqdm](https://github.com/tqdm/tqdm).
7
+
8
+ ```bash
9
+ pip install aiojournal
10
+ ```
11
+
12
+ ## Example
13
+
14
+ ```python
15
+ import asyncio
16
+ from pathlib import Path
17
+
18
+ from aiojournal import AsyncBatchRunner
19
+
20
+
21
+ async def describe(value: int) -> dict[str, int | str]:
22
+ await asyncio.sleep(0.1)
23
+ return {
24
+ "result": value * 2,
25
+ "input": value,
26
+ "parity": "even" if value % 2 == 0 else "odd",
27
+ }
28
+
29
+
30
+ async def main() -> None:
31
+ runner = AsyncBatchRunner(
32
+ max_concurrency=2,
33
+ results_file_path=Path("tasks.csv"),
34
+ )
35
+ results = await runner.map(
36
+ describe,
37
+ args_list=[{"value": 1}, {"value": 2}, {"value": 3}],
38
+ task_ids=["one", "two", "three"],
39
+ )
40
+ # {"result": 2, "input": 1, "parity": "odd"}
41
+ # {"result": 4, "input": 2, "parity": "even"}
42
+ # {"result": 6, "input": 3, "parity": "odd"}
43
+
44
+
45
+ asyncio.run(main())
46
+ ```
47
+
48
+
49
+ Each task appends a row to `tasks.csv`. The journal can be read without loading the whole file:
50
+
51
+ ```python
52
+ for result in runner.read_results_csv():
53
+ print(result["task_id"], result["success"], result["result"])
54
+ ```
55
+
56
+ And will look like this (with different timestamps and durations):
57
+
58
+ ```csv
59
+ task_id,start_time,end_time,duration_seconds,success,result,error,input,parity
60
+ one,2026-08-23T16:00:00+00:00,2026-08-23T16:00:00.100000+00:00,0.1000,True,2,,1,odd
61
+ two,2026-08-23T16:00:00+00:00,2026-08-23T16:00:00.100000+00:00,0.1000,True,4,,2,even
62
+ three,2026-08-23T16:00:00.100000+00:00,2026-08-23T16:00:00.200000+00:00,0.1000,True,6,,3,odd
63
+ ```
64
+
65
+ Columns names are inferred from the dictionary returned by the function provided to the
66
+ `map` method. The function may also return plain text, which in this case will be
67
+ written in a `result` column.
68
+
69
+ By default, if a task fails, `map` and `gather` returns/saves it's exception while
70
+ running the rest of the batch.