testing-tasks-mock 0.0.3__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.
- testing_tasks_mock-0.0.3/LICENSE +28 -0
- testing_tasks_mock-0.0.3/PKG-INFO +23 -0
- testing_tasks_mock-0.0.3/README.md +8 -0
- testing_tasks_mock-0.0.3/pyproject.toml +42 -0
- testing_tasks_mock-0.0.3/setup.cfg +4 -0
- testing_tasks_mock-0.0.3/src/testing_tasks_mock/__FRACTAL_MANIFEST__.json +83 -0
- testing_tasks_mock-0.0.3/src/testing_tasks_mock/__init__.py +7 -0
- testing_tasks_mock-0.0.3/src/testing_tasks_mock/generic_task.py +43 -0
- testing_tasks_mock-0.0.3/src/testing_tasks_mock/generic_task_parallel.py +31 -0
- testing_tasks_mock-0.0.3/src/testing_tasks_mock.egg-info/PKG-INFO +23 -0
- testing_tasks_mock-0.0.3/src/testing_tasks_mock.egg-info/SOURCES.txt +12 -0
- testing_tasks_mock-0.0.3/src/testing_tasks_mock.egg-info/dependency_links.txt +1 -0
- testing_tasks_mock-0.0.3/src/testing_tasks_mock.egg-info/requires.txt +5 -0
- testing_tasks_mock-0.0.3/src/testing_tasks_mock.egg-info/top_level.txt +1 -0
|
@@ -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,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,42 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "testing-tasks-mock"
|
|
3
|
+
version = "0.0.3"
|
|
4
|
+
description = "Fake tasks package"
|
|
5
|
+
|
|
6
|
+
authors = [
|
|
7
|
+
{name="Tommaso Comparin", email="tommaso.comparin@exact-lab.it"},
|
|
8
|
+
]
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text ="BSD-3-Clause"}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
requires-python = ">=3.10"
|
|
14
|
+
dependencies = ["fractal-task-tools==0.0.12"]
|
|
15
|
+
|
|
16
|
+
[project.optional-dependencies]
|
|
17
|
+
dev = ["build", "bumpver"]
|
|
18
|
+
|
|
19
|
+
[build-system]
|
|
20
|
+
requires = ["setuptools >= 61.0"]
|
|
21
|
+
build-backend = "setuptools.build_meta"
|
|
22
|
+
|
|
23
|
+
[tool.setuptools.packages.find]
|
|
24
|
+
where = ["src"]
|
|
25
|
+
include = ["testing_tasks_mock"]
|
|
26
|
+
|
|
27
|
+
# Always include the __FRACTAL_MANIFEST__.json file in the package
|
|
28
|
+
[tool.setuptools.package-data]
|
|
29
|
+
"*" = ["__FRACTAL_MANIFEST__.json"]
|
|
30
|
+
|
|
31
|
+
[tool.bumpver]
|
|
32
|
+
current_version = "0.0.3"
|
|
33
|
+
version_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"
|
|
34
|
+
commit_message = "bump version {old_version} -> {new_version}"
|
|
35
|
+
commit = true
|
|
36
|
+
tag = true
|
|
37
|
+
push = true
|
|
38
|
+
|
|
39
|
+
[tool.bumpver.file_patterns]
|
|
40
|
+
"pyproject.toml" = ['version = "{version}"$']
|
|
41
|
+
"src/testing_tasks_mock/__init__.py" = ['__VERSION__ = "{version}"$']
|
|
42
|
+
|
|
@@ -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,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,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/testing_tasks_mock/__FRACTAL_MANIFEST__.json
|
|
5
|
+
src/testing_tasks_mock/__init__.py
|
|
6
|
+
src/testing_tasks_mock/generic_task.py
|
|
7
|
+
src/testing_tasks_mock/generic_task_parallel.py
|
|
8
|
+
src/testing_tasks_mock.egg-info/PKG-INFO
|
|
9
|
+
src/testing_tasks_mock.egg-info/SOURCES.txt
|
|
10
|
+
src/testing_tasks_mock.egg-info/dependency_links.txt
|
|
11
|
+
src/testing_tasks_mock.egg-info/requires.txt
|
|
12
|
+
src/testing_tasks_mock.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
testing_tasks_mock
|