testing-tasks-mock 0.0.3__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.
@@ -0,0 +1,83 @@
1
+ {
2
+ "manifest_version": "2",
3
+ "task_list": [
4
+ {
5
+ "name": "generic_task",
6
+ "type": "non_parallel",
7
+ "executable_non_parallel": "generic_task.py",
8
+ "args_schema_non_parallel": {
9
+ "additionalProperties": false,
10
+ "properties": {
11
+ "zarr_urls": {
12
+ "items": {
13
+ "type": "string"
14
+ },
15
+ "title": "Zarr Urls",
16
+ "type": "array",
17
+ "description": "description"
18
+ },
19
+ "zarr_dir": {
20
+ "title": "Zarr Dir",
21
+ "type": "string",
22
+ "description": "description"
23
+ },
24
+ "sleep_time": {
25
+ "default": 1,
26
+ "title": "Sleep Time",
27
+ "type": "integer",
28
+ "description": "Time to sleep, in seconds"
29
+ },
30
+ "raise_error": {
31
+ "default": false,
32
+ "title": "Raise Error",
33
+ "type": "boolean",
34
+ "description": "If true, the task raises a ValueError"
35
+ }
36
+ },
37
+ "required": [
38
+ "zarr_urls",
39
+ "zarr_dir"
40
+ ],
41
+ "type": "object",
42
+ "title": "GenericTask"
43
+ },
44
+ "docs_info": "## generic_task\nDummy task description.\n"
45
+ },
46
+ {
47
+ "name": "generic_task_parallel",
48
+ "input_types": {
49
+ "my_type": false
50
+ },
51
+ "output_types": {
52
+ "my_type": true
53
+ },
54
+ "type": "parallel",
55
+ "executable_parallel": "generic_task_parallel.py",
56
+ "args_schema_parallel": {
57
+ "additionalProperties": false,
58
+ "properties": {
59
+ "zarr_url": {
60
+ "title": "Zarr Url",
61
+ "type": "string",
62
+ "description": "Missing description"
63
+ },
64
+ "sleep_time": {
65
+ "default": 0.0,
66
+ "title": "Sleep Time",
67
+ "type": "number",
68
+ "description": "Missing description"
69
+ }
70
+ },
71
+ "required": [
72
+ "zarr_url"
73
+ ],
74
+ "type": "object",
75
+ "title": "GenericTaskParallel"
76
+ },
77
+ "docs_info": "## generic_task_parallel\nDummy task description.\n"
78
+ }
79
+ ],
80
+ "has_args_schemas": true,
81
+ "args_schema_version": "pydantic_v2",
82
+ "authors": "name1 surname1, name2 surname2"
83
+ }
@@ -0,0 +1,7 @@
1
+ import logging
2
+
3
+ logging.basicConfig(
4
+ level=logging.INFO, format="%(asctime)s; %(levelname)s; %(message)s"
5
+ )
6
+
7
+ __VERSION__ = "0.0.3"
@@ -0,0 +1,43 @@
1
+ # Importing fractal_tasks_mock is only to load __init__.py
2
+ import logging
3
+ import time
4
+
5
+ from pydantic import validate_call
6
+
7
+
8
+ @validate_call
9
+ def generic_task(
10
+ *,
11
+ zarr_urls: list[str],
12
+ zarr_dir: str,
13
+ sleep_time: int = 1,
14
+ raise_error: bool = False,
15
+ ) -> dict:
16
+ """
17
+ Dummy task description.
18
+
19
+ Arguments:
20
+ zarr_urls: description
21
+ zarr_dir: description
22
+ sleep_time: Time to sleep, in seconds
23
+ raise_error: If true, the task raises a ValueError
24
+ """
25
+
26
+ logging.warning("[generic_task] START")
27
+ logging.warning(f"[generic_task] {sleep_time=}")
28
+ logging.warning(f"[generic_task] {raise_error=}")
29
+
30
+ logging.warning(f"[generic_task] Now sleep for {sleep_time} seconds")
31
+ time.sleep(sleep_time)
32
+ logging.warning(f"[generic_task] I slept for {sleep_time} seconds")
33
+
34
+ if raise_error:
35
+ logging.error("[generic_task] I will now raise an error!")
36
+ raise ValueError("This is the error message")
37
+ logging.warning("[generic_task] END")
38
+
39
+
40
+ if __name__ == "__main__":
41
+ from fractal_task_tools.task_wrapper import run_fractal_task
42
+
43
+ run_fractal_task(task_function=generic_task)
@@ -0,0 +1,31 @@
1
+ import logging
2
+ import time
3
+
4
+ from pydantic import validate_call
5
+
6
+
7
+ @validate_call
8
+ def generic_task_parallel(
9
+ *,
10
+ zarr_url: str,
11
+ sleep_time: float = 0.0,
12
+ ) -> dict:
13
+ """
14
+ Dummy task description.
15
+
16
+ Arguments:
17
+ zarr_dir: description
18
+ """
19
+
20
+ logging.info("[generic_task_parallel] START")
21
+ logging.info(f"[generic_task_parallel] Sleep {sleep_time} seconds")
22
+ time.sleep(sleep_time)
23
+ logging.info("[generic_task_parallel] Do nothing and return None")
24
+ logging.info("[generic_task_parallel] END")
25
+ return None
26
+
27
+
28
+ if __name__ == "__main__":
29
+ from fractal_task_tools.task_wrapper import run_fractal_task
30
+
31
+ run_fractal_task(task_function=generic_task_parallel)
@@ -0,0 +1,23 @@
1
+ Metadata-Version: 2.4
2
+ Name: testing-tasks-mock
3
+ Version: 0.0.3
4
+ Summary: Fake tasks package
5
+ Author-email: Tommaso Comparin <tommaso.comparin@exact-lab.it>
6
+ License: BSD-3-Clause
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: fractal-task-tools==0.0.12
11
+ Provides-Extra: dev
12
+ Requires-Dist: build; extra == "dev"
13
+ Requires-Dist: bumpver; extra == "dev"
14
+ Dynamic: license-file
15
+
16
+
17
+
18
+ ## How to make a release
19
+ From the development environment:
20
+ ```
21
+ bumpver update --patch --dry
22
+ ```
23
+
@@ -0,0 +1,9 @@
1
+ testing_tasks_mock/__FRACTAL_MANIFEST__.json,sha256=5MBfZlZuE8L-FtV8GHeoTlpKPilF9pLwyh3G_tYvWws,2234
2
+ testing_tasks_mock/__init__.py,sha256=UPDvhhXqsbgA_DQqQZSXm9qnKDBqhzYi-q4tFeM8bak,135
3
+ testing_tasks_mock/generic_task.py,sha256=s75C0FmV3RP3fxyV9byIKb3yTEzf9zA6elOJJRQFh7s,1156
4
+ testing_tasks_mock/generic_task_parallel.py,sha256=HQU7eSdUar2NOQ3R8nNt0MSOxfc9a-Nn4U4MM8S89V0,701
5
+ testing_tasks_mock-0.0.3.dist-info/licenses/LICENSE,sha256=qFsqSJZClXyQaJsBNnV55bEssqgt0R1Arf_nxCkejmo,1494
6
+ testing_tasks_mock-0.0.3.dist-info/METADATA,sha256=PyyDvp2kknG_m6B_Tvl5qNiDsZ86RrA7-iH1f3bXGAw,521
7
+ testing_tasks_mock-0.0.3.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
8
+ testing_tasks_mock-0.0.3.dist-info/top_level.txt,sha256=kDPUZ-a53wMCOM2UuUTZoX3RWLxouApGa_lLgMMiQqs,19
9
+ testing_tasks_mock-0.0.3.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (79.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2025, Fractal
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1 @@
1
+ testing_tasks_mock