zrb 0.24.0__py3-none-any.whl → 0.26.2__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.
- zrb/action/runner.py +8 -5
- zrb/advertisement.py +1 -2
- zrb/builtin/__init__.py +4 -0
- zrb/builtin/base64/decode.py +1 -1
- zrb/builtin/base64/encode.py +1 -1
- zrb/builtin/devtool/install/_helper.py +2 -1
- zrb/builtin/docker/prune.py +11 -3
- zrb/builtin/env/get.py +3 -2
- zrb/builtin/eval.py +2 -1
- zrb/builtin/git/get_file_changes.py +2 -1
- zrb/builtin/md5/hash.py +1 -1
- zrb/builtin/md5/sum.py +1 -1
- zrb/builtin/monorepo/__init__.py +7 -0
- zrb/builtin/monorepo/_common.sh +15 -0
- zrb/builtin/monorepo/_config.py +11 -0
- zrb/builtin/monorepo/_group.py +3 -0
- zrb/builtin/monorepo/_helper.py +140 -0
- zrb/builtin/monorepo/_task.py +126 -0
- zrb/builtin/monorepo/add-subrepo.sh +22 -0
- zrb/builtin/monorepo/add.py +48 -0
- zrb/builtin/monorepo/pull-monorepo.sh +18 -0
- zrb/builtin/monorepo/pull-subrepo.sh +18 -0
- zrb/builtin/monorepo/pull.py +24 -0
- zrb/builtin/monorepo/push-monorepo.sh +18 -0
- zrb/builtin/monorepo/push-subrepo.sh +18 -0
- zrb/builtin/monorepo/push.py +24 -0
- zrb/builtin/project/_helper.py +3 -3
- zrb/builtin/project/_input.py +2 -2
- zrb/builtin/project/add/app/generator/generator.py +1 -1
- zrb/builtin/project/add/app/generator/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/snake_zrb_generator_name/snake_zrb_generator_name.py +1 -1
- zrb/builtin/project/add/app/generator/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/snake_zrb_generator_name/template/_automate/snake_zrb_app_name/container/remove.py +1 -1
- zrb/builtin/project/add/app/generator/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/snake_zrb_generator_name/template/_automate/snake_zrb_app_name/container/start.py +1 -1
- zrb/builtin/project/add/app/generator/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/snake_zrb_generator_name/template/_automate/snake_zrb_app_name/container/stop.py +1 -1
- zrb/builtin/project/add/app/generator/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/snake_zrb_generator_name/template/src/kebab-zrb-app-name/docker-compose.yml +0 -2
- zrb/builtin/project/add/app/python/python.py +1 -1
- zrb/builtin/project/add/app/python/template/_automate/snake_zrb_app_name/container/remove.py +1 -1
- zrb/builtin/project/add/app/python/template/_automate/snake_zrb_app_name/container/start.py +1 -1
- zrb/builtin/project/add/app/python/template/_automate/snake_zrb_app_name/container/stop.py +1 -1
- zrb/builtin/project/add/app/python/template/src/kebab-zrb-app-name/docker-compose.yml +0 -2
- zrb/builtin/project/add/fastapp/app/app.py +3 -1
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/_helper.py +1 -1
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/_service_config.py +1 -1
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/microservices/_helper.py +2 -2
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/monolith/_helper.py +2 -2
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/stop.py +2 -0
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/container/support/_helper.py +5 -3
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/frontend/build-once.sh +1 -1
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/frontend/build.sh +1 -1
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/microservices/_helper.py +3 -5
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/microservices/start.py +3 -3
- zrb/builtin/project/add/fastapp/app/template/_automate/snake_zrb_app_name/microservices/{start_microservices.py → start_services.py} +2 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/.generator-version +1 -0
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/deployment/_common.py +5 -5
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/deployment/app_helper.py +5 -5
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/docker-compose.yml +2 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/error.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/messagebus/kafka/admin.py +4 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/messagebus/kafka/consumer.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/messagebus/messagebus.py +4 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/messagebus/mock.py +4 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/messagebus/rabbitmq/admin.py +4 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/messagebus/rabbitmq/consumer.py +3 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/model/repo_model.py +3 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/repo/db_repo.py +7 -6
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/repo/repo.py +2 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/repo/search_filter.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/rpc/messagebus/caller.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/rpc/messagebus/server.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/rpc/rpc.py +3 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/component/serializer/serializer.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/config.py +3 -4
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/frontend/package-lock.json +4443 -0
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/helper/async_task.py +1 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/component/access_token/scheme.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/component/access_token/util.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/entity/group/repo.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/entity/group/rpc.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/entity/permission/rpc.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/entity/user/api.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/entity/user/model.py +3 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/entity/user/repo.py +3 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/entity/user/rpc.py +3 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/register_permission.py +2 -2
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/schema/group.py +3 -5
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/schema/permission.py +1 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/schema/request.py +1 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/auth/schema/user.py +5 -7
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/log/entity/activity/event.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/log/entity/activity/rpc.py +2 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/src/module/log/schema/activity.py +1 -3
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/test/auth/test_group_crud.py +1 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/test/auth/test_permission_crud.py +1 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/test/auth/test_user_crud.py +1 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/test/auth/test_user_login.py +1 -1
- zrb/builtin/project/add/fastapp/app/template/src/kebab-zrb-app-name/test/test_liveness_and_readiness.py +1 -1
- zrb/builtin/project/add/fastapp/crud/_task_factory.py +1 -2
- zrb/builtin/project/add/fastapp/crud/crud.py +1 -1
- zrb/builtin/project/add/fastapp/crud/nodejs/codemod/package-lock.json +3 -3
- zrb/builtin/project/add/fastapp/crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/entity/snake_zrb_entity_name/rpc.py +2 -1
- zrb/builtin/project/add/fastapp/crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/schema/snake_zrb_entity_name.py +2 -2
- zrb/builtin/project/add/fastapp/crud/template/src/kebab-zrb-app-name/test/snake_zrb_module_name/test_snake_zrb_entity_name.py +1 -1
- zrb/builtin/project/add/fastapp/field/field.py +1 -1
- zrb/builtin/project/add/fastapp/module/_helper/create_microservice_config.py +7 -8
- zrb/builtin/project/add/fastapp/module/module.py +1 -1
- zrb/builtin/project/add/plugin/plugin.py +1 -1
- zrb/builtin/project/add/project_task/add.py +1 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/build.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/container/remove.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/container/start.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/container/stop.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/deploy.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/destroy.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/get_env.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/image/build.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/image/push.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/publish.py +2 -1
- zrb/builtin/project/add/project_task/template/_automate/_project/start.py +2 -1
- zrb/builtin/project/add/task/cmd/add.py +1 -1
- zrb/builtin/project/add/task/docker_compose/add.py +1 -1
- zrb/builtin/project/add/task/docker_compose/template/src/kebab-zrb-task-name/docker-compose.yml +0 -2
- zrb/builtin/project/add/task/python/add.py +1 -1
- zrb/builtin/project/add/task/python/template/_automate/snake_zrb_task_name.py +1 -1
- zrb/builtin/project/create/_helper.py +1 -1
- zrb/builtin/project/create/create.py +1 -1
- zrb/builtin/say.py +3 -3
- zrb/builtin/version.py +2 -1
- zrb/config/config.py +12 -2
- zrb/helper/accessories/color.py +2 -1
- zrb/helper/advertisement.py +2 -1
- zrb/helper/asyncio_task.py +26 -0
- zrb/helper/callable.py +2 -1
- zrb/helper/cli.py +16 -3
- zrb/helper/codemod/add_import_module.py +3 -2
- zrb/helper/codemod/add_property_to_class.py +2 -1
- zrb/helper/default_env.py +2 -1
- zrb/helper/docker_compose/fetch_external_env.py +4 -2
- zrb/helper/docker_compose/file.py +3 -1
- zrb/helper/env_map/fetch.py +3 -2
- zrb/helper/file/copy_tree.py +2 -1
- zrb/helper/file/match.py +2 -2
- zrb/helper/git/detect_changes.py +1 -1
- zrb/helper/loader/load_module.py +7 -46
- zrb/helper/loader/load_script.py +57 -0
- zrb/helper/map/conversion.py +3 -1
- zrb/helper/string/jinja.py +2 -1
- zrb/helper/string/parse_replacement.py +1 -1
- zrb/helper/typing.py +5 -27
- zrb/helper/util.py +1 -1
- zrb/task/any_task.py +9 -17
- zrb/task/any_task_event_handler.py +3 -1
- zrb/task/base_remote_cmd_task.py +3 -10
- zrb/task/base_task/base_task.py +12 -8
- zrb/task/base_task/component/base_task_model.py +6 -13
- zrb/task/base_task/component/common_task_model.py +15 -22
- zrb/task/base_task/component/renderer.py +3 -1
- zrb/task/base_task/component/trackers.py +1 -1
- zrb/task/checker.py +2 -1
- zrb/task/cmd_task.py +6 -18
- zrb/task/decorator.py +3 -1
- zrb/task/docker_compose_start_task.py +27 -32
- zrb/task/docker_compose_task.py +27 -35
- zrb/task/flow_task.py +19 -18
- zrb/task/http_checker.py +3 -9
- zrb/task/looper.py +4 -2
- zrb/task/notifier.py +3 -1
- zrb/task/parallel.py +4 -4
- zrb/task/path_checker.py +6 -12
- zrb/task/path_watcher.py +5 -13
- zrb/task/port_checker.py +3 -9
- zrb/task/recurring_task.py +5 -4
- zrb/task/remote_cmd_task.py +2 -1
- zrb/task/resource_maker.py +6 -13
- zrb/task/rsync_task.py +3 -1
- zrb/task/server.py +13 -12
- zrb/task/time_watcher.py +3 -10
- zrb/task/watcher.py +2 -1
- zrb/task/wiki_task.py +4 -3
- zrb/task_env/env.py +2 -1
- zrb/task_env/env_file.py +7 -6
- zrb/task_group/group.py +8 -7
- zrb/task_input/any_input.py +4 -3
- zrb/task_input/base_input.py +5 -3
- zrb/task_input/bool_input.py +2 -1
- zrb/task_input/choice_input.py +3 -1
- zrb/task_input/float_input.py +2 -1
- zrb/task_input/int_input.py +2 -1
- zrb/task_input/multiline_input.py +3 -1
- zrb/task_input/password_input.py +2 -1
- zrb/task_input/str_input.py +2 -1
- {zrb-0.24.0.dist-info → zrb-0.26.2.dist-info}/METADATA +1 -1
- {zrb-0.24.0.dist-info → zrb-0.26.2.dist-info}/RECORD +194 -176
- {zrb-0.24.0.dist-info → zrb-0.26.2.dist-info}/LICENSE +0 -0
- {zrb-0.24.0.dist-info → zrb-0.26.2.dist-info}/WHEEL +0 -0
- {zrb-0.24.0.dist-info → zrb-0.26.2.dist-info}/entry_points.txt +0 -0
zrb/task/base_remote_cmd_task.py
CHANGED
@@ -1,19 +1,12 @@
|
|
1
1
|
import os
|
2
2
|
import pathlib
|
3
|
+
from collections.abc import Callable, Iterable, Mapping
|
4
|
+
from typing import Any, Optional, TypeVar, Union
|
3
5
|
|
4
6
|
from zrb.helper.accessories.color import colored
|
5
7
|
from zrb.helper.log import logger
|
6
8
|
from zrb.helper.typecheck import typechecked
|
7
|
-
from zrb.helper.typing import
|
8
|
-
Any,
|
9
|
-
Callable,
|
10
|
-
Iterable,
|
11
|
-
JinjaTemplate,
|
12
|
-
Mapping,
|
13
|
-
Optional,
|
14
|
-
TypeVar,
|
15
|
-
Union,
|
16
|
-
)
|
9
|
+
from zrb.helper.typing import JinjaTemplate
|
17
10
|
from zrb.helper.util import to_snake_case
|
18
11
|
from zrb.task.any_task import AnyTask
|
19
12
|
from zrb.task.any_task_event_handler import (
|
zrb/task/base_task/base_task.py
CHANGED
@@ -2,6 +2,8 @@ import asyncio
|
|
2
2
|
import copy
|
3
3
|
import os
|
4
4
|
import shutil
|
5
|
+
from collections.abc import Callable, Iterable, Mapping
|
6
|
+
from typing import Any, Optional, Union
|
5
7
|
|
6
8
|
from zrb.advertisement import advertisements
|
7
9
|
from zrb.config.config import SHOW_ADVERTISEMENT, TMP_DIR
|
@@ -12,7 +14,6 @@ from zrb.helper.map.conversion import to_str as map_to_str
|
|
12
14
|
from zrb.helper.string.conversion import to_variable_name
|
13
15
|
from zrb.helper.string.modification import double_quote
|
14
16
|
from zrb.helper.typecheck import typechecked
|
15
|
-
from zrb.helper.typing import Any, Callable, Iterable, List, Mapping, Optional, Union
|
16
17
|
from zrb.task.any_task import AnyTask
|
17
18
|
from zrb.task.any_task_event_handler import (
|
18
19
|
OnFailed,
|
@@ -41,14 +42,14 @@ class BaseTask(FinishTracker, AttemptTracker, Renderer, BaseTaskModel, AnyTask):
|
|
41
42
|
Every Task definition should be extended from this class.
|
42
43
|
"""
|
43
44
|
|
44
|
-
__running_tasks:
|
45
|
+
__running_tasks: list[AnyTask] = []
|
45
46
|
|
46
47
|
def __init__(
|
47
48
|
self,
|
48
49
|
name: str,
|
49
50
|
group: Optional[Group] = None,
|
50
51
|
description: str = "",
|
51
|
-
inputs:
|
52
|
+
inputs: list[AnyInput] = [],
|
52
53
|
envs: Iterable[Env] = [],
|
53
54
|
env_files: Iterable[EnvFile] = [],
|
54
55
|
icon: Optional[str] = None,
|
@@ -119,7 +120,7 @@ class BaseTask(FinishTracker, AttemptTracker, Renderer, BaseTaskModel, AnyTask):
|
|
119
120
|
operand.add_upstream(self)
|
120
121
|
return operand
|
121
122
|
if isinstance(operand, AnyParallel):
|
122
|
-
other_tasks:
|
123
|
+
other_tasks: list[AnyTask] = operand.get_tasks()
|
123
124
|
for other_task in other_tasks:
|
124
125
|
other_task.add_upstream(self)
|
125
126
|
return operand
|
@@ -286,6 +287,9 @@ class BaseTask(FinishTracker, AttemptTracker, Renderer, BaseTaskModel, AnyTask):
|
|
286
287
|
result = results[-1]
|
287
288
|
self._print_result(result)
|
288
289
|
return result
|
290
|
+
except RuntimeError as e:
|
291
|
+
if raise_error and ("event loop is closed" not in str(e).lower()):
|
292
|
+
raise e
|
289
293
|
except Exception as e:
|
290
294
|
self.log_error(f"{e}")
|
291
295
|
if raise_error:
|
@@ -415,7 +419,7 @@ class BaseTask(FinishTracker, AttemptTracker, Renderer, BaseTaskModel, AnyTask):
|
|
415
419
|
# wait all upstream checkers to complete
|
416
420
|
await asyncio.gather(*coroutines)
|
417
421
|
|
418
|
-
async def __trigger_failure(self, tasks:
|
422
|
+
async def __trigger_failure(self, tasks: list[AnyTask]):
|
419
423
|
coroutines = [
|
420
424
|
task.on_failed(is_last_attempt=True, exception=Exception("canceled"))
|
421
425
|
for task in tasks
|
@@ -423,7 +427,7 @@ class BaseTask(FinishTracker, AttemptTracker, Renderer, BaseTaskModel, AnyTask):
|
|
423
427
|
await asyncio.gather(*coroutines)
|
424
428
|
|
425
429
|
async def __trigger_fallbacks(
|
426
|
-
self, tasks:
|
430
|
+
self, tasks: list[AnyTask], kwargs: Mapping[str, Any]
|
427
431
|
):
|
428
432
|
coroutines: Iterable[asyncio.Task] = []
|
429
433
|
for fallback in self.__get_all_fallbacks(tasks):
|
@@ -431,8 +435,8 @@ class BaseTask(FinishTracker, AttemptTracker, Renderer, BaseTaskModel, AnyTask):
|
|
431
435
|
coroutines.append(asyncio.create_task(fallback._run_all(**kwargs)))
|
432
436
|
await asyncio.gather(*coroutines)
|
433
437
|
|
434
|
-
def __get_all_fallbacks(self, tasks:
|
435
|
-
all_fallbacks:
|
438
|
+
def __get_all_fallbacks(self, tasks: list[AnyTask]) -> list[AnyTask]:
|
439
|
+
all_fallbacks: list[AnyTask] = []
|
436
440
|
for task in tasks:
|
437
441
|
task._lock_fallbacks()
|
438
442
|
for fallback in task._get_fallbacks():
|
@@ -2,7 +2,9 @@ import datetime
|
|
2
2
|
import logging
|
3
3
|
import os
|
4
4
|
import sys
|
5
|
+
from collections.abc import Callable, Iterable, Mapping
|
5
6
|
from functools import lru_cache
|
7
|
+
from typing import Any, Optional, Union
|
6
8
|
|
7
9
|
from zrb.config.config import ENV_PREFIX, LOGGING_LEVEL, SHOW_TIME
|
8
10
|
from zrb.helper.accessories.color import colored
|
@@ -10,16 +12,7 @@ from zrb.helper.log import logger
|
|
10
12
|
from zrb.helper.string.conversion import to_variable_name
|
11
13
|
from zrb.helper.string.modification import double_quote
|
12
14
|
from zrb.helper.typecheck import typechecked
|
13
|
-
from zrb.helper.typing import
|
14
|
-
Any,
|
15
|
-
Callable,
|
16
|
-
Iterable,
|
17
|
-
JinjaTemplate,
|
18
|
-
List,
|
19
|
-
Mapping,
|
20
|
-
Optional,
|
21
|
-
Union,
|
22
|
-
)
|
15
|
+
from zrb.helper.typing import JinjaTemplate
|
23
16
|
from zrb.task.any_task import AnyTask
|
24
17
|
from zrb.task.any_task_event_handler import (
|
25
18
|
OnFailed,
|
@@ -48,7 +41,7 @@ class BaseTaskModel(CommonTaskModel, PidModel, TimeTracker):
|
|
48
41
|
name: str,
|
49
42
|
group: Optional[Group] = None,
|
50
43
|
description: str = "",
|
51
|
-
inputs:
|
44
|
+
inputs: list[AnyInput] = [],
|
52
45
|
envs: Iterable[Env] = [],
|
53
46
|
env_files: Iterable[EnvFile] = [],
|
54
47
|
icon: Optional[str] = None,
|
@@ -102,7 +95,7 @@ class BaseTaskModel(CommonTaskModel, PidModel, TimeTracker):
|
|
102
95
|
)
|
103
96
|
PidModel.__init__(self)
|
104
97
|
TimeTracker.__init__(self)
|
105
|
-
self.__args:
|
98
|
+
self.__args: list[Any] = []
|
106
99
|
self.__kwargs: Mapping[str, Any] = {}
|
107
100
|
|
108
101
|
def _set_args(self, args: Iterable[Any]):
|
@@ -201,7 +194,7 @@ class BaseTaskModel(CommonTaskModel, PidModel, TimeTracker):
|
|
201
194
|
def _show_run_command(self):
|
202
195
|
if not self.__has_cli_interface:
|
203
196
|
return
|
204
|
-
params:
|
197
|
+
params: list[str] = [double_quote(arg) for arg in self.__args]
|
205
198
|
for task_input in self._get_combined_inputs():
|
206
199
|
if task_input.is_hidden():
|
207
200
|
continue
|
@@ -1,19 +1,12 @@
|
|
1
1
|
import os
|
2
|
+
from collections.abc import Callable, Iterable, Mapping
|
3
|
+
from typing import Any, Optional, Union
|
2
4
|
|
3
5
|
from zrb.helper.accessories.color import get_random_color
|
4
6
|
from zrb.helper.accessories.icon import get_random_icon
|
5
7
|
from zrb.helper.string.conversion import to_cli_name
|
6
8
|
from zrb.helper.typecheck import typechecked
|
7
|
-
from zrb.helper.typing import
|
8
|
-
Any,
|
9
|
-
Callable,
|
10
|
-
Iterable,
|
11
|
-
JinjaTemplate,
|
12
|
-
List,
|
13
|
-
Mapping,
|
14
|
-
Optional,
|
15
|
-
Union,
|
16
|
-
)
|
9
|
+
from zrb.helper.typing import JinjaTemplate
|
17
10
|
from zrb.helper.util import coalesce_str
|
18
11
|
from zrb.task.any_task import AnyTask
|
19
12
|
from zrb.task.any_task_event_handler import (
|
@@ -39,7 +32,7 @@ class CommonTaskModel:
|
|
39
32
|
name: str,
|
40
33
|
group: Optional[Group] = None,
|
41
34
|
description: str = "",
|
42
|
-
inputs:
|
35
|
+
inputs: list[AnyInput] = [],
|
43
36
|
envs: Iterable[Env] = [],
|
44
37
|
env_files: Iterable[EnvFile] = [],
|
45
38
|
icon: Optional[str] = None,
|
@@ -65,7 +58,7 @@ class CommonTaskModel:
|
|
65
58
|
self._group = group
|
66
59
|
if group is not None:
|
67
60
|
group._add_task(self)
|
68
|
-
checkers_cp:
|
61
|
+
checkers_cp: list[AnyTask] = [checker.copy() for checker in checkers]
|
69
62
|
for checker in checkers_cp:
|
70
63
|
checker.add_env(*envs)
|
71
64
|
checker.add_env_file(*env_files)
|
@@ -104,7 +97,7 @@ class CommonTaskModel:
|
|
104
97
|
self.__has_already_inject_inputs: bool = False
|
105
98
|
self.__has_already_inject_upstreams: bool = False
|
106
99
|
self.__has_already_inject_fallbacks: bool = False
|
107
|
-
self.__all_inputs: Optional[
|
100
|
+
self.__all_inputs: Optional[list[AnyInput]] = None
|
108
101
|
|
109
102
|
def _lock_checkers(self):
|
110
103
|
self.__allow_add_checkers = False
|
@@ -185,7 +178,7 @@ class CommonTaskModel:
|
|
185
178
|
def inject_inputs(self):
|
186
179
|
pass
|
187
180
|
|
188
|
-
def _get_inputs(self) ->
|
181
|
+
def _get_inputs(self) -> list[AnyInput]:
|
189
182
|
if not self.__has_already_inject_inputs:
|
190
183
|
self.inject_inputs()
|
191
184
|
self.__has_already_inject_inputs = True
|
@@ -197,7 +190,7 @@ class CommonTaskModel:
|
|
197
190
|
"""
|
198
191
|
if self.__all_inputs is not None:
|
199
192
|
return self.__all_inputs
|
200
|
-
self.__all_inputs:
|
193
|
+
self.__all_inputs: list[AnyInput] = []
|
201
194
|
existing_input_names: Mapping[str, bool] = {}
|
202
195
|
# Add task inputs
|
203
196
|
inputs = self._get_inputs()
|
@@ -244,7 +237,7 @@ class CommonTaskModel:
|
|
244
237
|
def inject_envs(self):
|
245
238
|
pass
|
246
239
|
|
247
|
-
def _get_envs(self) ->
|
240
|
+
def _get_envs(self) -> list[Env]:
|
248
241
|
if not self.__has_already_inject_envs:
|
249
242
|
self.inject_envs()
|
250
243
|
self.__has_already_inject_envs = True
|
@@ -297,7 +290,7 @@ class CommonTaskModel:
|
|
297
290
|
def inject_upstreams(self):
|
298
291
|
pass
|
299
292
|
|
300
|
-
def _get_upstreams(self) ->
|
293
|
+
def _get_upstreams(self) -> list[AnyTask]:
|
301
294
|
if not self.__has_already_inject_upstreams:
|
302
295
|
self.inject_upstreams()
|
303
296
|
self.__has_already_inject_upstreams = True
|
@@ -316,7 +309,7 @@ class CommonTaskModel:
|
|
316
309
|
def inject_fallbacks(self):
|
317
310
|
pass
|
318
311
|
|
319
|
-
def _get_fallbacks(self) ->
|
312
|
+
def _get_fallbacks(self) -> list[AnyTask]:
|
320
313
|
if not self.__has_already_inject_fallbacks:
|
321
314
|
self.inject_fallbacks()
|
322
315
|
self.__has_already_inject_fallbacks = True
|
@@ -328,7 +321,7 @@ class CommonTaskModel:
|
|
328
321
|
def get_color(self) -> str:
|
329
322
|
return self._color
|
330
323
|
|
331
|
-
def _get_env_files(self) ->
|
324
|
+
def _get_env_files(self) -> list[EnvFile]:
|
332
325
|
if not self.__has_already_inject_env_files:
|
333
326
|
self.inject_env_files()
|
334
327
|
self.__has_already_inject_env_files = True
|
@@ -346,11 +339,11 @@ class CommonTaskModel:
|
|
346
339
|
additional_checkers = self.__complete_new_checkers(checkers)
|
347
340
|
self._checkers = self._checkers + additional_checkers
|
348
341
|
|
349
|
-
def __complete_new_checkers(self, new_checkers:
|
342
|
+
def __complete_new_checkers(self, new_checkers: Iterable[AnyTask]) -> list[AnyTask]:
|
350
343
|
"""
|
351
344
|
For internal use: copy and completing new checkers
|
352
345
|
"""
|
353
|
-
checkers:
|
346
|
+
checkers: list[AnyTask] = [checker.copy() for checker in new_checkers]
|
354
347
|
for checker in checkers:
|
355
348
|
checker.add_input(*self._get_inputs())
|
356
349
|
checker.add_env(*self._get_envs())
|
@@ -360,7 +353,7 @@ class CommonTaskModel:
|
|
360
353
|
def inject_checkers(self):
|
361
354
|
pass
|
362
355
|
|
363
|
-
def _get_checkers(self) ->
|
356
|
+
def _get_checkers(self) -> list[AnyTask]:
|
364
357
|
if not self.__allow_add_checkers:
|
365
358
|
self.inject_checkers()
|
366
359
|
self.__allow_add_checkers = True
|
@@ -1,4 +1,6 @@
|
|
1
1
|
import os
|
2
|
+
from collections.abc import Mapping
|
3
|
+
from typing import Any, Optional, Union
|
2
4
|
|
3
5
|
import jinja2
|
4
6
|
|
@@ -6,7 +8,7 @@ from zrb.helper.render_data import DEFAULT_RENDER_DATA
|
|
6
8
|
from zrb.helper.string.conversion import to_boolean
|
7
9
|
from zrb.helper.string.jinja import is_probably_jinja
|
8
10
|
from zrb.helper.typecheck import typechecked
|
9
|
-
from zrb.helper.typing import
|
11
|
+
from zrb.helper.typing import JinjaTemplate
|
10
12
|
from zrb.task.any_task import AnyTask
|
11
13
|
|
12
14
|
|
zrb/task/checker.py
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
import asyncio
|
2
|
+
from collections.abc import Callable, Iterable
|
3
|
+
from typing import Any, Optional, Union
|
2
4
|
|
3
5
|
from zrb.helper.accessories.color import colored
|
4
6
|
from zrb.helper.log import logger
|
5
7
|
from zrb.helper.typecheck import typechecked
|
6
|
-
from zrb.helper.typing import Any, Callable, Iterable, Optional, Union
|
7
8
|
from zrb.task.any_task import AnyTask
|
8
9
|
from zrb.task.any_task_event_handler import (
|
9
10
|
OnFailed,
|
zrb/task/cmd_task.py
CHANGED
@@ -7,21 +7,15 @@ import signal
|
|
7
7
|
import subprocess
|
8
8
|
import sys
|
9
9
|
import time
|
10
|
+
from collections.abc import Callable, Iterable
|
11
|
+
from typing import Any, Optional, TypeVar, Union
|
10
12
|
|
11
13
|
from zrb.config.config import DEFAULT_SHELL, LOGGING_LEVEL
|
12
14
|
from zrb.helper.accessories.color import colored
|
15
|
+
from zrb.helper.asyncio_task import stop_asyncio_sync
|
13
16
|
from zrb.helper.log import logger
|
14
17
|
from zrb.helper.typecheck import typechecked
|
15
|
-
from zrb.helper.typing import
|
16
|
-
Any,
|
17
|
-
Callable,
|
18
|
-
Iterable,
|
19
|
-
JinjaTemplate,
|
20
|
-
List,
|
21
|
-
Optional,
|
22
|
-
TypeVar,
|
23
|
-
Union,
|
24
|
-
)
|
18
|
+
from zrb.helper.typing import JinjaTemplate
|
25
19
|
from zrb.task.any_task import AnyTask
|
26
20
|
from zrb.task.any_task_event_handler import (
|
27
21
|
OnFailed,
|
@@ -111,7 +105,7 @@ class CmdTask(BaseTask):
|
|
111
105
|
>>> runner.register(hello)
|
112
106
|
"""
|
113
107
|
|
114
|
-
_pids:
|
108
|
+
_pids: list[int] = []
|
115
109
|
_global_state = CmdGlobalState()
|
116
110
|
|
117
111
|
def __init__(
|
@@ -296,13 +290,7 @@ class CmdTask(BaseTask):
|
|
296
290
|
_print_out_dark(f"Getting signal {signum}")
|
297
291
|
for pid in self._pids:
|
298
292
|
self.__kill_by_pid(pid)
|
299
|
-
|
300
|
-
for task in tasks:
|
301
|
-
try:
|
302
|
-
task.cancel()
|
303
|
-
except Exception as e:
|
304
|
-
self.print_err(e)
|
305
|
-
time.sleep(0.3)
|
293
|
+
stop_asyncio_sync()
|
306
294
|
_print_out_dark(f"Exiting with signal {signum}")
|
307
295
|
sys.exit(signum)
|
308
296
|
|
zrb/task/decorator.py
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
from collections.abc import Callable, Iterable
|
2
|
+
from typing import Any, Optional, Union
|
3
|
+
|
1
4
|
from zrb.action.runner import Runner
|
2
5
|
from zrb.helper.accessories.color import colored
|
3
6
|
from zrb.helper.log import logger
|
4
7
|
from zrb.helper.typecheck import typechecked
|
5
|
-
from zrb.helper.typing import Any, Callable, Iterable, Optional, Union
|
6
8
|
from zrb.task.any_task import AnyTask
|
7
9
|
from zrb.task.any_task_event_handler import (
|
8
10
|
OnFailed,
|
@@ -1,18 +1,12 @@
|
|
1
1
|
import os
|
2
2
|
import pathlib
|
3
|
+
from collections.abc import Callable, Iterable, Mapping
|
4
|
+
from typing import Any, Optional, Union
|
3
5
|
|
4
6
|
from zrb.helper.accessories.color import colored
|
5
7
|
from zrb.helper.log import logger
|
6
8
|
from zrb.helper.typecheck import typechecked
|
7
|
-
from zrb.helper.typing import
|
8
|
-
Any,
|
9
|
-
Callable,
|
10
|
-
Iterable,
|
11
|
-
JinjaTemplate,
|
12
|
-
Mapping,
|
13
|
-
Optional,
|
14
|
-
Union,
|
15
|
-
)
|
9
|
+
from zrb.helper.typing import JinjaTemplate
|
16
10
|
from zrb.task.any_task import AnyTask
|
17
11
|
from zrb.task.any_task_event_handler import (
|
18
12
|
OnFailed,
|
@@ -123,29 +117,30 @@ class DockerComposeStartTask(DockerComposeTask):
|
|
123
117
|
)
|
124
118
|
|
125
119
|
def get_cmd_script(self, *args: Any, **kwargs: Any) -> str:
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
self._create_cmd_script(
|
130
|
-
self._setup_cmd_path, self._setup_cmd, *args, **kwargs
|
131
|
-
),
|
132
|
-
# compose start
|
133
|
-
self._get_docker_compose_cmd_script(
|
134
|
-
compose_cmd="up",
|
135
|
-
compose_options=self._compose_options,
|
136
|
-
compose_flags=list(self._compose_flags) + ["-d"],
|
137
|
-
compose_args=self._compose_args,
|
138
|
-
*args,
|
139
|
-
),
|
140
|
-
# compose log
|
141
|
-
self._get_docker_compose_cmd_script(
|
142
|
-
compose_cmd="logs",
|
143
|
-
compose_options={},
|
144
|
-
compose_flags=["-f"],
|
145
|
-
compose_args=[],
|
146
|
-
*args,
|
147
|
-
),
|
148
|
-
]
|
120
|
+
# setup
|
121
|
+
setup_cmd = self._create_cmd_script(
|
122
|
+
self._setup_cmd_path, self._setup_cmd, *args, **kwargs
|
149
123
|
)
|
124
|
+
cmd_list = [setup_cmd] if setup_cmd.strip() != "" else []
|
125
|
+
# compose command
|
126
|
+
cmd_list = cmd_list + [
|
127
|
+
# compose start
|
128
|
+
self._get_docker_compose_cmd_script(
|
129
|
+
compose_cmd="up",
|
130
|
+
compose_options=self._compose_options,
|
131
|
+
compose_flags=list(self._compose_flags) + ["-d"],
|
132
|
+
compose_args=self._compose_args,
|
133
|
+
*args,
|
134
|
+
),
|
135
|
+
# compose log
|
136
|
+
self._get_docker_compose_cmd_script(
|
137
|
+
compose_cmd="logs",
|
138
|
+
compose_options={},
|
139
|
+
compose_flags=["-f"],
|
140
|
+
compose_args=[],
|
141
|
+
*args,
|
142
|
+
),
|
143
|
+
]
|
144
|
+
cmd_str = "\n".join(cmd_list)
|
150
145
|
self.log_info(f"Command: {cmd_str}")
|
151
146
|
return cmd_str
|
zrb/task/docker_compose_task.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
import os
|
2
2
|
import pathlib
|
3
|
+
from collections.abc import Callable, Iterable, Mapping
|
4
|
+
from typing import Any, Optional, TypeVar, Union
|
3
5
|
|
4
6
|
from zrb.config.config import CONTAINER_BACKEND
|
5
7
|
from zrb.helper.accessories.color import colored
|
@@ -10,17 +12,7 @@ from zrb.helper.log import logger
|
|
10
12
|
from zrb.helper.string.conversion import to_cli_name
|
11
13
|
from zrb.helper.string.modification import double_quote
|
12
14
|
from zrb.helper.typecheck import typechecked
|
13
|
-
from zrb.helper.typing import
|
14
|
-
Any,
|
15
|
-
Callable,
|
16
|
-
Iterable,
|
17
|
-
JinjaTemplate,
|
18
|
-
List,
|
19
|
-
Mapping,
|
20
|
-
Optional,
|
21
|
-
TypeVar,
|
22
|
-
Union,
|
23
|
-
)
|
15
|
+
from zrb.helper.typing import JinjaTemplate
|
24
16
|
from zrb.helper.util import to_snake_case
|
25
17
|
from zrb.task.any_task import AnyTask
|
26
18
|
from zrb.task.any_task_event_handler import (
|
@@ -71,14 +63,14 @@ ensure_zrb_network_task = _get_ensure_zrb_network_task(CONTAINER_BACKEND)
|
|
71
63
|
|
72
64
|
@typechecked
|
73
65
|
class ServiceConfig:
|
74
|
-
def __init__(self, envs:
|
66
|
+
def __init__(self, envs: list[Env] = [], env_files: list[EnvFile] = []):
|
75
67
|
self._envs = envs
|
76
68
|
self._env_files = env_files
|
77
69
|
|
78
|
-
def get_envs(self) ->
|
70
|
+
def get_envs(self) -> list[Env]:
|
79
71
|
return self._envs
|
80
72
|
|
81
|
-
def get_env_files(self) ->
|
73
|
+
def get_env_files(self) -> list[EnvFile]:
|
82
74
|
return self._env_files
|
83
75
|
|
84
76
|
|
@@ -224,7 +216,7 @@ class DockerComposeTask(CmdTask):
|
|
224
216
|
def __generate_compose_runtime_file(self):
|
225
217
|
compose_data = read_compose_file(self._compose_template_file)
|
226
218
|
for service, service_config in self._compose_service_configs.items():
|
227
|
-
envs:
|
219
|
+
envs: list[Env] = []
|
228
220
|
env_files = service_config.get_env_files()
|
229
221
|
for env_file in env_files:
|
230
222
|
envs += env_file.get_envs()
|
@@ -233,7 +225,7 @@ class DockerComposeTask(CmdTask):
|
|
233
225
|
write_compose_file(self._compose_runtime_file, compose_data)
|
234
226
|
|
235
227
|
def __apply_service_env(
|
236
|
-
self, compose_data: Any, service_name: str, envs:
|
228
|
+
self, compose_data: Any, service_name: str, envs: list[Env]
|
237
229
|
) -> Any:
|
238
230
|
# service not found
|
239
231
|
service_map = compose_data["services"]
|
@@ -269,7 +261,7 @@ class DockerComposeTask(CmdTask):
|
|
269
261
|
return compose_data
|
270
262
|
|
271
263
|
def __get_service_new_env_map(
|
272
|
-
self, service_name: str, service_env_map: Mapping[str, str], new_envs:
|
264
|
+
self, service_name: str, service_env_map: Mapping[str, str], new_envs: list[Env]
|
273
265
|
) -> Mapping[str, str]:
|
274
266
|
new_service_envs: Mapping[str, str] = {}
|
275
267
|
for env in new_envs:
|
@@ -280,9 +272,9 @@ class DockerComposeTask(CmdTask):
|
|
280
272
|
return new_service_envs
|
281
273
|
|
282
274
|
def __get_service_new_env_list(
|
283
|
-
self, service_name: str, service_env_list:
|
284
|
-
) ->
|
285
|
-
new_service_envs:
|
275
|
+
self, service_name: str, service_env_list: list[str], new_envs: list[Env]
|
276
|
+
) -> list[str]:
|
277
|
+
new_service_envs: list[str] = []
|
286
278
|
for env in new_envs:
|
287
279
|
should_be_added = 0 == len(
|
288
280
|
[
|
@@ -341,22 +333,22 @@ class DockerComposeTask(CmdTask):
|
|
341
333
|
raise Exception(f"Invalid compose file: {compose_file}")
|
342
334
|
|
343
335
|
def get_cmd_script(self, *args: Any, **kwargs: Any) -> str:
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
]
|
336
|
+
# setup
|
337
|
+
setup_cmd = self._create_cmd_script(
|
338
|
+
self._setup_cmd_path, self._setup_cmd, *args, **kwargs
|
339
|
+
)
|
340
|
+
cmd_list = [setup_cmd] if setup_cmd.strip() != "" else []
|
341
|
+
# compose command
|
342
|
+
cmd_list.append(
|
343
|
+
self._get_docker_compose_cmd_script(
|
344
|
+
compose_cmd=self._compose_cmd,
|
345
|
+
compose_options=self._compose_options,
|
346
|
+
compose_flags=self._compose_flags,
|
347
|
+
compose_args=self._compose_args,
|
348
|
+
*args,
|
349
|
+
)
|
359
350
|
)
|
351
|
+
cmd_str = "\n".join(cmd_list)
|
360
352
|
self.log_info(f"Command: {cmd_str}")
|
361
353
|
return cmd_str
|
362
354
|
|
zrb/task/flow_task.py
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
from collections.abc import Callable, Iterable
|
2
|
+
from typing import Optional, TypeVar, Union
|
3
|
+
|
1
4
|
from zrb.helper.accessories.color import colored
|
2
5
|
from zrb.helper.log import logger
|
3
6
|
from zrb.helper.typecheck import typechecked
|
4
|
-
from zrb.helper.typing import Callable, Iterable, List, Optional, TypeVar, Union
|
5
7
|
from zrb.task.any_task import AnyTask
|
6
8
|
from zrb.task.any_task_event_handler import (
|
7
9
|
OnFailed,
|
@@ -48,7 +50,7 @@ class FlowTask(BaseTask):
|
|
48
50
|
checking_interval: Union[float, int] = 0.05,
|
49
51
|
retry: int = 2,
|
50
52
|
retry_interval: Union[float, int] = 1,
|
51
|
-
steps:
|
53
|
+
steps: list[Union[AnyTask, list[AnyTask]]] = [],
|
52
54
|
should_execute: Union[bool, str, Callable[..., bool]] = True,
|
53
55
|
return_upstream_result: bool = False,
|
54
56
|
):
|
@@ -83,7 +85,6 @@ class FlowTask(BaseTask):
|
|
83
85
|
retry_interval=retry_interval,
|
84
86
|
should_execute=should_execute,
|
85
87
|
return_upstream_result=return_upstream_result,
|
86
|
-
run=lambda *args, **kwargs: kwargs.get("_task").print_out("🆗"),
|
87
88
|
)
|
88
89
|
|
89
90
|
def copy(self) -> TFlowTask:
|
@@ -91,12 +92,12 @@ class FlowTask(BaseTask):
|
|
91
92
|
|
92
93
|
def _create_flow_upstreams(
|
93
94
|
self,
|
94
|
-
steps:
|
95
|
-
upstreams:
|
96
|
-
inputs:
|
97
|
-
envs:
|
98
|
-
env_files:
|
99
|
-
) ->
|
95
|
+
steps: list[Union[AnyTask, list[AnyTask]]],
|
96
|
+
upstreams: list[AnyTask],
|
97
|
+
inputs: list[AnyInput],
|
98
|
+
envs: list[Env],
|
99
|
+
env_files: list[EnvFile],
|
100
|
+
) -> list[AnyTask]:
|
100
101
|
flow_upstreams = upstreams
|
101
102
|
for step in steps:
|
102
103
|
tasks = [task.copy() for task in self._step_to_tasks(step)]
|
@@ -110,20 +111,20 @@ class FlowTask(BaseTask):
|
|
110
111
|
flow_upstreams = new_upstreams
|
111
112
|
return flow_upstreams
|
112
113
|
|
113
|
-
def _step_to_tasks(self, step: Union[AnyTask,
|
114
|
+
def _step_to_tasks(self, step: Union[AnyTask, list[AnyTask]]) -> list[AnyTask]:
|
114
115
|
if isinstance(step, AnyTask):
|
115
116
|
return [step]
|
116
117
|
return step
|
117
118
|
|
118
119
|
def _create_embeded_tasks(
|
119
120
|
self,
|
120
|
-
tasks:
|
121
|
-
upstreams:
|
122
|
-
inputs:
|
123
|
-
envs:
|
124
|
-
env_files:
|
125
|
-
) ->
|
126
|
-
embeded_tasks:
|
121
|
+
tasks: list[AnyTask],
|
122
|
+
upstreams: list[AnyTask],
|
123
|
+
inputs: list[AnyInput],
|
124
|
+
envs: list[Env],
|
125
|
+
env_files: list[EnvFile],
|
126
|
+
) -> list[AnyTask]:
|
127
|
+
embeded_tasks: list[AnyTask] = []
|
127
128
|
for embeded_task in tasks:
|
128
129
|
embeded_task_upstreams = self._get_all_upstreams(tasks=[embeded_task])
|
129
130
|
for embeded_task_upstream in embeded_task_upstreams:
|
@@ -134,7 +135,7 @@ class FlowTask(BaseTask):
|
|
134
135
|
embeded_tasks.append(embeded_task)
|
135
136
|
return embeded_tasks
|
136
137
|
|
137
|
-
def _get_all_upstreams(self, tasks:
|
138
|
+
def _get_all_upstreams(self, tasks: list[AnyTask]):
|
138
139
|
all_upstreams = []
|
139
140
|
for task in tasks:
|
140
141
|
upstreams = task._get_upstreams()
|