zrb 0.6.0__py3-none-any.whl → 0.6.1__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 +24 -20
- zrb/__main__.py +5 -5
- zrb/action/runner.py +22 -30
- zrb/advertisement.py +10 -9
- zrb/builtin/__init__.py +18 -16
- zrb/builtin/base64.py +13 -18
- zrb/builtin/devtool/__init__.py +14 -3
- zrb/builtin/devtool/devtool_install.py +207 -221
- zrb/builtin/env.py +9 -12
- zrb/builtin/eval.py +9 -9
- zrb/builtin/explain.py +73 -74
- zrb/builtin/generator/__init__.py +7 -11
- zrb/builtin/generator/app_generator/add.py +86 -87
- zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/add.py +78 -77
- zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/_checker.py +6 -6
- zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/_common.py +14 -15
- zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/container.py +32 -32
- zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/deployment.py +29 -30
- zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/image.py +1 -3
- zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/local.py +5 -4
- zrb/builtin/generator/app_generator/template/base/_automate/generate_snake_zrb_meta_template_name/template/src/kebab-zrb-app-name/deployment/__main__.py +24 -32
- zrb/builtin/generator/app_generator/template/build-custom-image/_automate/generate_snake_zrb_meta_template_name/add.py +89 -87
- zrb/builtin/generator/app_generator/template/build-custom-image/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/_common.py +14 -15
- zrb/builtin/generator/app_generator/template/build-custom-image/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/container.py +42 -54
- zrb/builtin/generator/app_generator/template/build-custom-image/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/deployment.py +34 -32
- zrb/builtin/generator/app_generator/template/build-custom-image/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/image.py +19 -22
- zrb/builtin/generator/app_generator/template/build-custom-image/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/local.py +18 -18
- zrb/builtin/generator/app_generator/template/http-port/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/_checker.py +10 -10
- zrb/builtin/generator/app_generator/template/http-port-build-custom-image/_automate/generate_snake_zrb_meta_template_name/template/_automate/snake_zrb_app_name/local.py +19 -19
- zrb/builtin/generator/app_generator/template/use-helm/_automate/generate_snake_zrb_meta_template_name/template/src/kebab-zrb-app-name/deployment/__main__.py +12 -14
- zrb/builtin/generator/cmd_task/add.py +23 -25
- zrb/builtin/generator/cmd_task/template/_automate/snake_zrb_task_name.py +3 -5
- zrb/builtin/generator/common/helper.py +15 -20
- zrb/builtin/generator/common/task_factory.py +29 -26
- zrb/builtin/generator/common/task_input.py +97 -91
- zrb/builtin/generator/docker_compose_task/add.py +38 -39
- zrb/builtin/generator/docker_compose_task/template/_automate/snake_zrb_task_name.py +13 -19
- zrb/builtin/generator/docker_compose_task/template/src/kebab-zrb-task-name/image/main.py +18 -14
- zrb/builtin/generator/fastapp/add.py +94 -90
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_checker.py +28 -27
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_config.py +68 -39
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_env.py +24 -22
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_env_file.py +12 -12
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_get_start_microservices.py +43 -41
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_helper.py +23 -24
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/_input.py +21 -20
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/app-load-test.sh +1 -1
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/app-start.sh +1 -1
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/cmd/app-test.sh +2 -2
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/container.py +46 -39
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/deployment.py +28 -20
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/frontend.py +21 -27
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/image.py +23 -18
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/load_test.py +35 -36
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/local.py +68 -58
- zrb/builtin/generator/fastapp/template/_automate/snake_zrb_app_name/test.py +24 -38
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/__main__.py +23 -21
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/_common.py +72 -75
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/app_helper.py +70 -75
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/helm_postgresql_helper.py +18 -21
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/helm_rabbitmq_helper.py +11 -19
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/helm_redpanda_helper.py +18 -15
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/deployment/helm_signoz_helper.py +17 -21
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/docker-compose.yml +12 -12
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/loadtest/locustfile.py +10 -12
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/Dockerfile +1 -0
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/app.py +35 -30
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/app_lifespan.py +21 -17
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/app_state.py +3 -2
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/db_connection.py +18 -20
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/frontend_index.py +5 -6
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/log.py +7 -15
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/messagebus.py +38 -34
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/component/rpc.py +19 -18
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/config.py +68 -103
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/error.py +11 -10
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/__init__.py +2 -4
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/kafka/admin.py +38 -35
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/kafka/consumer.py +38 -45
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/kafka/publisher.py +26 -29
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/messagebus.py +8 -14
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/mock.py +12 -8
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/rabbitmq/admin.py +37 -44
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/rabbitmq/consumer.py +42 -67
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/messagebus/rabbitmq/publisher.py +32 -55
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/model/repo_model.py +11 -10
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/repo/__init__.py +2 -2
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/repo/db_entity_mixin.py +3 -6
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/repo/db_repo.py +76 -83
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/repo/repo.py +5 -5
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/repo/search_filter.py +1 -0
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/rpc/__init__.py +1 -1
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/rpc/messagebus/caller.py +17 -19
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/rpc/messagebus/server.py +14 -18
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/rpc/rpc.py +15 -28
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/schema/__init__.py +1 -1
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/schema/base_schema.py +6 -5
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/serializer/__init__.py +1 -3
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/core/serializer/serializer.py +3 -4
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/helper/async_task.py +3 -5
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/helper/conversion.py +10 -10
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/helper/migration.py +6 -10
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/migrate.py +3 -2
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/api.py +7 -12
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/__init__.py +4 -6
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/access_token_scheme.py +9 -10
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/access_token_util.py +6 -5
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/authorizer.py +4 -4
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/bearer_token_scheme.py +1 -1
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/model/user_model.py +8 -10
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/password_hasher.py +1 -1
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/refresh_token_util.py +7 -6
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/repo/group_repo.py +3 -8
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/repo/permission_repo.py +3 -7
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/repo/user_repo.py +3 -5
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/component/user.py +12 -7
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/__init__.py +7 -12
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/access_token/scheme.py +7 -12
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/access_token/util.py +20 -30
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/authorizer/authorizer.py +1 -3
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/authorizer/rpc_authorizer.py +5 -12
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/password_hasher/bcrypt_password_hasher.py +3 -8
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/password_hasher/password_hasher.py +0 -1
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/core/refresh_token/util.py +15 -21
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/group/api.py +42 -49
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/group/model.py +3 -7
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/group/repo.py +18 -16
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/group/rpc.py +26 -41
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/permission/api.py +46 -51
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/permission/model.py +5 -7
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/permission/repo.py +11 -8
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/permission/rpc.py +28 -45
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/table.py +10 -10
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/user/api.py +60 -72
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/user/model.py +32 -61
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/user/repo.py +33 -36
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/entity/user/rpc.py +42 -61
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/event.py +2 -4
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/migrate.py +3 -5
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/register_module.py +11 -12
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/register_permission.py +19 -26
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/rpc.py +5 -13
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/schema/group.py +6 -4
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/schema/permission.py +3 -1
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/schema/request.py +1 -0
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/schema/token.py +2 -2
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/auth/schema/user.py +4 -3
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/api.py +4 -5
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/component/model/activity_model.py +3 -9
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/component/repo/activity_repo.py +3 -7
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/core/historical_repo_model.py +13 -13
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/entity/activity/api.py +22 -23
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/entity/activity/event.py +5 -7
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/entity/activity/model.py +2 -6
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/entity/activity/repo.py +8 -8
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/entity/activity/rpc.py +28 -45
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/entity/table.py +3 -3
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/event.py +4 -8
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/migrate.py +2 -4
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/register_module.py +10 -11
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/rpc.py +3 -5
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/module/log/schema/activity.py +3 -1
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/src/requirements.txt +12 -12
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/test/auth/test_group_crud.py +76 -106
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/test/auth/test_permission_crud.py +73 -103
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/test/auth/test_user_crud.py +92 -122
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/test/auth/test_user_login.py +107 -134
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/test/conftest.py +2 -2
- zrb/builtin/generator/fastapp/template/src/kebab-zrb-app-name/test/test_liveness_and_readiness.py +8 -15
- zrb/builtin/generator/fastapp_crud/add.py +74 -79
- zrb/builtin/generator/fastapp_crud/helper.py +51 -48
- zrb/builtin/generator/fastapp_crud/task_factory.py +17 -14
- zrb/builtin/generator/fastapp_crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/component/model/snake_zrb_entity_name_model.py +2 -2
- zrb/builtin/generator/fastapp_crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/component/repo/snake_zrb_entity_name_repo.py +3 -2
- zrb/builtin/generator/fastapp_crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/entity/snake_zrb_entity_name/api.py +58 -40
- zrb/builtin/generator/fastapp_crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/entity/snake_zrb_entity_name/model.py +7 -3
- zrb/builtin/generator/fastapp_crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/entity/snake_zrb_entity_name/repo.py +9 -4
- zrb/builtin/generator/fastapp_crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/entity/snake_zrb_entity_name/rpc.py +32 -39
- zrb/builtin/generator/fastapp_crud/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/schema/snake_zrb_entity_name.py +3 -1
- zrb/builtin/generator/fastapp_crud/template/src/kebab-zrb-app-name/test/snake_zrb_module_name/test_snake_zrb_entity_name.py +68 -98
- zrb/builtin/generator/fastapp_field/add.py +143 -85
- zrb/builtin/generator/fastapp_field/helper.py +184 -125
- zrb/builtin/generator/fastapp_module/add.py +90 -67
- zrb/builtin/generator/fastapp_module/helper.py +141 -155
- zrb/builtin/generator/fastapp_module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/api.py +3 -2
- zrb/builtin/generator/fastapp_module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/entity/table.py +3 -3
- zrb/builtin/generator/fastapp_module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/event.py +3 -5
- zrb/builtin/generator/fastapp_module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/migrate.py +2 -4
- zrb/builtin/generator/fastapp_module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/register_module.py +10 -11
- zrb/builtin/generator/fastapp_module/template/src/kebab-zrb-app-name/src/module/snake_zrb_module_name/rpc.py +3 -5
- zrb/builtin/generator/pip_package/add.py +39 -40
- zrb/builtin/generator/pip_package/template/_automate/snake_zrb_package_name/local.py +30 -30
- zrb/builtin/generator/pip_package/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/__init__.py +1 -0
- zrb/builtin/generator/pip_package/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/__main__.py +1 -0
- zrb/builtin/generator/pip_package/template/src/kebab-zrb-package-name/src/snake_zrb_package_name/util.py +2 -2
- zrb/builtin/generator/plugin/create.py +39 -36
- zrb/builtin/generator/plugin/template/src/snake_zrb_package_name/__init__.py +1 -1
- zrb/builtin/generator/plugin/template/src/snake_zrb_package_name/__main__.py +1 -0
- zrb/builtin/generator/plugin/template/src/snake_zrb_package_name/task/example_task.py +6 -4
- zrb/builtin/generator/plugin/template/zrb_init.py +27 -27
- zrb/builtin/generator/project/create.py +38 -46
- zrb/builtin/generator/project/template/.flake8 +3 -0
- zrb/builtin/generator/project/template/project.sh +19 -10
- zrb/builtin/generator/project_task/task_factory.py +60 -61
- zrb/builtin/generator/project_task/template/_automate/_project/__init__.py +2 -2
- zrb/builtin/generator/project_task/template/_automate/_project/build_project_images.py +4 -4
- zrb/builtin/generator/project_task/template/_automate/_project/deploy_project.py +4 -4
- zrb/builtin/generator/project_task/template/_automate/_project/destroy_project.py +4 -4
- zrb/builtin/generator/project_task/template/_automate/_project/push_project_images.py +4 -4
- zrb/builtin/generator/project_task/template/_automate/_project/remove_project_containers.py +4 -4
- zrb/builtin/generator/project_task/template/_automate/_project/start_project.py +4 -4
- zrb/builtin/generator/project_task/template/_automate/_project/start_project_containers.py +4 -4
- zrb/builtin/generator/project_task/template/_automate/_project/stop_project_containers.py +4 -4
- zrb/builtin/generator/python_task/add.py +25 -33
- zrb/builtin/generator/python_task/template/_automate/snake_zrb_task_name.py +8 -7
- zrb/builtin/generator/simple_python_app/add.py +81 -75
- zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/_common.py +14 -15
- zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/container.py +46 -61
- zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/deployment.py +34 -32
- zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/image.py +19 -22
- zrb/builtin/generator/simple_python_app/template/_automate/snake_zrb_app_name/local.py +23 -25
- zrb/builtin/generator/simple_python_app/template/src/kebab-zrb-app-name/deployment/__main__.py +24 -32
- zrb/builtin/generator/simple_python_app/template/src/kebab-zrb-app-name/src/main.py +18 -14
- zrb/builtin/git.py +46 -46
- zrb/builtin/group.py +13 -34
- zrb/builtin/helper/reccuring_action.py +26 -29
- zrb/builtin/md5.py +17 -30
- zrb/builtin/process.py +19 -19
- zrb/builtin/project.py +13 -15
- zrb/builtin/say.py +69 -88
- zrb/builtin/schedule.py +15 -19
- zrb/builtin/ubuntu.py +44 -35
- zrb/builtin/update.py +5 -5
- zrb/builtin/version.py +3 -7
- zrb/builtin/watch_changes.py +24 -25
- zrb/config/config.py +19 -18
- zrb/helper/accessories/color.py +18 -6
- zrb/helper/accessories/icon.py +24 -3
- zrb/helper/accessories/name.py +120 -28
- zrb/helper/advertisement.py +9 -13
- zrb/helper/callable.py +2 -4
- zrb/helper/cli.py +27 -31
- zrb/helper/codemod/add_argument_to_function.py +3 -4
- zrb/helper/codemod/add_argument_to_function_call.py +4 -7
- zrb/helper/codemod/add_assert_resource.py +7 -7
- zrb/helper/codemod/add_function_call.py +3 -5
- zrb/helper/codemod/add_import_module.py +15 -26
- zrb/helper/codemod/add_key_value_to_dict.py +7 -10
- zrb/helper/codemod/add_property_to_class.py +10 -8
- zrb/helper/codemod/add_upstream_to_task.py +21 -33
- zrb/helper/codemod/append_code_to_function.py +6 -13
- zrb/helper/codemod/format_code.py +2 -1
- zrb/helper/default_env.py +25 -25
- zrb/helper/docker_compose/fetch_external_env.py +18 -18
- zrb/helper/docker_compose/file.py +5 -4
- zrb/helper/docstring.py +44 -47
- zrb/helper/env_map/fetch.py +7 -12
- zrb/helper/file/copy_tree.py +12 -17
- zrb/helper/file/match.py +6 -7
- zrb/helper/file/text.py +8 -6
- zrb/helper/git/detect_changes.py +9 -8
- zrb/helper/loader/load_module.py +14 -13
- zrb/helper/log.py +4 -3
- zrb/helper/map/conversion.py +4 -5
- zrb/helper/python_task.py +2 -4
- zrb/helper/render_data.py +25 -18
- zrb/helper/string/constant.py +2 -2
- zrb/helper/string/conversion.py +17 -16
- zrb/helper/string/jinja.py +2 -2
- zrb/helper/typecheck.py +6 -4
- zrb/helper/typing.py +10 -2
- zrb/helper/util.py +44 -40
- zrb/task/any_task.py +251 -251
- zrb/task/base_remote_cmd_task.py +76 -59
- zrb/task/base_task/base_task.py +95 -108
- zrb/task/base_task/component/base_task_model.py +73 -71
- zrb/task/base_task/component/common_task_model.py +42 -29
- zrb/task/base_task/component/pid_model.py +3 -5
- zrb/task/base_task/component/renderer.py +26 -36
- zrb/task/base_task/component/trackers.py +6 -9
- zrb/task/checker.py +14 -9
- zrb/task/cmd_task.py +102 -100
- zrb/task/decorator.py +19 -13
- zrb/task/docker_compose_task.py +127 -98
- zrb/task/flow_task.py +16 -19
- zrb/task/http_checker.py +40 -36
- zrb/task/notifier.py +50 -38
- zrb/task/parallel.py +3 -3
- zrb/task/path_checker.py +34 -27
- zrb/task/path_watcher.py +49 -40
- zrb/task/port_checker.py +33 -26
- zrb/task/recurring_task.py +36 -42
- zrb/task/remote_cmd_task.py +31 -28
- zrb/task/resource_maker.py +66 -52
- zrb/task/rsync_task.py +24 -21
- zrb/task/task.py +4 -3
- zrb/task/time_watcher.py +36 -31
- zrb/task_env/constant.py +1 -1
- zrb/task_env/env.py +33 -31
- zrb/task_env/env_file.py +24 -23
- zrb/task_group/group.py +27 -30
- zrb/task_input/any_input.py +18 -16
- zrb/task_input/base_input.py +26 -26
- zrb/task_input/bool_input.py +6 -6
- zrb/task_input/choice_input.py +11 -9
- zrb/task_input/constant.py +1 -1
- zrb/task_input/float_input.py +6 -5
- zrb/task_input/int_input.py +8 -8
- zrb/task_input/password_input.py +9 -9
- zrb/task_input/str_input.py +8 -8
- zrb/task_input/task_input.py +4 -2
- {zrb-0.6.0.dist-info → zrb-0.6.1.dist-info}/METADATA +3 -1
- {zrb-0.6.0.dist-info → zrb-0.6.1.dist-info}/RECORD +316 -315
- {zrb-0.6.0.dist-info → zrb-0.6.1.dist-info}/LICENSE +0 -0
- {zrb-0.6.0.dist-info → zrb-0.6.1.dist-info}/WHEEL +0 -0
- {zrb-0.6.0.dist-info → zrb-0.6.1.dist-info}/entry_points.txt +0 -0
zrb/task/any_task.py
CHANGED
@@ -1,34 +1,42 @@
|
|
1
|
+
from abc import ABC, abstractmethod
|
2
|
+
|
1
3
|
from zrb.helper.typing import (
|
2
|
-
Any,
|
3
|
-
|
4
|
+
Any,
|
5
|
+
Callable,
|
6
|
+
Iterable,
|
7
|
+
JinjaTemplate,
|
8
|
+
List,
|
9
|
+
Mapping,
|
10
|
+
Optional,
|
11
|
+
TypeVar,
|
12
|
+
Union,
|
4
13
|
)
|
5
|
-
from abc import ABC, abstractmethod
|
6
|
-
from zrb.task_env.env_file import EnvFile
|
7
14
|
from zrb.task_env.env import Env
|
15
|
+
from zrb.task_env.env_file import EnvFile
|
8
16
|
from zrb.task_input.any_input import AnyInput
|
9
17
|
|
10
18
|
# flake8: noqa E501
|
11
|
-
TAnyTask = TypeVar(
|
19
|
+
TAnyTask = TypeVar("TAnyTask", bound="AnyTask")
|
12
20
|
|
13
21
|
|
14
22
|
class AnyTask(ABC):
|
15
|
-
|
23
|
+
"""
|
16
24
|
Abstract base class for defining tasks in a task management system.
|
17
25
|
|
18
|
-
This class acts as a template for creating new task types. To define a new task,
|
19
|
-
extend this class and implement all its abstract methods. The `AnyTask` class is
|
26
|
+
This class acts as a template for creating new task types. To define a new task,
|
27
|
+
extend this class and implement all its abstract methods. The `AnyTask` class is
|
20
28
|
considered atomic and is not broken into multiple interfaces.
|
21
29
|
|
22
|
-
Subclasses should implement the abstract methods to define custom behavior for
|
30
|
+
Subclasses should implement the abstract methods to define custom behavior for
|
23
31
|
task execution, state transitions, and other functionalities.
|
24
|
-
|
32
|
+
"""
|
25
33
|
|
26
34
|
@abstractmethod
|
27
35
|
def copy(self) -> TAnyTask:
|
28
|
-
|
36
|
+
"""
|
29
37
|
Creates and returns a copy of the current task.
|
30
38
|
|
31
|
-
The copied task can be modified using various setter methods like `set_name`,
|
39
|
+
The copied task can be modified using various setter methods like `set_name`,
|
32
40
|
`set_description`, and others, depending on the subclass implementation.
|
33
41
|
|
34
42
|
Returns:
|
@@ -39,16 +47,16 @@ class AnyTask(ABC):
|
|
39
47
|
>>> task = Task(name='my-task', cmd='echo hello')
|
40
48
|
>>> copied_task = task.copy()
|
41
49
|
>>> copied_task.set_name('new_name')
|
42
|
-
|
50
|
+
"""
|
43
51
|
pass
|
44
52
|
|
45
53
|
@abstractmethod
|
46
54
|
def run(self, *args: Any, **kwargs: Any) -> Any:
|
47
|
-
|
55
|
+
"""
|
48
56
|
Executes the main logic of the task.
|
49
57
|
|
50
|
-
This method should be implemented in subclasses to define the
|
51
|
-
task's primary functionality. The specific behavior and the return value
|
58
|
+
This method should be implemented in subclasses to define the
|
59
|
+
task's primary functionality. The specific behavior and the return value
|
52
60
|
depend on the task's nature and purpose.
|
53
61
|
|
54
62
|
Args:
|
@@ -56,7 +64,7 @@ class AnyTask(ABC):
|
|
56
64
|
kwargs (Any): Arbitrary keyword arguments.
|
57
65
|
|
58
66
|
Returns:
|
59
|
-
Any: The result of the task execution, the type of which is determined by
|
67
|
+
Any: The result of the task execution, the type of which is determined by
|
60
68
|
the specific task implementation.
|
61
69
|
|
62
70
|
Examples:
|
@@ -65,18 +73,18 @@ class AnyTask(ABC):
|
|
65
73
|
>>> async def run(self, *args: Any, **kwargs: Any) -> int:
|
66
74
|
>>> self.print_out('Doing some calculation')
|
67
75
|
>>> return 42
|
68
|
-
|
76
|
+
"""
|
69
77
|
pass
|
70
78
|
|
71
79
|
@abstractmethod
|
72
80
|
def check(self) -> bool:
|
73
|
-
|
81
|
+
"""
|
74
82
|
Checks if the current task is `ready`.
|
75
83
|
|
76
84
|
Any other tasks depends on the current task, will be `started` once the current task is `ready`.
|
77
85
|
|
78
|
-
This method should be implemented to define the criteria for considering the task
|
79
|
-
`ready`. The specifics of this completion depend on the task's
|
86
|
+
This method should be implemented to define the criteria for considering the task
|
87
|
+
`ready`. The specifics of this completion depend on the task's
|
80
88
|
nature and the subclass implementation.
|
81
89
|
|
82
90
|
Returns:
|
@@ -91,12 +99,12 @@ class AnyTask(ABC):
|
|
91
99
|
>>> return 42
|
92
100
|
>>> async def check(self) -> bool:
|
93
101
|
>>> return self._completed
|
94
|
-
|
102
|
+
"""
|
95
103
|
pass
|
96
104
|
|
97
105
|
@abstractmethod
|
98
106
|
def set_xcom(self, key: str, value: Any) -> str:
|
99
|
-
|
107
|
+
"""
|
100
108
|
Set xcom for cross task communication.
|
101
109
|
|
102
110
|
Argss:
|
@@ -105,7 +113,7 @@ class AnyTask(ABC):
|
|
105
113
|
|
106
114
|
Returns:
|
107
115
|
str: Empty string
|
108
|
-
|
116
|
+
|
109
117
|
Examples:
|
110
118
|
>>> from zrb import Task
|
111
119
|
>>> class MyTask(Task):
|
@@ -113,12 +121,12 @@ class AnyTask(ABC):
|
|
113
121
|
>>> self.set_xcom('magic_word', 'hello')
|
114
122
|
>>> magic_word = self.get_xcom('magic_word')
|
115
123
|
>>> return 42
|
116
|
-
|
124
|
+
"""
|
117
125
|
pass
|
118
126
|
|
119
127
|
@abstractmethod
|
120
128
|
def set_task_xcom(self, key: str, value: Any) -> str:
|
121
|
-
|
129
|
+
"""
|
122
130
|
Set task xcom for cross task communication.
|
123
131
|
|
124
132
|
Argss:
|
@@ -127,7 +135,7 @@ class AnyTask(ABC):
|
|
127
135
|
|
128
136
|
Returns:
|
129
137
|
str: Empty string
|
130
|
-
|
138
|
+
|
131
139
|
Examples:
|
132
140
|
>>> from zrb import Task
|
133
141
|
>>> class MyTask(Task):
|
@@ -135,12 +143,12 @@ class AnyTask(ABC):
|
|
135
143
|
>>> self.set_task_xcom('magic_word', 'hello')
|
136
144
|
>>> magic_word = self.get_xcom(f'{self.get_name()}.magic_word')
|
137
145
|
>>> return 42
|
138
|
-
|
146
|
+
"""
|
139
147
|
pass
|
140
148
|
|
141
149
|
@abstractmethod
|
142
150
|
def get_xcom(self, key: str) -> str:
|
143
|
-
|
151
|
+
"""
|
144
152
|
Get xcom value for cross task communication.
|
145
153
|
|
146
154
|
Argss:
|
@@ -148,22 +156,22 @@ class AnyTask(ABC):
|
|
148
156
|
|
149
157
|
Returns:
|
150
158
|
str: Value of xcom
|
151
|
-
|
159
|
+
|
152
160
|
Examples:
|
153
161
|
>>> from zrb import Task
|
154
162
|
>>> class MyTask(Task):
|
155
163
|
>>> async def run(self, *args: Any, **kwargs: Any) -> int:
|
156
164
|
>>> return self.get_xcom('magic_word')
|
157
|
-
|
165
|
+
"""
|
158
166
|
pass
|
159
167
|
|
160
168
|
@abstractmethod
|
161
169
|
def on_triggered(self):
|
162
|
-
|
170
|
+
"""
|
163
171
|
Defines actions to perform when the task status is set to `triggered`.
|
164
172
|
|
165
|
-
Implement this method to specify behavior when the task transitions to the
|
166
|
-
`triggered` state. This could involve setting up prerequisites or sending
|
173
|
+
Implement this method to specify behavior when the task transitions to the
|
174
|
+
`triggered` state. This could involve setting up prerequisites or sending
|
167
175
|
notifications.
|
168
176
|
|
169
177
|
Examples:
|
@@ -171,16 +179,16 @@ class AnyTask(ABC):
|
|
171
179
|
>>> class MyTask(Task):
|
172
180
|
>>> async def on_triggered(self):
|
173
181
|
>>> self.log_info('Task has been triggered')
|
174
|
-
|
182
|
+
"""
|
175
183
|
pass
|
176
184
|
|
177
185
|
@abstractmethod
|
178
186
|
def on_waiting(self):
|
179
|
-
|
187
|
+
"""
|
180
188
|
Defines actions to perform when the task status is set to `waiting`.
|
181
189
|
|
182
|
-
Implement this method to specify behavior when the task transitions to the
|
183
|
-
`waiting` state. This state usually indicates the task is waiting for some
|
190
|
+
Implement this method to specify behavior when the task transitions to the
|
191
|
+
`waiting` state. This state usually indicates the task is waiting for some
|
184
192
|
condition or prerequisite to be met.
|
185
193
|
|
186
194
|
Examples:
|
@@ -188,31 +196,31 @@ class AnyTask(ABC):
|
|
188
196
|
>>> class MyTask(Task):
|
189
197
|
>>> async def on_waiting(self):
|
190
198
|
>>> self.log_info('Task is waiting to be started')
|
191
|
-
|
199
|
+
"""
|
192
200
|
pass
|
193
201
|
|
194
202
|
@abstractmethod
|
195
203
|
def on_skipped(self):
|
196
|
-
|
204
|
+
"""
|
197
205
|
Defines actions to perform when the task status is set to `skipped`.
|
198
206
|
|
199
|
-
Implement this method to specify behavior when the task is skipped. This could
|
207
|
+
Implement this method to specify behavior when the task is skipped. This could
|
200
208
|
include logging information, cleaning up resources, or any other necessary steps.
|
201
209
|
|
202
210
|
Examples:
|
203
211
|
>>> from zrb import Task
|
204
212
|
>>> class MyTask(Task):
|
205
213
|
>>> async def on_skipped(self):
|
206
|
-
>>> self.log_info('Task was skipped')
|
207
|
-
|
214
|
+
>>> self.log_info('Task was skipped')
|
215
|
+
"""
|
208
216
|
pass
|
209
217
|
|
210
218
|
@abstractmethod
|
211
219
|
def on_started(self):
|
212
|
-
|
220
|
+
"""
|
213
221
|
Defines actions to perform when the task status is set to 'started'.
|
214
222
|
|
215
|
-
Implement this method to specify behavior when the task starts its execution. This
|
223
|
+
Implement this method to specify behavior when the task starts its execution. This
|
216
224
|
could involve initializing resources, logging, or other startup procedures.
|
217
225
|
|
218
226
|
Examples:
|
@@ -220,16 +228,16 @@ class AnyTask(ABC):
|
|
220
228
|
>>> class MyTask(Task):
|
221
229
|
>>> async def on_started(self):
|
222
230
|
>>> self.log_info('Task has started')
|
223
|
-
|
231
|
+
"""
|
224
232
|
pass
|
225
233
|
|
226
234
|
@abstractmethod
|
227
235
|
def on_ready(self):
|
228
|
-
|
236
|
+
"""
|
229
237
|
Defines actions to be performed when the task status is `ready`.
|
230
238
|
|
231
|
-
This method should be implemented in subclasses to specify
|
232
|
-
actions that occur when the task reaches the `ready` state. This can include
|
239
|
+
This method should be implemented in subclasses to specify
|
240
|
+
actions that occur when the task reaches the `ready` state. This can include
|
233
241
|
any cleanup, notification, or follow-up actions specific to the task.
|
234
242
|
|
235
243
|
Examples:
|
@@ -237,16 +245,16 @@ class AnyTask(ABC):
|
|
237
245
|
>>> class MyTask(Task):
|
238
246
|
>>> async def on_ready(self):
|
239
247
|
>>> self.print_out('The task is ready')
|
240
|
-
|
248
|
+
"""
|
241
249
|
pass
|
242
250
|
|
243
251
|
@abstractmethod
|
244
252
|
def on_failed(self, is_last_attempt: bool, exception: Exception):
|
245
|
-
|
253
|
+
"""
|
246
254
|
Specifies the behavior when the task execution fails.
|
247
255
|
|
248
|
-
This method should be implemented in subclasses to handle task
|
249
|
-
failure scenarios. It can include logging the error, performing retries, or
|
256
|
+
This method should be implemented in subclasses to handle task
|
257
|
+
failure scenarios. It can include logging the error, performing retries, or
|
250
258
|
any other failure handling mechanisms.
|
251
259
|
|
252
260
|
Args:
|
@@ -261,16 +269,16 @@ class AnyTask(ABC):
|
|
261
269
|
>>> self.print_out('The task has failed with no remaining retries')
|
262
270
|
>>> else:
|
263
271
|
>>> self.print_out('The task failed, retrying...')
|
264
|
-
|
272
|
+
"""
|
265
273
|
pass
|
266
274
|
|
267
275
|
@abstractmethod
|
268
276
|
def on_retry(self):
|
269
|
-
|
277
|
+
"""
|
270
278
|
Defines actions to perform when the task is retried.
|
271
279
|
|
272
|
-
Implement this method to specify behavior when the task is retried after a failure.
|
273
|
-
This could include resetting states, logging the retry attempt, or other necessary
|
280
|
+
Implement this method to specify behavior when the task is retried after a failure.
|
281
|
+
This could include resetting states, logging the retry attempt, or other necessary
|
274
282
|
steps before re-execution.
|
275
283
|
|
276
284
|
Examples:
|
@@ -278,22 +286,22 @@ class AnyTask(ABC):
|
|
278
286
|
>>> class MyTask(Task):
|
279
287
|
>>> async def on_retry(self):
|
280
288
|
>>> self.log_info('Retrying task')
|
281
|
-
|
289
|
+
"""
|
282
290
|
pass
|
283
291
|
|
284
292
|
@abstractmethod
|
285
293
|
def to_function(
|
286
294
|
self,
|
287
|
-
env_prefix: str =
|
295
|
+
env_prefix: str = "",
|
288
296
|
raise_error: bool = True,
|
289
297
|
is_async: bool = False,
|
290
|
-
show_done_info: bool = True
|
298
|
+
show_done_info: bool = True,
|
291
299
|
) -> Callable[..., Any]:
|
292
|
-
|
300
|
+
"""
|
293
301
|
Converts the current task into a callable function.
|
294
302
|
|
295
|
-
This method should be implemented to allow the task to be executed as a function.
|
296
|
-
Parameters can be used to modify the behavior of the generated function, such as
|
303
|
+
This method should be implemented to allow the task to be executed as a function.
|
304
|
+
Parameters can be used to modify the behavior of the generated function, such as
|
297
305
|
raising errors, asynchronous execution, and logging.
|
298
306
|
|
299
307
|
Args:
|
@@ -314,16 +322,16 @@ class AnyTask(ABC):
|
|
314
322
|
>>> task = MyTask()
|
315
323
|
>>> fn = task.to_function()
|
316
324
|
>>> fn()
|
317
|
-
|
325
|
+
"""
|
318
326
|
pass
|
319
327
|
|
320
328
|
@abstractmethod
|
321
329
|
def insert_checker(self, *checkers: TAnyTask):
|
322
|
-
|
330
|
+
"""
|
323
331
|
Inserts one or more `AnyTask` instances at the beginning of the current task's checker list.
|
324
332
|
|
325
|
-
This method is used to define dependencies for the current task. Tasks in the checker list are
|
326
|
-
executed before the current task. Adding a task to the beginning of the list means it will be
|
333
|
+
This method is used to define dependencies for the current task. Tasks in the checker list are
|
334
|
+
executed before the current task. Adding a task to the beginning of the list means it will be
|
327
335
|
executed earlier than those already in the list.
|
328
336
|
|
329
337
|
Args:
|
@@ -334,15 +342,15 @@ class AnyTask(ABC):
|
|
334
342
|
>>> task = Task(name='task')
|
335
343
|
>>> checker_task = Task(name='checker-task')
|
336
344
|
>>> task.insert_checker(checker_task)
|
337
|
-
|
345
|
+
"""
|
338
346
|
pass
|
339
347
|
|
340
348
|
@abstractmethod
|
341
349
|
def add_checker(self, *checkers: TAnyTask):
|
342
|
-
|
350
|
+
"""
|
343
351
|
Adds one or more `AnyTask` instances to the end of the current task's checker list.
|
344
352
|
|
345
|
-
This method appends tasks to the checker list, indicating that these tasks should be executed
|
353
|
+
This method appends tasks to the checker list, indicating that these tasks should be executed
|
346
354
|
before the current task, but after any tasks already in the checker list.
|
347
355
|
|
348
356
|
Args:
|
@@ -353,16 +361,16 @@ class AnyTask(ABC):
|
|
353
361
|
>>> task = Task(name='task')
|
354
362
|
>>> checker_task = Task(name='checker-task')
|
355
363
|
>>> task.add_checker(checker_task)
|
356
|
-
|
364
|
+
"""
|
357
365
|
pass
|
358
366
|
|
359
367
|
@abstractmethod
|
360
368
|
def insert_upstream(self, *upstreams: TAnyTask):
|
361
|
-
|
369
|
+
"""
|
362
370
|
Inserts one or more `AnyTask` instances at the beginning of the current task's upstream list.
|
363
371
|
|
364
|
-
This method is used to define dependencies for the current task. Tasks in the upstream list are
|
365
|
-
executed before the current task. Adding a task to the beginning of the list means it will be
|
372
|
+
This method is used to define dependencies for the current task. Tasks in the upstream list are
|
373
|
+
executed before the current task. Adding a task to the beginning of the list means it will be
|
366
374
|
executed earlier than those already in the list.
|
367
375
|
|
368
376
|
Args:
|
@@ -373,15 +381,15 @@ class AnyTask(ABC):
|
|
373
381
|
>>> task = Task(name='task')
|
374
382
|
>>> upstream_task = Task(name='upstream-task')
|
375
383
|
>>> task.insert_upstream(upstream_task)
|
376
|
-
|
384
|
+
"""
|
377
385
|
pass
|
378
386
|
|
379
387
|
@abstractmethod
|
380
388
|
def add_upstream(self, *upstreams: TAnyTask):
|
381
|
-
|
389
|
+
"""
|
382
390
|
Adds one or more `AnyTask` instances to the end of the current task's upstream list.
|
383
391
|
|
384
|
-
This method appends tasks to the upstream list, indicating that these tasks should be executed
|
392
|
+
This method appends tasks to the upstream list, indicating that these tasks should be executed
|
385
393
|
before the current task, but after any tasks already in the upstream list.
|
386
394
|
|
387
395
|
Args:
|
@@ -392,15 +400,15 @@ class AnyTask(ABC):
|
|
392
400
|
>>> task = Task(name='task')
|
393
401
|
>>> upstream_task = Task(name='upstream-task')
|
394
402
|
>>> task.add_upstream(upstream_task)
|
395
|
-
|
403
|
+
"""
|
396
404
|
pass
|
397
405
|
|
398
406
|
@abstractmethod
|
399
407
|
def insert_input(self, *inputs: AnyInput):
|
400
|
-
|
408
|
+
"""
|
401
409
|
Inserts one or more `AnyInput` instances at the beginning of the current task's input list.
|
402
410
|
|
403
|
-
This method is used to add inputs that the task will process. Inserting an input at the beginning
|
411
|
+
This method is used to add inputs that the task will process. Inserting an input at the beginning
|
404
412
|
of the list gives it precedence over those already present.
|
405
413
|
|
406
414
|
Args:
|
@@ -411,15 +419,15 @@ class AnyTask(ABC):
|
|
411
419
|
>>> task = Task(name='task')
|
412
420
|
>>> email_input = Input(name='email-address')
|
413
421
|
>>> task.insert_input(email_input)
|
414
|
-
|
422
|
+
"""
|
415
423
|
pass
|
416
424
|
|
417
425
|
@abstractmethod
|
418
426
|
def add_input(self, *inputs: AnyInput):
|
419
|
-
|
427
|
+
"""
|
420
428
|
Adds one or more `AnyInput` instances to the end of the current task's input list.
|
421
429
|
|
422
|
-
This method is used to append inputs for the task to process, placing them after any inputs
|
430
|
+
This method is used to append inputs for the task to process, placing them after any inputs
|
423
431
|
already specified.
|
424
432
|
|
425
433
|
Args:
|
@@ -430,15 +438,15 @@ class AnyTask(ABC):
|
|
430
438
|
>>> task = Task(name='task')
|
431
439
|
>>> email_input = Input(name='email-address')
|
432
440
|
>>> task.add_input(email_input)
|
433
|
-
|
441
|
+
"""
|
434
442
|
pass
|
435
443
|
|
436
444
|
@abstractmethod
|
437
445
|
def insert_env(self, *envs: Env):
|
438
|
-
|
446
|
+
"""
|
439
447
|
Inserts one or more `Env` instances at the beginning of the current task's environment variable list.
|
440
448
|
|
441
|
-
This method allows for setting or overriding environment variables for the task, with earlier entries
|
449
|
+
This method allows for setting or overriding environment variables for the task, with earlier entries
|
442
450
|
having precedence over later ones.
|
443
451
|
|
444
452
|
Args:
|
@@ -449,35 +457,35 @@ class AnyTask(ABC):
|
|
449
457
|
>>> task = Task(name='task')
|
450
458
|
>>> db_url_env = Env(name='DATABASE_URL', value='postgresql://...')
|
451
459
|
>>> task.insert_env(env_var)
|
452
|
-
|
460
|
+
"""
|
453
461
|
pass
|
454
462
|
|
455
463
|
@abstractmethod
|
456
464
|
def add_env(self, *envs: Env):
|
457
|
-
|
465
|
+
"""
|
458
466
|
Adds one or more `Env` instances to the end of the current task's environment variable list.
|
459
467
|
|
460
|
-
Use this method to append environment variables for the task, which will be used after
|
468
|
+
Use this method to append environment variables for the task, which will be used after
|
461
469
|
any variables already set.
|
462
470
|
|
463
471
|
Args:
|
464
472
|
envs (Env): One or more environment variable instances to be added.
|
465
|
-
|
473
|
+
|
466
474
|
Examples:
|
467
475
|
>>> from zrb import Task, Env
|
468
476
|
>>> task = Task(name='task')
|
469
477
|
>>> db_url_env = Env(name='DATABASE_URL', value='postgresql://...')
|
470
478
|
>>> task.add_env(env_var)
|
471
|
-
|
479
|
+
"""
|
472
480
|
pass
|
473
481
|
|
474
482
|
@abstractmethod
|
475
483
|
def insert_env_file(self, *env_files: EnvFile):
|
476
|
-
|
484
|
+
"""
|
477
485
|
Inserts one or more `EnvFile` instances at the beginning of the current task's environment file list.
|
478
486
|
|
479
|
-
This method is used to specify environment variable files whose contents should be loaded
|
480
|
-
before those of any files already in the list. This is useful for overriding or setting
|
487
|
+
This method is used to specify environment variable files whose contents should be loaded
|
488
|
+
before those of any files already in the list. This is useful for overriding or setting
|
481
489
|
additional environment configurations.
|
482
490
|
|
483
491
|
Args:
|
@@ -488,16 +496,16 @@ class AnyTask(ABC):
|
|
488
496
|
>>> task = Task()
|
489
497
|
>>> env_file = EnvFile(path='config.env')
|
490
498
|
>>> task.insert_env_file(env_file)
|
491
|
-
|
499
|
+
"""
|
492
500
|
pass
|
493
501
|
|
494
502
|
@abstractmethod
|
495
503
|
def add_env_file(self, *env_files: EnvFile):
|
496
|
-
|
504
|
+
"""
|
497
505
|
Adds one or more `EnvFile` instances to the end of the current task's environment file list.
|
498
506
|
|
499
|
-
Use this method to append environment file references, which will be processed after
|
500
|
-
any files already specified. This allows for supplementing the existing environment
|
507
|
+
Use this method to append environment file references, which will be processed after
|
508
|
+
any files already specified. This allows for supplementing the existing environment
|
501
509
|
configuration.
|
502
510
|
|
503
511
|
Args:
|
@@ -508,233 +516,233 @@ class AnyTask(ABC):
|
|
508
516
|
>>> task = Task()
|
509
517
|
>>> env_file = EnvFile(path='config.env')
|
510
518
|
>>> task.add_env_file(env_file)
|
511
|
-
|
519
|
+
"""
|
512
520
|
pass
|
513
521
|
|
514
522
|
@abstractmethod
|
515
523
|
def _set_execution_id(self, execution_id: str):
|
516
|
-
|
524
|
+
"""
|
517
525
|
Sets the execution ID for the current task.
|
518
526
|
|
519
|
-
This method is intended for internal use to assign a unique identifier to the task's execution.
|
527
|
+
This method is intended for internal use to assign a unique identifier to the task's execution.
|
520
528
|
This ID can be used for tracking, logging, and inter-task communication.
|
521
529
|
|
522
530
|
This method should not be used externally, as it is meant to be managed within the task system.
|
523
531
|
|
524
532
|
Args:
|
525
533
|
execution_id (str): A string representing the unique execution ID.
|
526
|
-
|
534
|
+
"""
|
527
535
|
pass
|
528
536
|
|
529
537
|
@abstractmethod
|
530
538
|
def set_name(self, new_name: str):
|
531
|
-
|
539
|
+
"""
|
532
540
|
Sets a new name for the current task.
|
533
541
|
|
534
|
-
This method is used to update the task's name, typically after creating a copy of an existing task.
|
542
|
+
This method is used to update the task's name, typically after creating a copy of an existing task.
|
535
543
|
The new name helps in differentiating the task in the task management system.
|
536
544
|
|
537
545
|
Args:
|
538
546
|
new_name (str): A string representing the new name to be assigned to the task.
|
539
|
-
|
547
|
+
"""
|
540
548
|
pass
|
541
549
|
|
542
550
|
@abstractmethod
|
543
551
|
def set_description(self, new_description: str):
|
544
|
-
|
552
|
+
"""
|
545
553
|
Sets a new description for the current task.
|
546
554
|
|
547
|
-
This method allows updating the task's description to provide more context or details about its purpose and behavior.
|
555
|
+
This method allows updating the task's description to provide more context or details about its purpose and behavior.
|
548
556
|
Useful for enhancing clarity and maintainability in the task management system.
|
549
557
|
|
550
558
|
Args:
|
551
559
|
new_description (str): A string representing the new description of the task.
|
552
|
-
|
560
|
+
"""
|
553
561
|
pass
|
554
562
|
|
555
563
|
@abstractmethod
|
556
564
|
def set_icon(self, new_icon: str):
|
557
|
-
|
565
|
+
"""
|
558
566
|
Assigns a new icon to the current task.
|
559
567
|
|
560
|
-
This method is used for setting or updating the task's icon, which can be utilized for visual representation
|
568
|
+
This method is used for setting or updating the task's icon, which can be utilized for visual representation
|
561
569
|
in a user interface. The icon should ideally be a string identifier that maps to an actual graphical resource.
|
562
570
|
|
563
571
|
Args:
|
564
572
|
new_icon (str): A string representing the icon identifier for the task.
|
565
|
-
|
573
|
+
"""
|
566
574
|
pass
|
567
575
|
|
568
576
|
@abstractmethod
|
569
577
|
def set_color(self, new_color: str):
|
570
|
-
|
578
|
+
"""
|
571
579
|
Defines a new color for the current task.
|
572
580
|
|
573
|
-
This method updates the color associated with the task. This can be useful for categorization,
|
581
|
+
This method updates the color associated with the task. This can be useful for categorization,
|
574
582
|
priority indication, or visual differentiation in a UI.
|
575
583
|
|
576
584
|
Args:
|
577
|
-
new_color (str): A string representing the color to be assigned to the task.
|
578
|
-
|
585
|
+
new_color (str): A string representing the color to be assigned to the task.
|
586
|
+
"""
|
579
587
|
pass
|
580
588
|
|
581
589
|
@abstractmethod
|
582
590
|
def set_should_execute(
|
583
591
|
self, should_execute: Union[bool, JinjaTemplate, Callable[..., bool]]
|
584
592
|
):
|
585
|
-
|
593
|
+
"""
|
586
594
|
Determines whether the task should execute.
|
587
595
|
|
588
|
-
This method configures the execution criteria for the task. It can be set as a boolean value,
|
589
|
-
a string representing a condition, or a callable that returns a boolean. This is useful for
|
596
|
+
This method configures the execution criteria for the task. It can be set as a boolean value,
|
597
|
+
a string representing a condition, or a callable that returns a boolean. This is useful for
|
590
598
|
conditional task execution based on dynamic criteria.
|
591
599
|
|
592
600
|
Args:
|
593
|
-
should_execute (Union[bool, str, Callable[..., bool]]): The condition to determine if the task should execute.
|
594
|
-
|
601
|
+
should_execute (Union[bool, str, Callable[..., bool]]): The condition to determine if the task should execute.
|
602
|
+
"""
|
595
603
|
pass
|
596
604
|
|
597
605
|
@abstractmethod
|
598
606
|
def set_retry(self, new_retry: int):
|
599
|
-
|
607
|
+
"""
|
600
608
|
Sets the number of retry attempts for the task.
|
601
609
|
|
602
|
-
This method configures how many times the task should be retried in case of failure.
|
610
|
+
This method configures how many times the task should be retried in case of failure.
|
603
611
|
It's essential for tasks that may fail transiently and need multiple attempts for successful execution.
|
604
612
|
|
605
613
|
Args:
|
606
614
|
new_retry (int): An integer representing the number of retry attempts.
|
607
|
-
|
615
|
+
"""
|
608
616
|
pass
|
609
617
|
|
610
618
|
@abstractmethod
|
611
619
|
def set_retry_interval(self, new_retry_interval: Union[float, int]):
|
612
|
-
|
620
|
+
"""
|
613
621
|
Specifies the interval between retry attempts for the task.
|
614
622
|
|
615
|
-
This method sets the duration to wait before retrying the task after a failure.
|
623
|
+
This method sets the duration to wait before retrying the task after a failure.
|
616
624
|
This can help in scenarios where immediate retry is not desirable or effective.
|
617
625
|
|
618
626
|
Args:
|
619
|
-
new_retry_interval (Union[float, int]): The time interval (in seconds) to wait before a retry attempt.
|
620
|
-
|
627
|
+
new_retry_interval (Union[float, int]): The time interval (in seconds) to wait before a retry attempt.
|
628
|
+
"""
|
621
629
|
pass
|
622
630
|
|
623
631
|
@abstractmethod
|
624
632
|
def set_checking_interval(self, new_checking_interval: Union[float, int]):
|
625
|
-
|
633
|
+
"""
|
626
634
|
Sets the interval for checking the task's readiness or completion status.
|
627
635
|
|
628
|
-
This method defines how frequently the system should check if the task is ready or completed.
|
636
|
+
This method defines how frequently the system should check if the task is ready or completed.
|
629
637
|
It's useful for tasks that have an indeterminate completion time.
|
630
638
|
|
631
639
|
Args:
|
632
|
-
new_checking_interval (Union[float, int]): The time interval (in seconds) for readiness or checks.
|
633
|
-
|
640
|
+
new_checking_interval (Union[float, int]): The time interval (in seconds) for readiness or checks.
|
641
|
+
"""
|
634
642
|
pass
|
635
643
|
|
636
644
|
@abstractmethod
|
637
645
|
def get_execution_id(self) -> str:
|
638
|
-
|
646
|
+
"""
|
639
647
|
Retrieves the execution ID of the task.
|
640
648
|
|
641
|
-
This method returns the unique identifier associated with the task's execution.
|
642
|
-
The execution ID is crucial for tracking, logging, and differentiating between
|
649
|
+
This method returns the unique identifier associated with the task's execution.
|
650
|
+
The execution ID is crucial for tracking, logging, and differentiating between
|
643
651
|
multiple instances or runs of the same task.
|
644
652
|
|
645
653
|
Returns:
|
646
654
|
str: The unique execution ID of the task.
|
647
|
-
|
655
|
+
"""
|
648
656
|
pass
|
649
657
|
|
650
658
|
@abstractmethod
|
651
659
|
def get_icon(self) -> str:
|
652
|
-
|
660
|
+
"""
|
653
661
|
Retrieves the icon identifier of the current task.
|
654
662
|
|
655
|
-
This method is used to get the icon associated with the task, which can be utilized for
|
663
|
+
This method is used to get the icon associated with the task, which can be utilized for
|
656
664
|
visual representation in user interfaces or documentation.
|
657
665
|
|
658
666
|
Returns:
|
659
667
|
str: A string representing the icon identifier for the task
|
660
|
-
|
668
|
+
"""
|
661
669
|
pass
|
662
670
|
|
663
671
|
@abstractmethod
|
664
672
|
def get_color(self) -> str:
|
665
|
-
|
673
|
+
"""
|
666
674
|
Retrieves the color associated with the current task.
|
667
675
|
|
668
|
-
This method returns the color of the task, useful for visual differentiation, priority indication,
|
676
|
+
This method returns the color of the task, useful for visual differentiation, priority indication,
|
669
677
|
or categorization in user interfaces or documentation.
|
670
678
|
|
671
679
|
Returns:
|
672
680
|
str: A string representing the color assigned to the task.
|
673
|
-
|
681
|
+
"""
|
674
682
|
pass
|
675
683
|
|
676
684
|
@abstractmethod
|
677
685
|
def get_description(self) -> str:
|
678
|
-
|
686
|
+
"""
|
679
687
|
Fetches the current description of the task.
|
680
688
|
|
681
|
-
This method is used to obtain the detailed description of the task, providing insights into its purpose,
|
689
|
+
This method is used to obtain the detailed description of the task, providing insights into its purpose,
|
682
690
|
functionality, and usage within the task management system.
|
683
691
|
|
684
692
|
Returns:
|
685
693
|
str: The description of the task.
|
686
|
-
|
694
|
+
"""
|
687
695
|
pass
|
688
696
|
|
689
697
|
@abstractmethod
|
690
698
|
def get_name(self) -> str:
|
691
|
-
|
699
|
+
"""
|
692
700
|
Get task name
|
693
701
|
|
694
702
|
Returns:
|
695
703
|
str: name of the task
|
696
|
-
|
704
|
+
"""
|
697
705
|
pass
|
698
706
|
|
699
707
|
@abstractmethod
|
700
708
|
def get_cli_name(self) -> str:
|
701
|
-
|
709
|
+
"""
|
702
710
|
Gets the command-line interface (CLI) name of the task.
|
703
711
|
|
704
|
-
This method returns the name used to invoke the task via a CLI, facilitating integration with command-line tools
|
712
|
+
This method returns the name used to invoke the task via a CLI, facilitating integration with command-line tools
|
705
713
|
or scripts.
|
706
714
|
|
707
715
|
Returns:
|
708
716
|
str: The CLI name of the task.
|
709
|
-
|
717
|
+
"""
|
710
718
|
pass
|
711
719
|
|
712
720
|
@abstractmethod
|
713
721
|
def _get_full_cli_name(self) -> str:
|
714
|
-
|
722
|
+
"""
|
715
723
|
Retrieves the full command-line interface (CLI) name of the task.
|
716
724
|
|
717
|
-
Intended for internal use, this method provides the complete CLI name, including any
|
725
|
+
Intended for internal use, this method provides the complete CLI name, including any
|
718
726
|
prefixes or namespaces, used primarily for logging or debugging purposes.
|
719
727
|
|
720
728
|
Returns:
|
721
729
|
str: The full CLI name of the task.
|
722
|
-
|
730
|
+
"""
|
723
731
|
pass
|
724
732
|
|
725
733
|
@abstractmethod
|
726
734
|
def _set_has_cli_interface(self):
|
727
|
-
|
735
|
+
"""
|
728
736
|
Marks the task as having a CLI interface.
|
729
737
|
|
730
|
-
This internal method is used to indicate that the task is accessible and executable through a CLI,
|
738
|
+
This internal method is used to indicate that the task is accessible and executable through a CLI,
|
731
739
|
enabling the task system to appropriately handle its CLI interactions.
|
732
|
-
|
740
|
+
"""
|
733
741
|
pass
|
734
742
|
|
735
743
|
@abstractmethod
|
736
744
|
def inject_env_files(self):
|
737
|
-
|
745
|
+
"""
|
738
746
|
Injects additional `EnvFile` into the task.
|
739
747
|
|
740
748
|
Examples:
|
@@ -742,25 +750,25 @@ class AnyTask(ABC):
|
|
742
750
|
>>> class MyTask(Task):
|
743
751
|
>>> def inject_env_files(self):
|
744
752
|
>>> self.add_env_files(EnvFile(path='config.env'))
|
745
|
-
|
753
|
+
"""
|
746
754
|
pass
|
747
755
|
|
748
756
|
@abstractmethod
|
749
757
|
def _get_env_files(self) -> List[EnvFile]:
|
750
|
-
|
758
|
+
"""
|
751
759
|
Retrieves the list of environment variable files associated with the task.
|
752
760
|
|
753
|
-
Intended for internal use, this method returns a list of `EnvFile` instances that the task
|
761
|
+
Intended for internal use, this method returns a list of `EnvFile` instances that the task
|
754
762
|
uses to load environment variables, primarily for setup and configuration purposes.
|
755
763
|
|
756
764
|
Returns:
|
757
765
|
List[EnvFile]: A list of `EnvFile` instances associated with the task.
|
758
|
-
|
766
|
+
"""
|
759
767
|
pass
|
760
768
|
|
761
769
|
@abstractmethod
|
762
770
|
def inject_envs(self):
|
763
|
-
|
771
|
+
"""
|
764
772
|
Injects environment variables into the task.
|
765
773
|
|
766
774
|
Examples:
|
@@ -768,29 +776,29 @@ class AnyTask(ABC):
|
|
768
776
|
>>> class MyTask(Task):
|
769
777
|
>>> def inject_envs(self):
|
770
778
|
>>> self.add_envs(Env(name='DATABASE_URL'))
|
771
|
-
|
779
|
+
"""
|
772
780
|
pass
|
773
781
|
|
774
782
|
@abstractmethod
|
775
783
|
def _get_envs(self) -> List[Env]:
|
776
|
-
|
784
|
+
"""
|
777
785
|
Retrieves the list of environment variables set for the task.
|
778
786
|
|
779
|
-
For internal use, this method returns a list of `Env` instances representing the environment variables
|
787
|
+
For internal use, this method returns a list of `Env` instances representing the environment variables
|
780
788
|
configured for the task, essential for understanding and debugging the task's environment setup.
|
781
789
|
|
782
790
|
Returns:
|
783
791
|
List[Env]: A list of `Env` instances representing the environment variables of the task.
|
784
|
-
|
792
|
+
"""
|
785
793
|
pass
|
786
794
|
|
787
795
|
@abstractmethod
|
788
796
|
def inject_inputs(self):
|
789
|
-
|
797
|
+
"""
|
790
798
|
Injects custom inputs into the task.
|
791
799
|
|
792
|
-
This method is used to programmatically add input parameters to the task, allowing
|
793
|
-
dynamic customization of the task's input data. Subclasses should override this method
|
800
|
+
This method is used to programmatically add input parameters to the task, allowing
|
801
|
+
dynamic customization of the task's input data. Subclasses should override this method
|
794
802
|
to define specific inputs that the task should receive.
|
795
803
|
|
796
804
|
Examples:
|
@@ -798,30 +806,30 @@ class AnyTask(ABC):
|
|
798
806
|
>>> class MyTask(Task):
|
799
807
|
>>> def inject_inputs(self):
|
800
808
|
>>> self.add_input(Input(name='user_email', type='email'))
|
801
|
-
|
809
|
+
"""
|
802
810
|
pass
|
803
811
|
|
804
812
|
@abstractmethod
|
805
813
|
def _get_inputs(self) -> List[AnyInput]:
|
806
|
-
|
814
|
+
"""
|
807
815
|
Retrieves the list of inputs associated with the task.
|
808
816
|
|
809
|
-
This internal method is used to obtain all the inputs that have been set for the task,
|
810
|
-
either through static definition or via the `inject_inputs` method. It's primarily used
|
817
|
+
This internal method is used to obtain all the inputs that have been set for the task,
|
818
|
+
either through static definition or via the `inject_inputs` method. It's primarily used
|
811
819
|
for introspection and debugging purposes.
|
812
820
|
|
813
821
|
Returns:
|
814
822
|
List[AnyInput]: A list of `AnyInput` instances representing the inputs for the task.
|
815
|
-
|
823
|
+
"""
|
816
824
|
pass
|
817
825
|
|
818
826
|
@abstractmethod
|
819
827
|
def inject_checkers(self):
|
820
|
-
|
828
|
+
"""
|
821
829
|
Injects custom checkers into the task.
|
822
830
|
|
823
|
-
This method allows for the addition of custom validation or condition checkers. These
|
824
|
-
checkers can be used to verify certain conditions before the task execution proceeds.
|
831
|
+
This method allows for the addition of custom validation or condition checkers. These
|
832
|
+
checkers can be used to verify certain conditions before the task execution proceeds.
|
825
833
|
Subclasses should implement this method to define task-specific checkers.
|
826
834
|
|
827
835
|
Examples:
|
@@ -829,30 +837,30 @@ class AnyTask(ABC):
|
|
829
837
|
>>> class MyTask(Task):
|
830
838
|
>>> def inject_checkers(self):
|
831
839
|
>>> self.add_checker(some_custom_condition_checker)
|
832
|
-
|
840
|
+
"""
|
833
841
|
pass
|
834
842
|
|
835
843
|
@abstractmethod
|
836
844
|
def _get_checkers(self) -> Iterable[TAnyTask]:
|
837
|
-
|
845
|
+
"""
|
838
846
|
Retrieves the checkers set for the task.
|
839
847
|
|
840
|
-
This internal method returns an iterable of all the checkers that have been added to
|
841
|
-
the task. It's mainly used for internal logic and debugging to understand the
|
848
|
+
This internal method returns an iterable of all the checkers that have been added to
|
849
|
+
the task. It's mainly used for internal logic and debugging to understand the
|
842
850
|
validations or conditions applied to the task.
|
843
851
|
|
844
852
|
Returns:
|
845
853
|
Iterable[TAnyTask]: An iterable of checkers associated with the task.
|
846
|
-
|
854
|
+
"""
|
847
855
|
pass
|
848
856
|
|
849
857
|
@abstractmethod
|
850
858
|
def inject_upstreams(self):
|
851
|
-
|
859
|
+
"""
|
852
860
|
Injects upstream tasks into the current task.
|
853
861
|
|
854
|
-
This method is used for programmatically adding upstream dependencies to the task.
|
855
|
-
Upstream tasks are those that must be completed before the current task starts.
|
862
|
+
This method is used for programmatically adding upstream dependencies to the task.
|
863
|
+
Upstream tasks are those that must be completed before the current task starts.
|
856
864
|
Override this method in subclasses to specify such dependencies.
|
857
865
|
|
858
866
|
Examples:
|
@@ -860,106 +868,106 @@ class AnyTask(ABC):
|
|
860
868
|
>>> class MyTask(Task):
|
861
869
|
>>> def inject_upstreams(self):
|
862
870
|
>>> self.add_upstream(another_task)
|
863
|
-
|
871
|
+
"""
|
864
872
|
pass
|
865
873
|
|
866
874
|
@abstractmethod
|
867
875
|
def _get_upstreams(self) -> Iterable[TAnyTask]:
|
868
|
-
|
876
|
+
"""
|
869
877
|
Retrieves the upstream tasks of the current task.
|
870
878
|
|
871
|
-
An internal method to get the list of upstream tasks that have been set for the
|
872
|
-
task, either statically or through `inject_upstreams`. This is essential for task
|
879
|
+
An internal method to get the list of upstream tasks that have been set for the
|
880
|
+
task, either statically or through `inject_upstreams`. This is essential for task
|
873
881
|
scheduling and dependency management.
|
874
882
|
|
875
883
|
Returns:
|
876
884
|
Iterable[TAnyTask]: An iterable of upstream tasks.
|
877
|
-
|
885
|
+
"""
|
878
886
|
pass
|
879
887
|
|
880
888
|
@abstractmethod
|
881
889
|
def _get_combined_inputs(self) -> Iterable[AnyInput]:
|
882
|
-
|
890
|
+
"""
|
883
891
|
Combines and retrieves all inputs for the task.
|
884
892
|
|
885
|
-
This internal method aggregates inputs from various sources (static definition,
|
886
|
-
`inject_inputs`, etc.) and provides a unified view of all inputs that the task
|
893
|
+
This internal method aggregates inputs from various sources (static definition,
|
894
|
+
`inject_inputs`, etc.) and provides a unified view of all inputs that the task
|
887
895
|
will process. This is crucial for preparing the task's runtime environment.
|
888
896
|
|
889
897
|
Returns:
|
890
898
|
Iterable[AnyInput]: An iterable of all combined inputs for the task.
|
891
|
-
|
899
|
+
"""
|
892
900
|
pass
|
893
901
|
|
894
902
|
@abstractmethod
|
895
903
|
def log_debug(self, message: Any):
|
896
|
-
|
904
|
+
"""
|
897
905
|
Log message with log level "DEBUG"
|
898
906
|
|
899
907
|
You can set Zrb log level by using `ZRB_LOGGING_LEVEL` environment
|
900
|
-
|
908
|
+
"""
|
901
909
|
pass
|
902
910
|
|
903
911
|
@abstractmethod
|
904
912
|
def log_warn(self, message: Any):
|
905
|
-
|
913
|
+
"""
|
906
914
|
Log message with log level "WARNING"
|
907
915
|
|
908
916
|
You can set Zrb log level by using `ZRB_LOGGING_LEVEL` environment
|
909
|
-
|
917
|
+
"""
|
910
918
|
pass
|
911
919
|
|
912
920
|
@abstractmethod
|
913
921
|
def log_info(self, message: Any):
|
914
|
-
|
922
|
+
"""
|
915
923
|
Log message with log level "INFO"
|
916
924
|
|
917
925
|
You can set Zrb log level by using `ZRB_LOGGING_LEVEL` environment
|
918
|
-
|
926
|
+
"""
|
919
927
|
pass
|
920
928
|
|
921
929
|
@abstractmethod
|
922
930
|
def log_error(self, message: Any):
|
923
|
-
|
931
|
+
"""
|
924
932
|
Log message with log level "ERROR"
|
925
933
|
|
926
934
|
You can set Zrb log level by using `ZRB_LOGGING_LEVEL` environment
|
927
|
-
|
935
|
+
"""
|
928
936
|
pass
|
929
937
|
|
930
938
|
@abstractmethod
|
931
939
|
def log_critical(self, message: Any):
|
932
|
-
|
940
|
+
"""
|
933
941
|
Log message with log level "CRITICAL"
|
934
942
|
|
935
943
|
You can set Zrb log level by using `ZRB_LOGGING_LEVEL` environment
|
936
|
-
|
944
|
+
"""
|
937
945
|
pass
|
938
946
|
|
939
947
|
@abstractmethod
|
940
948
|
def print_out(self, message: Any, trim_message: bool = True):
|
941
|
-
|
949
|
+
"""
|
942
950
|
Print message to stderr as normal text.
|
943
|
-
|
951
|
+
"""
|
944
952
|
pass
|
945
953
|
|
946
954
|
@abstractmethod
|
947
955
|
def print_err(self, message: Any, trim_message: bool = True):
|
948
|
-
|
956
|
+
"""
|
949
957
|
Print message to stderr and style it as error.
|
950
|
-
|
958
|
+
"""
|
951
959
|
pass
|
952
960
|
|
953
961
|
@abstractmethod
|
954
962
|
def print_out_dark(self, message: Any, trim_message: bool = True):
|
955
|
-
|
963
|
+
"""
|
956
964
|
Print message to stdout and style it as faint.
|
957
|
-
|
965
|
+
"""
|
958
966
|
pass
|
959
967
|
|
960
968
|
@abstractmethod
|
961
969
|
def get_input_map(self) -> Mapping[str, Any]:
|
962
|
-
|
970
|
+
"""
|
963
971
|
Get a map representing task's Inputs.
|
964
972
|
|
965
973
|
Typically used inside `run`, `check`, or in `@python_task` decorator
|
@@ -971,12 +979,12 @@ class AnyTask(ABC):
|
|
971
979
|
>>> task: Task = kwargs.get('_task')
|
972
980
|
>>> for key, value in task.get_input_map():
|
973
981
|
>>> task.print_out(f'{key}: {value}')
|
974
|
-
|
982
|
+
"""
|
975
983
|
pass
|
976
984
|
|
977
985
|
@abstractmethod
|
978
986
|
def get_env_map(self) -> Mapping[str, Any]:
|
979
|
-
|
987
|
+
"""
|
980
988
|
Get a map representing task's Envs and EnvFiles
|
981
989
|
|
982
990
|
Typically used inside `run`, `check`, or in `@python_task` decorator
|
@@ -988,113 +996,105 @@ class AnyTask(ABC):
|
|
988
996
|
>>> task: Task = kwargs.get('_task')
|
989
997
|
>>> for key, value in task.get_env_map():
|
990
998
|
>>> task.print_out(f'{key}: {value}')
|
991
|
-
|
999
|
+
"""
|
992
1000
|
pass
|
993
1001
|
|
994
1002
|
@abstractmethod
|
995
|
-
def render_any(
|
996
|
-
|
997
|
-
) -> Any:
|
998
|
-
'''
|
1003
|
+
def render_any(self, value: Any, data: Optional[Mapping[str, Any]] = None) -> Any:
|
1004
|
+
"""
|
999
1005
|
Render any value.
|
1000
|
-
|
1006
|
+
"""
|
1001
1007
|
pass
|
1002
1008
|
|
1003
1009
|
@abstractmethod
|
1004
1010
|
def render_float(
|
1005
1011
|
self,
|
1006
1012
|
value: Union[JinjaTemplate, float],
|
1007
|
-
data: Optional[Mapping[str, Any]] = None
|
1013
|
+
data: Optional[Mapping[str, Any]] = None,
|
1008
1014
|
) -> float:
|
1009
|
-
|
1015
|
+
"""
|
1010
1016
|
Render float value.
|
1011
|
-
|
1017
|
+
"""
|
1012
1018
|
pass
|
1013
1019
|
|
1014
1020
|
@abstractmethod
|
1015
1021
|
def render_int(
|
1016
|
-
self,
|
1017
|
-
value: Union[JinjaTemplate, int],
|
1018
|
-
data: Optional[Mapping[str, Any]] = None
|
1022
|
+
self, value: Union[JinjaTemplate, int], data: Optional[Mapping[str, Any]] = None
|
1019
1023
|
) -> int:
|
1020
1024
|
pass
|
1021
1025
|
|
1022
1026
|
@abstractmethod
|
1023
1027
|
def render_bool(
|
1024
|
-
self,
|
1028
|
+
self,
|
1025
1029
|
value: Union[JinjaTemplate, bool],
|
1026
|
-
data: Optional[Mapping[str, Any]] = None
|
1030
|
+
data: Optional[Mapping[str, Any]] = None,
|
1027
1031
|
) -> bool:
|
1028
|
-
|
1032
|
+
"""
|
1029
1033
|
Render int value.
|
1030
|
-
|
1034
|
+
"""
|
1031
1035
|
pass
|
1032
1036
|
|
1033
1037
|
@abstractmethod
|
1034
1038
|
def render_str(
|
1035
|
-
self,
|
1036
|
-
value: JinjaTemplate,
|
1037
|
-
data: Optional[Mapping[str, Any]] = None
|
1039
|
+
self, value: JinjaTemplate, data: Optional[Mapping[str, Any]] = None
|
1038
1040
|
) -> str:
|
1039
|
-
|
1041
|
+
"""
|
1040
1042
|
Render str value.
|
1041
|
-
|
1043
|
+
"""
|
1042
1044
|
pass
|
1043
1045
|
|
1044
1046
|
@abstractmethod
|
1045
1047
|
def render_file(
|
1046
|
-
self,
|
1047
|
-
path: JinjaTemplate,
|
1048
|
-
data: Optional[Mapping[str, Any]] = None
|
1048
|
+
self, path: JinjaTemplate, data: Optional[Mapping[str, Any]] = None
|
1049
1049
|
) -> str:
|
1050
|
-
|
1050
|
+
"""
|
1051
1051
|
Render file content.
|
1052
|
-
|
1052
|
+
"""
|
1053
1053
|
pass
|
1054
1054
|
|
1055
1055
|
@abstractmethod
|
1056
1056
|
def _run_all(self, *args: Any, **kwargs: Any) -> Any:
|
1057
|
-
|
1057
|
+
"""
|
1058
1058
|
For internal use.
|
1059
1059
|
|
1060
1060
|
Run this task and all its upstreams.
|
1061
|
-
|
1061
|
+
"""
|
1062
1062
|
pass
|
1063
1063
|
|
1064
1064
|
@abstractmethod
|
1065
1065
|
def _loop_check(self, show_info: bool) -> bool:
|
1066
|
-
|
1066
|
+
"""
|
1067
1067
|
For internal use.
|
1068
|
-
|
1068
|
+
|
1069
1069
|
Regularly check whether the task is ready or not.
|
1070
|
-
|
1070
|
+
"""
|
1071
1071
|
pass
|
1072
1072
|
|
1073
1073
|
@abstractmethod
|
1074
1074
|
def _set_keyval(self, kwargs: Mapping[str, Any], env_prefix: str):
|
1075
|
-
|
1075
|
+
"""
|
1076
1076
|
For internal use.
|
1077
1077
|
|
1078
1078
|
Set current task's key values.
|
1079
|
-
|
1079
|
+
"""
|
1080
1080
|
pass
|
1081
1081
|
|
1082
1082
|
@abstractmethod
|
1083
1083
|
def _print_result(self, result: Any):
|
1084
|
-
|
1084
|
+
"""
|
1085
1085
|
For internal use.
|
1086
1086
|
|
1087
1087
|
Call `print_result` or print values based on result type and other conditions.
|
1088
|
-
|
1088
|
+
"""
|
1089
1089
|
pass
|
1090
1090
|
|
1091
1091
|
@abstractmethod
|
1092
1092
|
def print_result(self, result: Any):
|
1093
|
-
|
1093
|
+
"""
|
1094
1094
|
Print the task result to stdout for further processing.
|
1095
1095
|
|
1096
|
-
Override this method in subclasses to customize how the task result is displayed
|
1097
|
-
or processed. Useful for integrating the task output with other systems or
|
1096
|
+
Override this method in subclasses to customize how the task result is displayed
|
1097
|
+
or processed. Useful for integrating the task output with other systems or
|
1098
1098
|
command-line tools.
|
1099
1099
|
|
1100
1100
|
Args:
|
@@ -1106,5 +1106,5 @@ class AnyTask(ABC):
|
|
1106
1106
|
>>> class MyTask(Task):
|
1107
1107
|
>>> def print_result(self, result: Any):
|
1108
1108
|
>>> print(f'Result: {result}')
|
1109
|
-
|
1109
|
+
"""
|
1110
1110
|
pass
|