zrb 0.5.0__py3-none-any.whl → 0.6.0__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/__init__.py +1 -0
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/app-test.sh +6 -1
- zrb/builtin/generator/project/template/project.sh +9 -3
- zrb/helper/string/constant.py +2 -2
- zrb/task/any_task.py +13 -13
- zrb/task/base_remote_cmd_task.py +7 -7
- zrb/task/base_task/base_task.py +4 -5
- zrb/task/base_task/component/base_task_model.py +2 -2
- zrb/task/base_task/component/common_task_model.py +3 -3
- zrb/task/cmd_task.py +9 -3
- zrb/task/docker_compose_task.py +5 -4
- zrb/task/http_checker.py +7 -5
- zrb/task/notifier.py +5 -3
- zrb/task/path_checker.py +4 -4
- zrb/task/path_watcher.py +5 -4
- zrb/task/port_checker.py +6 -4
- zrb/task/resource_maker.py +5 -5
- zrb/task/rsync_task.py +5 -3
- zrb/task/time_watcher.py +3 -3
- zrb/task_group/group.py +3 -3
- {zrb-0.5.0.dist-info → zrb-0.6.0.dist-info}/METADATA +1 -1
- {zrb-0.5.0.dist-info → zrb-0.6.0.dist-info}/RECORD +25 -25
- {zrb-0.5.0.dist-info → zrb-0.6.0.dist-info}/LICENSE +0 -0
- {zrb-0.5.0.dist-info → zrb-0.6.0.dist-info}/WHEEL +0 -0
- {zrb-0.5.0.dist-info → zrb-0.6.0.dist-info}/entry_points.txt +0 -0
zrb/__init__.py
CHANGED
@@ -5,4 +5,9 @@ echo "Activate virtual environment"
|
|
5
5
|
source .venv/bin/activate
|
6
6
|
|
7
7
|
cd ..
|
8
|
-
pytest
|
8
|
+
pytest \
|
9
|
+
--ignore=postgres-data \
|
10
|
+
--cov=src \
|
11
|
+
--cov-report html \
|
12
|
+
--cov-report term \
|
13
|
+
--cov-report term-missing {{input.snake_zrb_app_name_test}}
|
@@ -31,9 +31,15 @@ reload() {
|
|
31
31
|
|
32
32
|
if [ -z "$PROJECT_AUTO_INSTALL_PIP" ] || [ "$PROJECT_AUTO_INSTALL_PIP" = 1 ]
|
33
33
|
then
|
34
|
-
echo '🤖
|
35
|
-
|
36
|
-
|
34
|
+
echo '🤖 Checking .venv and requirements.txt timestamp'
|
35
|
+
_VENV_TIMESTAMP=$(find .venv -type d -exec stat -c %Y {} \; | sort -n | tail -n 1)
|
36
|
+
_REQUIREMENTS_TIMESTAMP=$(stat -c %Y requirements.txt)
|
37
|
+
if [ "$_VENV_TIMESTAMP" -lt "$_REQUIREMENTS_TIMESTAMP" ]
|
38
|
+
then
|
39
|
+
echo '🤖 Install requirements'
|
40
|
+
pip install --upgrade pip
|
41
|
+
pip install -r "${PROJECT_DIR}/requirements.txt"
|
42
|
+
fi
|
37
43
|
fi
|
38
44
|
|
39
45
|
_CURRENT_SHELL=$(ps -p $$ | awk 'NR==2 {print $4}')
|
zrb/helper/string/constant.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
TRUE_STRS = ['true', '1', 'yes', 'y', 'active']
|
2
|
-
FALSE_STRS = ['false', '0', 'no', 'n', 'inactive']
|
1
|
+
TRUE_STRS = ['true', '1', 'yes', 'y', 'active', 'on']
|
2
|
+
FALSE_STRS = ['false', '0', 'no', 'n', 'inactive', 'off']
|
zrb/task/any_task.py
CHANGED
@@ -43,11 +43,11 @@ class AnyTask(ABC):
|
|
43
43
|
pass
|
44
44
|
|
45
45
|
@abstractmethod
|
46
|
-
|
46
|
+
def run(self, *args: Any, **kwargs: Any) -> Any:
|
47
47
|
'''
|
48
48
|
Executes the main logic of the task.
|
49
49
|
|
50
|
-
This
|
50
|
+
This method should be implemented in subclasses to define the
|
51
51
|
task's primary functionality. The specific behavior and the return value
|
52
52
|
depend on the task's nature and purpose.
|
53
53
|
|
@@ -69,7 +69,7 @@ class AnyTask(ABC):
|
|
69
69
|
pass
|
70
70
|
|
71
71
|
@abstractmethod
|
72
|
-
|
72
|
+
def check(self) -> bool:
|
73
73
|
'''
|
74
74
|
Checks if the current task is `ready`.
|
75
75
|
|
@@ -158,7 +158,7 @@ class AnyTask(ABC):
|
|
158
158
|
pass
|
159
159
|
|
160
160
|
@abstractmethod
|
161
|
-
|
161
|
+
def on_triggered(self):
|
162
162
|
'''
|
163
163
|
Defines actions to perform when the task status is set to `triggered`.
|
164
164
|
|
@@ -175,7 +175,7 @@ class AnyTask(ABC):
|
|
175
175
|
pass
|
176
176
|
|
177
177
|
@abstractmethod
|
178
|
-
|
178
|
+
def on_waiting(self):
|
179
179
|
'''
|
180
180
|
Defines actions to perform when the task status is set to `waiting`.
|
181
181
|
|
@@ -192,7 +192,7 @@ class AnyTask(ABC):
|
|
192
192
|
pass
|
193
193
|
|
194
194
|
@abstractmethod
|
195
|
-
|
195
|
+
def on_skipped(self):
|
196
196
|
'''
|
197
197
|
Defines actions to perform when the task status is set to `skipped`.
|
198
198
|
|
@@ -208,7 +208,7 @@ class AnyTask(ABC):
|
|
208
208
|
pass
|
209
209
|
|
210
210
|
@abstractmethod
|
211
|
-
|
211
|
+
def on_started(self):
|
212
212
|
'''
|
213
213
|
Defines actions to perform when the task status is set to 'started'.
|
214
214
|
|
@@ -224,11 +224,11 @@ class AnyTask(ABC):
|
|
224
224
|
pass
|
225
225
|
|
226
226
|
@abstractmethod
|
227
|
-
|
227
|
+
def on_ready(self):
|
228
228
|
'''
|
229
229
|
Defines actions to be performed when the task status is `ready`.
|
230
230
|
|
231
|
-
This
|
231
|
+
This method should be implemented in subclasses to specify
|
232
232
|
actions that occur when the task reaches the `ready` state. This can include
|
233
233
|
any cleanup, notification, or follow-up actions specific to the task.
|
234
234
|
|
@@ -241,11 +241,11 @@ class AnyTask(ABC):
|
|
241
241
|
pass
|
242
242
|
|
243
243
|
@abstractmethod
|
244
|
-
|
244
|
+
def on_failed(self, is_last_attempt: bool, exception: Exception):
|
245
245
|
'''
|
246
246
|
Specifies the behavior when the task execution fails.
|
247
247
|
|
248
|
-
This
|
248
|
+
This method should be implemented in subclasses to handle task
|
249
249
|
failure scenarios. It can include logging the error, performing retries, or
|
250
250
|
any other failure handling mechanisms.
|
251
251
|
|
@@ -265,7 +265,7 @@ class AnyTask(ABC):
|
|
265
265
|
pass
|
266
266
|
|
267
267
|
@abstractmethod
|
268
|
-
|
268
|
+
def on_retry(self):
|
269
269
|
'''
|
270
270
|
Defines actions to perform when the task is retried.
|
271
271
|
|
@@ -580,7 +580,7 @@ class AnyTask(ABC):
|
|
580
580
|
|
581
581
|
@abstractmethod
|
582
582
|
def set_should_execute(
|
583
|
-
self, should_execute: Union[bool,
|
583
|
+
self, should_execute: Union[bool, JinjaTemplate, Callable[..., bool]]
|
584
584
|
):
|
585
585
|
'''
|
586
586
|
Determines whether the task should execute.
|
zrb/task/base_remote_cmd_task.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
from zrb.helper.typing import (
|
2
|
-
Any, Callable, Iterable, Mapping, Optional, Union, TypeVar
|
2
|
+
Any, Callable, Iterable, Mapping, Optional, Union, TypeVar, JinjaTemplate
|
3
3
|
)
|
4
4
|
from zrb.helper.typecheck import typechecked
|
5
5
|
from zrb.helper.util import to_snake_case
|
@@ -31,12 +31,12 @@ TBaseRemoteCmdTask = TypeVar(
|
|
31
31
|
class RemoteConfig:
|
32
32
|
def __init__(
|
33
33
|
self,
|
34
|
-
host:
|
35
|
-
user:
|
36
|
-
password:
|
37
|
-
ssh_key:
|
38
|
-
port: int = 22,
|
39
|
-
config_map: Optional[Mapping[str,
|
34
|
+
host: JinjaTemplate,
|
35
|
+
user: JinjaTemplate = '',
|
36
|
+
password: JinjaTemplate = '',
|
37
|
+
ssh_key: JinjaTemplate = '',
|
38
|
+
port: Union[int, JinjaTemplate] = 22,
|
39
|
+
config_map: Optional[Mapping[str, JinjaTemplate]] = None
|
40
40
|
):
|
41
41
|
self.host = host
|
42
42
|
self.user = user
|
zrb/task/base_task/base_task.py
CHANGED
@@ -302,7 +302,7 @@ class BaseTask(
|
|
302
302
|
- Otherwise, this will return check method's return value.
|
303
303
|
'''
|
304
304
|
if len(self._get_checkers()) == 0:
|
305
|
-
return await self.check
|
305
|
+
return await run_async(self.check)
|
306
306
|
self.log_debug('Waiting execution to be started')
|
307
307
|
while not self.__is_execution_started:
|
308
308
|
# Don't start checking before the execution itself has been started
|
@@ -366,7 +366,7 @@ class BaseTask(
|
|
366
366
|
f'Started with args: {args} and kwargs: {local_kwargs}'
|
367
367
|
)
|
368
368
|
await self.on_started()
|
369
|
-
result = await self.run
|
369
|
+
result = await run_async(self.run, *args, **local_kwargs)
|
370
370
|
break
|
371
371
|
except Exception as e:
|
372
372
|
is_last_attempt = self._is_last_attempt()
|
@@ -410,7 +410,6 @@ class BaseTask(
|
|
410
410
|
)
|
411
411
|
))
|
412
412
|
# set checker keyval
|
413
|
-
# local_env_map = self.get_env_map()
|
414
413
|
checker_coroutines = []
|
415
414
|
for checker_task in self._get_checkers():
|
416
415
|
checker_task.add_input(*self._get_inputs())
|
@@ -430,6 +429,8 @@ class BaseTask(
|
|
430
429
|
if self.__is_keyval_set:
|
431
430
|
return True
|
432
431
|
self.__is_keyval_set = True
|
432
|
+
# set task for rendering
|
433
|
+
self._set_task(self)
|
433
434
|
# Set input_map for rendering
|
434
435
|
self.log_info('Set input map')
|
435
436
|
for task_input in self._get_combined_inputs():
|
@@ -452,8 +453,6 @@ class BaseTask(
|
|
452
453
|
self.log_debug(
|
453
454
|
'Env map:\n' + map_to_str(self.get_env_map(), item_prefix=' ')
|
454
455
|
)
|
455
|
-
# set task
|
456
|
-
self._set_task(self)
|
457
456
|
|
458
457
|
def __repr__(self) -> str:
|
459
458
|
cls_name = self.__class__.__name__
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from zrb.helper.typing import (
|
2
|
-
Any, Callable, Iterable, List, Mapping, Optional, Union
|
2
|
+
Any, Callable, Iterable, List, Mapping, Optional, Union, JinjaTemplate
|
3
3
|
)
|
4
4
|
from zrb.helper.typecheck import typechecked
|
5
5
|
from zrb.config.config import show_time, logging_level
|
@@ -54,7 +54,7 @@ class BaseTaskModel(CommonTaskModel, PidModel, TimeTracker):
|
|
54
54
|
on_ready: Optional[OnReady] = None,
|
55
55
|
on_retry: Optional[OnRetry] = None,
|
56
56
|
on_failed: Optional[OnFailed] = None,
|
57
|
-
should_execute: Union[bool,
|
57
|
+
should_execute: Union[bool, JinjaTemplate, Callable[..., bool]] = True,
|
58
58
|
return_upstream_result: bool = False
|
59
59
|
):
|
60
60
|
self.__rjust_full_cli_name: Optional[str] = None
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from zrb.helper.typing import (
|
2
|
-
Any, Callable, Iterable, List, Mapping, Optional, Union
|
2
|
+
Any, Callable, Iterable, List, Mapping, Optional, Union, JinjaTemplate
|
3
3
|
)
|
4
4
|
from zrb.helper.typecheck import typechecked
|
5
5
|
from zrb.task.any_task_event_handler import (
|
@@ -44,7 +44,7 @@ class CommonTaskModel():
|
|
44
44
|
on_ready: Optional[OnReady] = None,
|
45
45
|
on_retry: Optional[OnRetry] = None,
|
46
46
|
on_failed: Optional[OnFailed] = None,
|
47
|
-
should_execute: Union[bool,
|
47
|
+
should_execute: Union[bool, JinjaTemplate, Callable[..., bool]] = True,
|
48
48
|
return_upstream_result: bool = False
|
49
49
|
):
|
50
50
|
self._name = name
|
@@ -130,7 +130,7 @@ class CommonTaskModel():
|
|
130
130
|
self._retry = new_retry
|
131
131
|
|
132
132
|
def set_should_execute(
|
133
|
-
self, should_execute: Union[bool,
|
133
|
+
self, should_execute: Union[bool, JinjaTemplate, Callable[..., bool]]
|
134
134
|
):
|
135
135
|
self._should_execute = should_execute
|
136
136
|
|
zrb/task/cmd_task.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
from zrb.helper.typing import (
|
2
|
-
Any, Callable, Iterable, List, Optional, Union, TypeVar
|
2
|
+
Any, Callable, Iterable, List, Optional, Union, TypeVar, JinjaTemplate
|
3
3
|
)
|
4
4
|
from zrb.helper.typecheck import typechecked
|
5
5
|
from zrb.helper.string.conversion import to_variable_name
|
@@ -39,7 +39,11 @@ def _reset_stty():
|
|
39
39
|
_has_stty = False
|
40
40
|
|
41
41
|
|
42
|
-
CmdVal = Union[
|
42
|
+
CmdVal = Union[
|
43
|
+
JinjaTemplate,
|
44
|
+
Iterable[JinjaTemplate],
|
45
|
+
Callable[..., Union[Iterable[JinjaTemplate], JinjaTemplate]]
|
46
|
+
]
|
43
47
|
TCmdTask = TypeVar('TCmdTask', bound='CmdTask')
|
44
48
|
|
45
49
|
|
@@ -357,7 +361,9 @@ class CmdTask(BaseTask):
|
|
357
361
|
for cmd_path_str in cmd_path
|
358
362
|
])
|
359
363
|
|
360
|
-
def __get_rendered_cmd(
|
364
|
+
def __get_rendered_cmd(
|
365
|
+
self, cmd: Union[JinjaTemplate, Iterable[JinjaTemplate]]
|
366
|
+
) -> str:
|
361
367
|
if isinstance(cmd, str):
|
362
368
|
return self.render_str(cmd)
|
363
369
|
return self.render_str('\n'.join(list(cmd)))
|
zrb/task/docker_compose_task.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
from zrb.helper.typing import (
|
2
|
-
Any, Callable, Iterable, List, Mapping, Optional, Union, TypeVar
|
2
|
+
Any, Callable, Iterable, List, Mapping, Optional, Union, TypeVar,
|
3
|
+
JinjaTemplate
|
3
4
|
)
|
4
5
|
from zrb.helper.typecheck import typechecked
|
5
6
|
from zrb.task.cmd_task import CmdTask, CmdResult, CmdVal
|
@@ -77,9 +78,9 @@ class DockerComposeTask(CmdTask):
|
|
77
78
|
compose_service_configs: Mapping[str, ServiceConfig] = {},
|
78
79
|
compose_file: Optional[str] = None,
|
79
80
|
compose_cmd: str = 'up',
|
80
|
-
compose_options: Mapping[
|
81
|
-
compose_flags: Iterable[
|
82
|
-
compose_args: Iterable[
|
81
|
+
compose_options: Mapping[JinjaTemplate, JinjaTemplate] = {},
|
82
|
+
compose_flags: Iterable[JinjaTemplate] = [],
|
83
|
+
compose_args: Iterable[JinjaTemplate] = [],
|
83
84
|
compose_env_prefix: str = '',
|
84
85
|
setup_cmd: CmdVal = '',
|
85
86
|
setup_cmd_path: CmdVal = '',
|
zrb/task/http_checker.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
from zrb.helper.typing import
|
1
|
+
from zrb.helper.typing import (
|
2
|
+
Any, Callable, Iterable, Optional, Union, TypeVar, JinjaTemplate
|
3
|
+
)
|
2
4
|
from zrb.helper.typecheck import typechecked
|
3
5
|
from zrb.task.checker import Checker
|
4
6
|
from http.client import HTTPConnection, HTTPSConnection
|
@@ -58,9 +60,9 @@ class HTTPChecker(Checker):
|
|
58
60
|
icon: Optional[str] = None,
|
59
61
|
color: Optional[str] = None,
|
60
62
|
description: str = '',
|
61
|
-
host:
|
62
|
-
port: Union[int,
|
63
|
-
timeout: Union[int,
|
63
|
+
host: JinjaTemplate = 'localhost',
|
64
|
+
port: Union[int, JinjaTemplate] = 80,
|
65
|
+
timeout: Union[int, JinjaTemplate] = 5,
|
64
66
|
method: str = 'HEAD',
|
65
67
|
url: str = '/',
|
66
68
|
is_https: Union[bool, str] = False,
|
@@ -75,7 +77,7 @@ class HTTPChecker(Checker):
|
|
75
77
|
checking_interval: Union[int, float] = 0.1,
|
76
78
|
progress_interval: Union[int, float] = 5,
|
77
79
|
expected_result: bool = True,
|
78
|
-
should_execute: Union[bool,
|
80
|
+
should_execute: Union[bool, JinjaTemplate, Callable[..., bool]] = True
|
79
81
|
):
|
80
82
|
Checker.__init__(
|
81
83
|
self,
|
zrb/task/notifier.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
from zrb.helper.typing import
|
1
|
+
from zrb.helper.typing import (
|
2
|
+
Any, Callable, Iterable, Optional, Union, JinjaTemplate
|
3
|
+
)
|
2
4
|
from zrb.helper.typecheck import typechecked
|
3
5
|
from zrb.task.base_task.base_task import BaseTask
|
4
6
|
from zrb.task.any_task import AnyTask
|
@@ -33,8 +35,8 @@ class Notifier(BaseTask):
|
|
33
35
|
icon: Optional[str] = None,
|
34
36
|
color: Optional[str] = None,
|
35
37
|
description: str = '',
|
36
|
-
title:
|
37
|
-
message:
|
38
|
+
title: JinjaTemplate = '',
|
39
|
+
message: JinjaTemplate = '',
|
38
40
|
show_toast: bool = True,
|
39
41
|
show_stdout: bool = True,
|
40
42
|
upstreams: Iterable[AnyTask] = [],
|
zrb/task/path_checker.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
from zrb.helper.typing import (
|
2
|
-
Any, Callable, Iterable, List, Optional, Union, TypeVar
|
2
|
+
Any, Callable, Iterable, List, Optional, Union, TypeVar, JinjaTemplate
|
3
3
|
)
|
4
4
|
from zrb.helper.typecheck import typechecked
|
5
5
|
from zrb.helper.file.match import get_file_names
|
@@ -37,12 +37,12 @@ class PathChecker(Checker):
|
|
37
37
|
on_ready: Optional[OnReady] = None,
|
38
38
|
on_retry: Optional[OnRetry] = None,
|
39
39
|
on_failed: Optional[OnFailed] = None,
|
40
|
-
path:
|
41
|
-
ignored_path: Union[
|
40
|
+
path: JinjaTemplate = '',
|
41
|
+
ignored_path: Union[JinjaTemplate, Iterable[JinjaTemplate]] = [],
|
42
42
|
checking_interval: Union[int, float] = 0.1,
|
43
43
|
progress_interval: Union[int, float] = 5,
|
44
44
|
expected_result: bool = True,
|
45
|
-
should_execute: Union[bool,
|
45
|
+
should_execute: Union[bool, JinjaTemplate, Callable[..., bool]] = True
|
46
46
|
):
|
47
47
|
Checker.__init__(
|
48
48
|
self,
|
zrb/task/path_watcher.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
from zrb.helper.typing import (
|
2
|
-
Any, Callable, Iterable, List, Mapping, Optional, Union, TypeVar
|
2
|
+
Any, Callable, Iterable, List, Mapping, Optional, Union, TypeVar,
|
3
|
+
JinjaTemplate
|
3
4
|
)
|
4
5
|
from zrb.helper.typecheck import typechecked
|
5
6
|
from zrb.helper.file.match import get_file_names
|
@@ -49,14 +50,14 @@ class PathWatcher(Checker):
|
|
49
50
|
on_ready: Optional[OnReady] = None,
|
50
51
|
on_retry: Optional[OnRetry] = None,
|
51
52
|
on_failed: Optional[OnFailed] = None,
|
52
|
-
path:
|
53
|
-
ignored_path: Union[
|
53
|
+
path: JinjaTemplate = '',
|
54
|
+
ignored_path: Union[JinjaTemplate, Iterable[JinjaTemplate]] = [],
|
54
55
|
checking_interval: Union[int, float] = 0.1,
|
55
56
|
progress_interval: Union[int, float] = 30,
|
56
57
|
watch_new_files: bool = True,
|
57
58
|
watch_modified_files: bool = True,
|
58
59
|
watch_deleted_files: bool = True,
|
59
|
-
should_execute: Union[bool,
|
60
|
+
should_execute: Union[bool, JinjaTemplate, Callable[..., bool]] = True
|
60
61
|
):
|
61
62
|
Checker.__init__(
|
62
63
|
self,
|
zrb/task/port_checker.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
from zrb.helper.typing import
|
1
|
+
from zrb.helper.typing import (
|
2
|
+
Any, Callable, Iterable, Optional, Union, TypeVar, JinjaTemplate
|
3
|
+
)
|
2
4
|
from zrb.task.checker import Checker
|
3
5
|
from zrb.helper.typecheck import typechecked
|
4
6
|
from zrb.task.any_task import AnyTask
|
@@ -37,9 +39,9 @@ class PortChecker(Checker):
|
|
37
39
|
icon: Optional[str] = None,
|
38
40
|
color: Optional[str] = None,
|
39
41
|
description: str = '',
|
40
|
-
host:
|
41
|
-
port: Union[int,
|
42
|
-
timeout: Union[int,
|
42
|
+
host: JinjaTemplate = 'localhost',
|
43
|
+
port: Union[int, JinjaTemplate] = 80,
|
44
|
+
timeout: Union[int, JinjaTemplate] = 5,
|
43
45
|
upstreams: Iterable[AnyTask] = [],
|
44
46
|
on_triggered: Optional[OnTriggered] = None,
|
45
47
|
on_waiting: Optional[OnWaiting] = None,
|
zrb/task/resource_maker.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
from zrb.helper.typing import (
|
2
|
-
Any, Callable, Iterable, Mapping, Optional, Union, TypeVar
|
2
|
+
Any, Callable, Iterable, Mapping, Optional, Union, TypeVar, JinjaTemplate
|
3
3
|
)
|
4
4
|
from zrb.helper.typecheck import typechecked
|
5
5
|
from zrb.task.base_task.base_task import BaseTask
|
@@ -17,7 +17,7 @@ from zrb.helper.util import (
|
|
17
17
|
to_human_readable, to_capitalized_human_readable
|
18
18
|
)
|
19
19
|
|
20
|
-
Replacement = Mapping[str,
|
20
|
+
Replacement = Mapping[str, JinjaTemplate]
|
21
21
|
ReplacementMutator = Callable[
|
22
22
|
[AnyTask, Replacement],
|
23
23
|
Replacement
|
@@ -31,8 +31,8 @@ class ResourceMaker(BaseTask):
|
|
31
31
|
def __init__(
|
32
32
|
self,
|
33
33
|
name: str,
|
34
|
-
template_path:
|
35
|
-
destination_path:
|
34
|
+
template_path: JinjaTemplate,
|
35
|
+
destination_path: JinjaTemplate,
|
36
36
|
replacements: Replacement = {},
|
37
37
|
replacement_mutator: Optional[ReplacementMutator] = None,
|
38
38
|
excludes: Iterable[str] = [],
|
@@ -51,7 +51,7 @@ class ResourceMaker(BaseTask):
|
|
51
51
|
on_ready: Optional[OnReady] = None,
|
52
52
|
on_retry: Optional[OnRetry] = None,
|
53
53
|
on_failed: Optional[OnFailed] = None,
|
54
|
-
should_execute: Union[bool,
|
54
|
+
should_execute: Union[bool, JinjaTemplate, Callable[..., bool]] = True,
|
55
55
|
skip_parsing: Optional[Iterable[str]] = None
|
56
56
|
):
|
57
57
|
BaseTask.__init__(
|
zrb/task/rsync_task.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
from zrb.helper.typing import
|
1
|
+
from zrb.helper.typing import (
|
2
|
+
Any, Callable, Iterable, Optional, Union, JinjaTemplate
|
3
|
+
)
|
2
4
|
from zrb.helper.typecheck import typechecked
|
3
5
|
from zrb.task.any_task import AnyTask
|
4
6
|
from zrb.task.any_task_event_handler import (
|
@@ -37,8 +39,8 @@ class RsyncTask(BaseRemoteCmdTask):
|
|
37
39
|
self,
|
38
40
|
name: str,
|
39
41
|
remote_configs: Iterable[RemoteConfig],
|
40
|
-
src:
|
41
|
-
dst:
|
42
|
+
src: JinjaTemplate,
|
43
|
+
dst: JinjaTemplate,
|
42
44
|
is_remote_src: bool = False,
|
43
45
|
is_remote_dst: bool = True,
|
44
46
|
group: Optional[Group] = None,
|
zrb/task/time_watcher.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
from zrb.helper.typing import (
|
2
|
-
Any, Callable, Iterable, Optional, Union, TypeVar
|
2
|
+
Any, Callable, Iterable, Optional, Union, TypeVar, JinjaTemplate
|
3
3
|
)
|
4
4
|
from zrb.helper.typecheck import typechecked
|
5
5
|
from zrb.task.checker import Checker
|
@@ -45,10 +45,10 @@ class TimeWatcher(Checker):
|
|
45
45
|
on_ready: Optional[OnReady] = None,
|
46
46
|
on_retry: Optional[OnRetry] = None,
|
47
47
|
on_failed: Optional[OnFailed] = None,
|
48
|
-
schedule:
|
48
|
+
schedule: JinjaTemplate = '',
|
49
49
|
checking_interval: Union[int, float] = 1,
|
50
50
|
progress_interval: Union[int, float] = 30,
|
51
|
-
should_execute: Union[bool,
|
51
|
+
should_execute: Union[bool, JinjaTemplate, Callable[..., bool]] = True
|
52
52
|
):
|
53
53
|
Checker.__init__(
|
54
54
|
self,
|
zrb/task_group/group.py
CHANGED
@@ -41,14 +41,14 @@ class Group():
|
|
41
41
|
parent.__children.append(self)
|
42
42
|
self.__children: List[TGroup] = []
|
43
43
|
self.__tasks: List[AnyTask] = []
|
44
|
-
|
44
|
+
|
45
45
|
def get_parent(self) -> Optional[TGroup]:
|
46
46
|
'''
|
47
47
|
Retrieves parent of the Group.
|
48
48
|
|
49
49
|
Returns:
|
50
50
|
Optional[Group]: Parent of the group.
|
51
|
-
|
51
|
+
|
52
52
|
Examples:
|
53
53
|
>>> from zrb import Group
|
54
54
|
>>> system_group = Group(name='my system')
|
@@ -59,7 +59,7 @@ class Group():
|
|
59
59
|
<Group "my-system">
|
60
60
|
'''
|
61
61
|
return self._parent
|
62
|
-
|
62
|
+
|
63
63
|
def get_description(self) -> str:
|
64
64
|
'''
|
65
65
|
Retrieves group description.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
zrb/__init__.py,sha256=
|
1
|
+
zrb/__init__.py,sha256=S0wk-DQybPIndpbm2FZcbUNKkquOLnSfjOuIMrikUYg,2423
|
2
2
|
zrb/__main__.py,sha256=ZX0juuqCUqnwMvA9HPma-OY4EQm2s0Nge2jsMr9nn6Q,412
|
3
3
|
zrb/advertisement.py,sha256=e-1tFPlmEuz8IqaIJ_9-2p9x5cuGsxssJGu5F0wHthI,505
|
4
4
|
zrb/runner.py,sha256=MPCNPMCyiYNZeubSxd1eM2Zr6PCIKF-9pkG385AXElw,118
|
@@ -146,7 +146,7 @@ zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/app-load
|
|
146
146
|
zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/app-prepare-backend.sh,sha256=S2iRP27ir4w2J2uh1WvmWxxHxvCT5cjmjQW-eh3knx4,55
|
147
147
|
zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/app-prepare-load-test.sh,sha256=WprGCEAqQcl3niDozPzIlVxPjTk0uCVR2-FaClNuukI,57
|
148
148
|
zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/app-start.sh,sha256=i2l0z3doDiKXr4OEU_zgsDYdL5jGJ0L43hVH7ruPohg,49
|
149
|
-
zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/app-test.sh,sha256=
|
149
|
+
zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/app-test.sh,sha256=9-GAWSy7zqGKl3R-fqV9KuV2jzXMkq6V_bAfALMr69I,294
|
150
150
|
zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/pulumi-destroy.sh,sha256=Yc-jb01oostiRMtrsTNWJXn_Fee5iDfv16L4DaoklEA,29
|
151
151
|
zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/pulumi-init-stack.sh,sha256=sXITZkR26khcNAu3LnPnWlZFnA9sHx5CTwTy9lWkAS8,126
|
152
152
|
zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/pulumi-up.sh,sha256=9nKPOYa-V8UOQeIeZsd3U9Tps-ELT4jDI71p9xCDPyk,24
|
@@ -1063,7 +1063,7 @@ zrb/builtin/generator/project/create.py,sha256=DlFGdYHWXQprw4yTeceNTIK0JrsRE4b0q
|
|
1063
1063
|
zrb/builtin/generator/project/template/.gitignore,sha256=9Sy-cmSDOIawqlmervgoO1eWMoJpOTUIneOpNqGW2Dw,27
|
1064
1064
|
zrb/builtin/generator/project/template/.python-version,sha256=rGeoqWHOE1NzOu73didX8_OyjR9O8b-XNp87WjKbO0s,7
|
1065
1065
|
zrb/builtin/generator/project/template/README.md,sha256=jNnkBuWhfab1HlcOqi0NKaM1O1NtTjchFrvOtR4KQPg,2026
|
1066
|
-
zrb/builtin/generator/project/template/project.sh,sha256=
|
1066
|
+
zrb/builtin/generator/project/template/project.sh,sha256=lN8XDvXx4csSf4z1XAimxUfrxWMJ1G_IHZ6LhrQraqw,1829
|
1067
1067
|
zrb/builtin/generator/project/template/requirements.txt,sha256=X6wrfgHOG6KaaMpDJEsXUp2Eyb-1oLY4e7QnMQqcq68,16
|
1068
1068
|
zrb/builtin/generator/project/template/template.env,sha256=mO3-iPEHihFbkBSr2VBZ15vyleL1S5MMpUKzGo9qtuw,124
|
1069
1069
|
zrb/builtin/generator/project/template/zrb_init.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -1159,7 +1159,7 @@ zrb/helper/loader/load_module.py,sha256=tTANOa0a6kt-G4Ls75vp-C1alo90NSSMlKSMHeyR
|
|
1159
1159
|
zrb/helper/map/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1160
1160
|
zrb/helper/map/conversion.py,sha256=029zwx2TS4ZpzDNs0JDXY0MvJ71TRow5IgEg7BtACN0,451
|
1161
1161
|
zrb/helper/string/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1162
|
-
zrb/helper/string/constant.py,sha256=
|
1162
|
+
zrb/helper/string/constant.py,sha256=JDmUQsmr1KeGd3SJMoPU_m9Bi1sAd5ghK080sXVSgkE,112
|
1163
1163
|
zrb/helper/string/conversion.py,sha256=FZQYZxpZj7Rjm5d-Q0jVHjY59CuEDdC5y0431TBqOcc,1430
|
1164
1164
|
zrb/helper/string/jinja.py,sha256=wxl_wY8gt7ini_I25LjogL2isUccEnNQZ7BMtVd32NE,330
|
1165
1165
|
zrb/helper/string/modification.py,sha256=aQCzU-PAyCg4nzPcbqDNP6keytP_pkBcl_18jq9ly0o,144
|
@@ -1172,31 +1172,31 @@ zrb/shell-scripts/notify.ps1,sha256=6_xPoIwuxARpYljcjVV-iRJS3gJqGfx-B6kj719cJ9o,
|
|
1172
1172
|
zrb/shell-scripts/rsync-util.sh,sha256=QzdhSBvUNMxB4U2B4m0Dxg9czGckRjB7Vk4A1ObG0-k,353
|
1173
1173
|
zrb/shell-scripts/ssh-util.sh,sha256=9lXDzw6oO8HuA4vdbfps_uQMMwKyNYX9fZkZgpK52g8,401
|
1174
1174
|
zrb/task/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1175
|
-
zrb/task/any_task.py,sha256=
|
1175
|
+
zrb/task/any_task.py,sha256=9wCAfZfkG2JDXJbXEaFORVgYCbFFrmV_A5CIJLe_mbc,36402
|
1176
1176
|
zrb/task/any_task_event_handler.py,sha256=vpO9t0fck8-oFu1KYptfcg2hXKRsk6V5je4Dg-Bl21o,359
|
1177
|
-
zrb/task/base_remote_cmd_task.py,sha256=
|
1177
|
+
zrb/task/base_remote_cmd_task.py,sha256=V9T1OxSwT63gribv6GiT0P75MKnbCH-giMifxDvLeoM,9027
|
1178
1178
|
zrb/task/checker.py,sha256=UJMxrHOolynt1ySCkwGffssBId_TKRmjZ4mqH-eI3WQ,3092
|
1179
|
-
zrb/task/cmd_task.py,sha256=
|
1179
|
+
zrb/task/cmd_task.py,sha256=kksuy9rpR1ZKs0Qh80PDeRUVPdn9DFKK92FxCznVBNk,13897
|
1180
1180
|
zrb/task/decorator.py,sha256=JLdAFe-mnIJFHpjeSXlC2tuhUCjGdTEonEjx1UwnXMA,2870
|
1181
|
-
zrb/task/docker_compose_task.py,sha256=
|
1181
|
+
zrb/task/docker_compose_task.py,sha256=sUT83nLOljDkrRWFZMpHBZtzCKMLGjW3DU_eG6FnGD0,13227
|
1182
1182
|
zrb/task/flow_task.py,sha256=nejLM2300IKden0laYv5_ggc6Ng-v2zmPNAEvOiMuPw,4666
|
1183
|
-
zrb/task/http_checker.py,sha256=
|
1184
|
-
zrb/task/notifier.py,sha256=
|
1183
|
+
zrb/task/http_checker.py,sha256=cbveMcFiB81zzr_t0C-tCTWf-ZnWHJmqLVSl0xRc8kY,5225
|
1184
|
+
zrb/task/notifier.py,sha256=7vFv2XM4ze2ZrBVsEOniSkP7HgRS4_5_-Db2Sq90UYY,5296
|
1185
1185
|
zrb/task/parallel.py,sha256=OnCdh4aQwL-N2ICNf3gshhqx5-Hq_QPZD3ycMHqrFRg,1042
|
1186
|
-
zrb/task/path_checker.py,sha256=
|
1187
|
-
zrb/task/path_watcher.py,sha256=
|
1188
|
-
zrb/task/port_checker.py,sha256=
|
1186
|
+
zrb/task/path_checker.py,sha256=jZzKEkzJcdPVJ0wr5pvqA17lhl8vEj7xKWi9oe45sNs,4153
|
1187
|
+
zrb/task/path_watcher.py,sha256=KLup_lEbxXyrSL1k3Lp-txEQjPqqSZ3TQG8UTAugCgU,6251
|
1188
|
+
zrb/task/port_checker.py,sha256=Ee_f2ZQ7pwQkQMNXf38C087xRPfr-UMLq7rTUSdbv6Y,4082
|
1189
1189
|
zrb/task/recurring_task.py,sha256=D6yMQlnchZo5F0LjhNRATUXkrfd6wdBEt6YYDcwBSRY,7261
|
1190
1190
|
zrb/task/remote_cmd_task.py,sha256=D3Uciarw164umukvTeDHSBRInaYJuOMyAPo4pFsK9Oc,3694
|
1191
|
-
zrb/task/resource_maker.py,sha256=
|
1192
|
-
zrb/task/rsync_task.py,sha256=
|
1191
|
+
zrb/task/resource_maker.py,sha256=fE2OiRo9y-FhSobPAuo8dnj55_ahUxvjQAY0Z5UX1Qg,6493
|
1192
|
+
zrb/task/rsync_task.py,sha256=BYaPPXbr-rezln-fy2aKhvoh32uti1QMvv2ticYLCd4,3929
|
1193
1193
|
zrb/task/task.py,sha256=mSnJ7wdySiuRGfc3oB3JiOuJvcuiroIYDgDIGnqbF5M,181
|
1194
|
-
zrb/task/time_watcher.py,sha256=
|
1194
|
+
zrb/task/time_watcher.py,sha256=vAb6IVG9aKxoWfqjUJpOLSCEzI8iT4606ol-auuRnbs,3951
|
1195
1195
|
zrb/task/base_task/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1196
|
-
zrb/task/base_task/base_task.py,sha256=
|
1196
|
+
zrb/task/base_task/base_task.py,sha256=MtqjAD_kl_iThuWUJhGzBnRuEhBtnNelku7emD_1_uQ,17697
|
1197
1197
|
zrb/task/base_task/component/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1198
|
-
zrb/task/base_task/component/base_task_model.py,sha256=
|
1199
|
-
zrb/task/base_task/component/common_task_model.py,sha256=
|
1198
|
+
zrb/task/base_task/component/base_task_model.py,sha256=lnlx8ltiKVlFYK5BVIxviWw4JUOlSYt9rReLdG3D__A,10383
|
1199
|
+
zrb/task/base_task/component/common_task_model.py,sha256=zxGrlK-RynzCLR-eBcMYC3e77MIFEtXnrGEJpmLkXR4,11222
|
1200
1200
|
zrb/task/base_task/component/pid_model.py,sha256=pWCjgD3J2Jimjq1Y9pkVczZMeFEIcy7Hm9eFGrHGUZE,296
|
1201
1201
|
zrb/task/base_task/component/renderer.py,sha256=LpQPNbkp1NvWgSQpzK11G1Ancbd_jKTgItCyIgAbCW4,4515
|
1202
1202
|
zrb/task/base_task/component/trackers.py,sha256=3sPccnP7capEHdQ-ceRig04ee28kvo2an9I7x-Z5ZU8,1959
|
@@ -1204,7 +1204,7 @@ zrb/task_env/constant.py,sha256=JdPhtZCTZlbW-jzG5vyFtpEXgTJ-Yx863LcrX_LiURY,44
|
|
1204
1204
|
zrb/task_env/env.py,sha256=2lwSExUmV9KRMfsvru_QOnJTzL7VByFgNF-Ikt_u1uY,4772
|
1205
1205
|
zrb/task_env/env_file.py,sha256=vpw780OmTRuDcrvmzCFwquJB1nldmZpQiQl1TA6B-k8,2907
|
1206
1206
|
zrb/task_group/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1207
|
-
zrb/task_group/group.py,sha256=
|
1207
|
+
zrb/task_group/group.py,sha256=mcy2og1zs-OflUP5jZdSNdXhvnvFWgB1rnZ_oe8v7RM,5966
|
1208
1208
|
zrb/task_input/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1209
1209
|
zrb/task_input/any_input.py,sha256=96RjYdtKabdzqEz-_C9P4EjS2C2d2kRTZSgqYkgJrF0,1908
|
1210
1210
|
zrb/task_input/base_input.py,sha256=9paiJPu_Q7ejkHlloWoZ8g0dZKeVUY_TD3EQ16wgEi4,5483
|
@@ -1216,8 +1216,8 @@ zrb/task_input/int_input.py,sha256=h4fRLyBaX6_fK9jdXoQKmwKZknUqtl-XMG3SRMa2f08,4
|
|
1216
1216
|
zrb/task_input/password_input.py,sha256=L8oXrImqDd8fl2pc5epvYSsCcTbDgAXy8awYsUYUBnE,4030
|
1217
1217
|
zrb/task_input/str_input.py,sha256=mtQEwrFmncXrxxJ1bmX7URM1A2pPGlQttQGNMQHhfmc,4042
|
1218
1218
|
zrb/task_input/task_input.py,sha256=fa6yneGp3Kp8DMf30zmTP797r5xfAzSBopXQmtx2Wxc,2020
|
1219
|
-
zrb-0.
|
1220
|
-
zrb-0.
|
1221
|
-
zrb-0.
|
1222
|
-
zrb-0.
|
1223
|
-
zrb-0.
|
1219
|
+
zrb-0.6.0.dist-info/entry_points.txt,sha256=xTgXc1kBKYhJHEujdaSPHUcJT3-hbyP1mLgwkv-5sSk,40
|
1220
|
+
zrb-0.6.0.dist-info/LICENSE,sha256=WfnGCl8G60EYOPAEkuc8C9m9pdXWDe08NsKj3TBbxsM,728
|
1221
|
+
zrb-0.6.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
1222
|
+
zrb-0.6.0.dist-info/METADATA,sha256=kidhyxx7cd7RhReXkVCNEZL67F3zyssYVVq8CHTNodE,16407
|
1223
|
+
zrb-0.6.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|