qwak-sdk 0.5.102__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.
- qwak_sdk/__init__.py +9 -0
- qwak_sdk/cli.py +79 -0
- qwak_sdk/commands/__init__.py +0 -0
- qwak_sdk/commands/_logic/__init__.py +0 -0
- qwak_sdk/commands/_logic/tools.py +6 -0
- qwak_sdk/commands/admin/__init__.py +0 -0
- qwak_sdk/commands/admin/admin_commands_group.py +17 -0
- qwak_sdk/commands/admin/apikeys/__init__.py +0 -0
- qwak_sdk/commands/admin/apikeys/api_keys_commands_group.py +17 -0
- qwak_sdk/commands/admin/apikeys/generate/__init__.py +0 -0
- qwak_sdk/commands/admin/apikeys/generate/_logic.py +21 -0
- qwak_sdk/commands/admin/apikeys/generate/ui.py +45 -0
- qwak_sdk/commands/admin/apikeys/revoke/__init__.py +0 -0
- qwak_sdk/commands/admin/apikeys/revoke/_logic.py +22 -0
- qwak_sdk/commands/admin/apikeys/revoke/ui.py +31 -0
- qwak_sdk/commands/alerts/__init__.py +0 -0
- qwak_sdk/commands/alerts/alerts_commnad_group.py +18 -0
- qwak_sdk/commands/alerts/delete/__init__.py +0 -0
- qwak_sdk/commands/alerts/delete/_logic.py +5 -0
- qwak_sdk/commands/alerts/delete/ui.py +10 -0
- qwak_sdk/commands/alerts/list/__init__.py +0 -0
- qwak_sdk/commands/alerts/list/_logic.py +23 -0
- qwak_sdk/commands/alerts/list/ui.py +17 -0
- qwak_sdk/commands/alerts/register/__init__.py +0 -0
- qwak_sdk/commands/alerts/register/_logic.py +72 -0
- qwak_sdk/commands/alerts/register/ui.py +30 -0
- qwak_sdk/commands/audience/__init__.py +0 -0
- qwak_sdk/commands/audience/_logic/__init__.py +0 -0
- qwak_sdk/commands/audience/_logic/config/__init__.py +0 -0
- qwak_sdk/commands/audience/_logic/config/config_base.py +15 -0
- qwak_sdk/commands/audience/_logic/config/parser.py +30 -0
- qwak_sdk/commands/audience/_logic/config/v1/__init__.py +0 -0
- qwak_sdk/commands/audience/_logic/config/v1/audience_config.py +26 -0
- qwak_sdk/commands/audience/_logic/config/v1/conditions_config.py +59 -0
- qwak_sdk/commands/audience/_logic/config/v1/config_v1.py +23 -0
- qwak_sdk/commands/audience/_logic/config/v1/route_config.py +15 -0
- qwak_sdk/commands/audience/_logic/config/v1/spec.py +9 -0
- qwak_sdk/commands/audience/audience_api_dump.py +86 -0
- qwak_sdk/commands/audience/audience_commands_group.py +30 -0
- qwak_sdk/commands/audience/create/__init__.py +0 -0
- qwak_sdk/commands/audience/create/logic.py +41 -0
- qwak_sdk/commands/audience/create/ui.py +21 -0
- qwak_sdk/commands/audience/delete/__init__.py +0 -0
- qwak_sdk/commands/audience/delete/logic.py +13 -0
- qwak_sdk/commands/audience/delete/ui.py +17 -0
- qwak_sdk/commands/audience/get/__init__.py +0 -0
- qwak_sdk/commands/audience/get/logic.py +14 -0
- qwak_sdk/commands/audience/get/ui.py +25 -0
- qwak_sdk/commands/audience/list/__init__.py +0 -0
- qwak_sdk/commands/audience/list/logic.py +16 -0
- qwak_sdk/commands/audience/list/ui.py +26 -0
- qwak_sdk/commands/audience/update/__init__.py +0 -0
- qwak_sdk/commands/audience/update/logic.py +37 -0
- qwak_sdk/commands/audience/update/ui.py +26 -0
- qwak_sdk/commands/auto_scalling/__init__.py +0 -0
- qwak_sdk/commands/auto_scalling/_logic/__init__.py +0 -0
- qwak_sdk/commands/auto_scalling/_logic/config/__init__.py +3 -0
- qwak_sdk/commands/auto_scalling/_logic/config/config.py +152 -0
- qwak_sdk/commands/auto_scalling/_logic/config/parser.py +21 -0
- qwak_sdk/commands/auto_scalling/attach/__init__.py +0 -0
- qwak_sdk/commands/auto_scalling/attach/_logic.py +43 -0
- qwak_sdk/commands/auto_scalling/attach/ui.py +21 -0
- qwak_sdk/commands/auto_scalling/autoscaling_commands_group.py +15 -0
- qwak_sdk/commands/automations/__init__.py +0 -0
- qwak_sdk/commands/automations/automations_commands_group.py +30 -0
- qwak_sdk/commands/automations/delete/__init__.py +0 -0
- qwak_sdk/commands/automations/delete/_logic.py +6 -0
- qwak_sdk/commands/automations/delete/ui.py +23 -0
- qwak_sdk/commands/automations/executions/__init__.py +0 -0
- qwak_sdk/commands/automations/executions/executions_commands_group.py +14 -0
- qwak_sdk/commands/automations/executions/list/__init__.py +0 -0
- qwak_sdk/commands/automations/executions/list/_logic.py +8 -0
- qwak_sdk/commands/automations/executions/list/ui.py +25 -0
- qwak_sdk/commands/automations/list/__init__.py +0 -0
- qwak_sdk/commands/automations/list/_logic.py +36 -0
- qwak_sdk/commands/automations/list/ui.py +21 -0
- qwak_sdk/commands/automations/register/__init__.py +0 -0
- qwak_sdk/commands/automations/register/_logic.py +43 -0
- qwak_sdk/commands/automations/register/ui.py +44 -0
- qwak_sdk/commands/feature_store/__init__.py +0 -0
- qwak_sdk/commands/feature_store/backfill/__init__.py +0 -0
- qwak_sdk/commands/feature_store/backfill/_logic.py +140 -0
- qwak_sdk/commands/feature_store/backfill/streaming/__init__.py +0 -0
- qwak_sdk/commands/feature_store/backfill/streaming/_logic.py +50 -0
- qwak_sdk/commands/feature_store/backfill/streaming/ui.py +67 -0
- qwak_sdk/commands/feature_store/backfill/ui.py +146 -0
- qwak_sdk/commands/feature_store/delete/__init__.py +0 -0
- qwak_sdk/commands/feature_store/delete/_logic.py +104 -0
- qwak_sdk/commands/feature_store/delete/ui.py +40 -0
- qwak_sdk/commands/feature_store/execution/__init__.py +0 -0
- qwak_sdk/commands/feature_store/execution/ui.py +19 -0
- qwak_sdk/commands/feature_store/feature_store_command_group.py +29 -0
- qwak_sdk/commands/feature_store/list/__init__.py +0 -0
- qwak_sdk/commands/feature_store/list/ui.py +140 -0
- qwak_sdk/commands/feature_store/pause/__init__.py +0 -0
- qwak_sdk/commands/feature_store/pause/ui.py +18 -0
- qwak_sdk/commands/feature_store/register/__init__.py +0 -0
- qwak_sdk/commands/feature_store/register/_logic.py +367 -0
- qwak_sdk/commands/feature_store/register/ui.py +111 -0
- qwak_sdk/commands/feature_store/resume/__init__.py +0 -0
- qwak_sdk/commands/feature_store/resume/ui.py +18 -0
- qwak_sdk/commands/feature_store/trigger/__init__.py +0 -0
- qwak_sdk/commands/feature_store/trigger/ui.py +39 -0
- qwak_sdk/commands/models/__init__.py +0 -0
- qwak_sdk/commands/models/build/__init__.py +0 -0
- qwak_sdk/commands/models/build/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/build/_logic/build_steps.py +42 -0
- qwak_sdk/commands/models/build/_logic/client_logs/__init__.py +0 -0
- qwak_sdk/commands/models/build/_logic/client_logs/cli_phase_run_handler.py +123 -0
- qwak_sdk/commands/models/build/_logic/client_logs/cli_trigger_build_logger.py +19 -0
- qwak_sdk/commands/models/build/_logic/client_logs/logger.py +88 -0
- qwak_sdk/commands/models/build/_logic/client_logs/messages.py +36 -0
- qwak_sdk/commands/models/build/_logic/client_logs/spinner.py +14 -0
- qwak_sdk/commands/models/build/_logic/client_logs/trigger_build_logger.py +54 -0
- qwak_sdk/commands/models/build/_logic/client_logs/utils.py +12 -0
- qwak_sdk/commands/models/build/_logic/phase/__init__.py +0 -0
- qwak_sdk/commands/models/build/_logic/phase/a_fetch_model_code/__init__.py +20 -0
- qwak_sdk/commands/models/build/_logic/phase/a_fetch_model_code/get_sdk_version_step.py +14 -0
- qwak_sdk/commands/models/build/_logic/phase/b_remote_register_qwak_build/__init__.py +16 -0
- qwak_sdk/commands/models/build/_logic/phase/c_deploy/__init__.py +6 -0
- qwak_sdk/commands/models/build/_logic/phase/c_deploy/build_polling_status.py +55 -0
- qwak_sdk/commands/models/build/_logic/phase/c_deploy/deploy_build.py +61 -0
- qwak_sdk/commands/models/build/_logic/util/__init__.py +0 -0
- qwak_sdk/commands/models/build/_logic/util/protobuf_factory.py +45 -0
- qwak_sdk/commands/models/build/_logic/util/step_decorator.py +60 -0
- qwak_sdk/commands/models/build/_logic/util/text.py +9 -0
- qwak_sdk/commands/models/build/_logic/wait_until_finished.py +27 -0
- qwak_sdk/commands/models/build/ui.py +337 -0
- qwak_sdk/commands/models/builds/__init__.py +0 -0
- qwak_sdk/commands/models/builds/builds_commands_group.py +16 -0
- qwak_sdk/commands/models/builds/cancel/__init__.py +0 -0
- qwak_sdk/commands/models/builds/cancel/_logic.py +5 -0
- qwak_sdk/commands/models/builds/cancel/ui.py +15 -0
- qwak_sdk/commands/models/builds/logs/__init__.py +0 -0
- qwak_sdk/commands/models/builds/logs/ui.py +35 -0
- qwak_sdk/commands/models/builds/status/__init__.py +0 -0
- qwak_sdk/commands/models/builds/status/_logic.py +6 -0
- qwak_sdk/commands/models/builds/status/ui.py +39 -0
- qwak_sdk/commands/models/create/__init__.py +0 -0
- qwak_sdk/commands/models/create/_logic.py +36 -0
- qwak_sdk/commands/models/create/ui.py +43 -0
- qwak_sdk/commands/models/delete/__init__.py +0 -0
- qwak_sdk/commands/models/delete/_logic.py +5 -0
- qwak_sdk/commands/models/delete/ui.py +25 -0
- qwak_sdk/commands/models/deployments/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/advance_deployment_options_handler.py +31 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/base_deploy_executor.py +68 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/deploy_config.py +261 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/deployment.py +405 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/deployment_message_helpers.py +114 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/deployment_response_handler.py +156 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/deployment_size_mapper.py +96 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/get_latest_successful_build.py +28 -0
- qwak_sdk/commands/models/deployments/deploy/_logic/local_deployment.py +193 -0
- qwak_sdk/commands/models/deployments/deploy/batch/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/batch/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/batch/_logic/advanced_deployment_mapper.py +15 -0
- qwak_sdk/commands/models/deployments/deploy/batch/_logic/deploy_executor.py +24 -0
- qwak_sdk/commands/models/deployments/deploy/batch/ui.py +126 -0
- qwak_sdk/commands/models/deployments/deploy/deploy_commands_group.py +19 -0
- qwak_sdk/commands/models/deployments/deploy/realtime/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/realtime/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/realtime/_logic/advanced_deployment_mapper.py +21 -0
- qwak_sdk/commands/models/deployments/deploy/realtime/_logic/deploy_executor.py +24 -0
- qwak_sdk/commands/models/deployments/deploy/realtime/_logic/serving_strategy_mapper.py +75 -0
- qwak_sdk/commands/models/deployments/deploy/realtime/ui.py +209 -0
- qwak_sdk/commands/models/deployments/deploy/streaming/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/streaming/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/deploy/streaming/_logic/deploy_executor.py +24 -0
- qwak_sdk/commands/models/deployments/deploy/streaming/_logic/serving_strategy_mapper.py +38 -0
- qwak_sdk/commands/models/deployments/deploy/streaming/ui.py +213 -0
- qwak_sdk/commands/models/deployments/undeploy/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/undeploy/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/deployments/undeploy/_logic/request_undeploy.py +249 -0
- qwak_sdk/commands/models/deployments/undeploy/ui.py +72 -0
- qwak_sdk/commands/models/describe/__init__.py +0 -0
- qwak_sdk/commands/models/describe/_logic.py +169 -0
- qwak_sdk/commands/models/describe/ui.py +35 -0
- qwak_sdk/commands/models/executions/__init__.py +0 -0
- qwak_sdk/commands/models/executions/cancel/__init__.py +0 -0
- qwak_sdk/commands/models/executions/cancel/_logic.py +9 -0
- qwak_sdk/commands/models/executions/cancel/ui.py +27 -0
- qwak_sdk/commands/models/executions/execution_commands_group.py +24 -0
- qwak_sdk/commands/models/executions/report/__init__.py +0 -0
- qwak_sdk/commands/models/executions/report/_logic.py +14 -0
- qwak_sdk/commands/models/executions/report/ui.py +43 -0
- qwak_sdk/commands/models/executions/start/__init__.py +0 -0
- qwak_sdk/commands/models/executions/start/_logic.py +81 -0
- qwak_sdk/commands/models/executions/start/ui.py +208 -0
- qwak_sdk/commands/models/executions/status/__init__.py +0 -0
- qwak_sdk/commands/models/executions/status/_logic.py +13 -0
- qwak_sdk/commands/models/executions/status/ui.py +27 -0
- qwak_sdk/commands/models/init/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/initialize_model_structure.py +40 -0
- qwak_sdk/commands/models/init/_logic/template/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/churn/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/churn/cookiecutter.json +3 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/main/__init__.py +5 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/main/conda.yml +10 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/main/data.csv +1001 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/main/model.py +95 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/tests/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/tests/it/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/churn/{{cookiecutter.model_directory}}/tests/it/test_churn.py +32 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/cookiecutter.json +3 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/{{cookiecutter.model_directory}}/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/{{cookiecutter.model_directory}}/main/__init__.py +5 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/{{cookiecutter.model_directory}}/main/conda.yml +11 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/{{cookiecutter.model_directory}}/main/data.csv +1001 -0
- qwak_sdk/commands/models/init/_logic/template/credit_risk/{{cookiecutter.model_directory}}/main/model.py +108 -0
- qwak_sdk/commands/models/init/_logic/template/general/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/general/cookiecutter.json +6 -0
- qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/{{cookiecutter.main_directory}}/__init__.py +5 -0
- qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/{{cookiecutter.main_directory}}/conda.yml +8 -0
- qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/{{cookiecutter.main_directory}}/model.py +66 -0
- qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/{{cookiecutter.test_directory}}/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/general/{{cookiecutter.model_directory}}/{{cookiecutter.test_directory}}/test_qwak_model.py +5 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/cookiecutter.json +3 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/main/__init__.py +5 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/main/conda.yml +11 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/main/model.py +98 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/tests/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/tests/it/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic/{{cookiecutter.model_directory}}/tests/it/test_titanic.py +24 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/cookiecutter.json +3 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/main/__init__.py +5 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/main/model.py +98 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/main/pyproject.toml +20 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/tests/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/tests/it/__init__.py +0 -0
- qwak_sdk/commands/models/init/_logic/template/titanic_poetry/{{cookiecutter.model_directory}}/tests/it/test_titanic.py +25 -0
- qwak_sdk/commands/models/init/ui.py +61 -0
- qwak_sdk/commands/models/list/__init__.py +0 -0
- qwak_sdk/commands/models/list/_logic.py +5 -0
- qwak_sdk/commands/models/list/ui.py +40 -0
- qwak_sdk/commands/models/list_models/__init__.py +0 -0
- qwak_sdk/commands/models/list_models/_logic.py +5 -0
- qwak_sdk/commands/models/list_models/ui.py +60 -0
- qwak_sdk/commands/models/metadata/__init__.py +0 -0
- qwak_sdk/commands/models/metadata/_logic.py +5 -0
- qwak_sdk/commands/models/metadata/ui.py +60 -0
- qwak_sdk/commands/models/models_command_group.py +44 -0
- qwak_sdk/commands/models/runtime/__init__.py +0 -0
- qwak_sdk/commands/models/runtime/logs/__init__.py +0 -0
- qwak_sdk/commands/models/runtime/logs/ui.py +63 -0
- qwak_sdk/commands/models/runtime/runtime_commands_group.py +17 -0
- qwak_sdk/commands/models/runtime/update/__init__.py +0 -0
- qwak_sdk/commands/models/runtime/update/_logic.py +9 -0
- qwak_sdk/commands/models/runtime/update/ui.py +15 -0
- qwak_sdk/commands/projects/__init__.py +0 -0
- qwak_sdk/commands/projects/create/__init__.py +0 -0
- qwak_sdk/commands/projects/create/_logic.py +9 -0
- qwak_sdk/commands/projects/create/ui.py +68 -0
- qwak_sdk/commands/projects/delete/__init__.py +0 -0
- qwak_sdk/commands/projects/delete/_logic.py +6 -0
- qwak_sdk/commands/projects/delete/ui.py +24 -0
- qwak_sdk/commands/projects/list/__init__.py +0 -0
- qwak_sdk/commands/projects/list/_logic.py +6 -0
- qwak_sdk/commands/projects/list/ui.py +45 -0
- qwak_sdk/commands/projects/projects_command_group.py +19 -0
- qwak_sdk/commands/secrets/__init__.py +0 -0
- qwak_sdk/commands/secrets/delete/__init__.py +0 -0
- qwak_sdk/commands/secrets/delete/_logic.py +5 -0
- qwak_sdk/commands/secrets/delete/ui.py +21 -0
- qwak_sdk/commands/secrets/get/__init__.py +0 -0
- qwak_sdk/commands/secrets/get/_logic.py +5 -0
- qwak_sdk/commands/secrets/get/ui.py +17 -0
- qwak_sdk/commands/secrets/secrets_commands_group.py +19 -0
- qwak_sdk/commands/secrets/set/__init__.py +0 -0
- qwak_sdk/commands/secrets/set/_logic.py +5 -0
- qwak_sdk/commands/secrets/set/ui.py +16 -0
- qwak_sdk/commands/ui_tools.py +18 -0
- qwak_sdk/commands/workspaces/__init__.py +0 -0
- qwak_sdk/commands/workspaces/_logic/__init__.py +0 -0
- qwak_sdk/commands/workspaces/_logic/tools.py +44 -0
- qwak_sdk/commands/workspaces/_logic/workspace_validations.py +41 -0
- qwak_sdk/commands/workspaces/config/__init__.py +0 -0
- qwak_sdk/commands/workspaces/config/workspace_config.py +35 -0
- qwak_sdk/commands/workspaces/create/__init__.py +0 -0
- qwak_sdk/commands/workspaces/create/_logic.py +54 -0
- qwak_sdk/commands/workspaces/create/ui.py +48 -0
- qwak_sdk/commands/workspaces/delete/__init__.py +0 -0
- qwak_sdk/commands/workspaces/delete/_logic.py +30 -0
- qwak_sdk/commands/workspaces/delete/ui.py +23 -0
- qwak_sdk/commands/workspaces/start/__init__.py +0 -0
- qwak_sdk/commands/workspaces/start/_logic.py +30 -0
- qwak_sdk/commands/workspaces/start/ui.py +23 -0
- qwak_sdk/commands/workspaces/stop/__init__.py +0 -0
- qwak_sdk/commands/workspaces/stop/_logic.py +30 -0
- qwak_sdk/commands/workspaces/stop/ui.py +23 -0
- qwak_sdk/commands/workspaces/update/__init__.py +0 -0
- qwak_sdk/commands/workspaces/update/_logic.py +82 -0
- qwak_sdk/commands/workspaces/update/ui.py +57 -0
- qwak_sdk/commands/workspaces/workspaces_commands_group.py +23 -0
- qwak_sdk/exceptions/__init__.py +11 -0
- qwak_sdk/exceptions/qwak_command_exception.py +2 -0
- qwak_sdk/exceptions/qwak_deploy_new_build_failed.py +5 -0
- qwak_sdk/exceptions/qwak_resource_not_found.py +2 -0
- qwak_sdk/inner/__init__.py +0 -0
- qwak_sdk/inner/file_registry.py +98 -0
- qwak_sdk/inner/tools/__init__.py +0 -0
- qwak_sdk/inner/tools/cli_tools.py +220 -0
- qwak_sdk/inner/tools/config_handler.py +27 -0
- qwak_sdk/inner/tools/dataclasses_utils.py +21 -0
- qwak_sdk/inner/tools/logger/__init__.py +3 -0
- qwak_sdk/inner/tools/logger/logger.py +269 -0
- qwak_sdk/inner/tools/logger/logging.yml +79 -0
- qwak_sdk/inner/tools/tracking.py +47 -0
- qwak_sdk/main.py +9 -0
- qwak_sdk/tools/__init__.py +0 -0
- qwak_sdk/tools/colors.py +13 -0
- qwak_sdk/tools/files.py +63 -0
- qwak_sdk/tools/log_handling.py +159 -0
- qwak_sdk/tools/utils.py +42 -0
- qwak_sdk-0.5.102.dist-info/METADATA +51 -0
- qwak_sdk-0.5.102.dist-info/RECORD +328 -0
- qwak_sdk-0.5.102.dist-info/WHEEL +4 -0
- qwak_sdk-0.5.102.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from qwak.clients.instance_template.client import InstanceTemplateManagementClient
|
|
4
|
+
from qwak.clients.workspace_manager import WorkspaceManagerClient
|
|
5
|
+
from qwak.exceptions import QwakException
|
|
6
|
+
from qwak.inner.instance_template.verify_template_id import verify_template_id
|
|
7
|
+
|
|
8
|
+
WORKSPACE_NAME_EMPTY_VALIDATION_MSG = "Workspace name cannot be empty"
|
|
9
|
+
WORKSPACE_NAME_LENGTH_VALIDATION_MSG = (
|
|
10
|
+
"Workspace name must be between 3 and 254 characters."
|
|
11
|
+
)
|
|
12
|
+
MIN_WORKSPACE_NAME_LENGTH = 3
|
|
13
|
+
MAX_WORKSPACE_NAME_LENGTH = 254
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _validate_workspace_name(name: str):
|
|
17
|
+
if (name is None) or (len(name) == 0):
|
|
18
|
+
raise QwakException(WORKSPACE_NAME_EMPTY_VALIDATION_MSG)
|
|
19
|
+
if (len(name) < MIN_WORKSPACE_NAME_LENGTH) or (
|
|
20
|
+
len(name) > MAX_WORKSPACE_NAME_LENGTH
|
|
21
|
+
):
|
|
22
|
+
raise QwakException(WORKSPACE_NAME_LENGTH_VALIDATION_MSG)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _verify_image_id(image_id: str, workspace_manager_client: WorkspaceManagerClient):
|
|
26
|
+
workspace_images = workspace_manager_client.get_workspace_images().workspace_images
|
|
27
|
+
image_ids = [image.id for image in workspace_images]
|
|
28
|
+
if image_id not in image_ids:
|
|
29
|
+
raise QwakException(
|
|
30
|
+
f"Image {image_id} is not supported. Supported images are: {image_ids}"
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _verify_instance(instance: str):
|
|
35
|
+
instance_template_client = InstanceTemplateManagementClient()
|
|
36
|
+
verify_template_id(instance, instance_template_client)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def validate_id_or_name(workspace_id: Optional[str], workspace_name: Optional[str]):
|
|
40
|
+
if (not workspace_id) and (not workspace_name):
|
|
41
|
+
raise QwakException("Workspace id or name must be provided")
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
|
+
from typing import List
|
|
3
|
+
|
|
4
|
+
from qwak.inner.tool.run_config import (
|
|
5
|
+
ConfigCliMap,
|
|
6
|
+
QwakConfigBase,
|
|
7
|
+
YamlConfigMixin,
|
|
8
|
+
validate_string,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
WORKSPACE_CLI_CONFIG_MAPPING: List[ConfigCliMap] = [
|
|
12
|
+
ConfigCliMap("workspace_id", "workspace.workspace_id", validate_string, False),
|
|
13
|
+
ConfigCliMap("name", "workspace.name", validate_string, False),
|
|
14
|
+
ConfigCliMap("instance", "workspace.instance", validate_string, False),
|
|
15
|
+
ConfigCliMap("image", "workspace.image", validate_string, False),
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@dataclass
|
|
20
|
+
class WorkspaceConfig(YamlConfigMixin, QwakConfigBase):
|
|
21
|
+
def _post_merge_cli(self):
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
@property
|
|
25
|
+
def _config_mapping(self) -> List[ConfigCliMap]:
|
|
26
|
+
return WORKSPACE_CLI_CONFIG_MAPPING
|
|
27
|
+
|
|
28
|
+
@dataclass
|
|
29
|
+
class Workspace:
|
|
30
|
+
workspace_id: str = field(default_factory=str)
|
|
31
|
+
name: str = field(default_factory=str)
|
|
32
|
+
instance: str = field(default_factory=str)
|
|
33
|
+
image: str = field(default_factory=str)
|
|
34
|
+
|
|
35
|
+
workspace: Workspace = field(default_factory=Workspace)
|
|
File without changes
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from _qwak_proto.qwak.instance_template.instance_template_pb2 import InstanceType
|
|
2
|
+
from _qwak_proto.qwak.workspace.workspace_pb2 import DefaultWorkspaceDetails
|
|
3
|
+
from qwak.clients.instance_template.client import InstanceTemplateManagementClient
|
|
4
|
+
from qwak.clients.workspace_manager import WorkspaceManagerClient
|
|
5
|
+
|
|
6
|
+
from qwak_sdk.commands.workspaces._logic.workspace_validations import (
|
|
7
|
+
_validate_workspace_name,
|
|
8
|
+
_verify_image_id,
|
|
9
|
+
_verify_instance,
|
|
10
|
+
)
|
|
11
|
+
from qwak_sdk.commands.workspaces.config.workspace_config import WorkspaceConfig
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _create_workspace(config: WorkspaceConfig):
|
|
15
|
+
"""
|
|
16
|
+
Creating a new workspace
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
config: The workspace configuration
|
|
20
|
+
|
|
21
|
+
"""
|
|
22
|
+
print(f"Creating a new workspace with the name {config.workspace.name}")
|
|
23
|
+
workspace_manager_client = WorkspaceManagerClient()
|
|
24
|
+
default_details: DefaultWorkspaceDetails = (
|
|
25
|
+
workspace_manager_client.get_default_workspace_details()
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
_validate_workspace_name(config.workspace.name)
|
|
29
|
+
if config.workspace.instance:
|
|
30
|
+
_verify_instance(config.workspace.instance)
|
|
31
|
+
else:
|
|
32
|
+
config.workspace.instance = (
|
|
33
|
+
default_details.cpu_compute_resources.template_spec.template_id
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
if config.workspace.image:
|
|
37
|
+
_verify_image_id(config.workspace.image, workspace_manager_client)
|
|
38
|
+
else:
|
|
39
|
+
instance_spec = InstanceTemplateManagementClient().get_instance_template(
|
|
40
|
+
config.workspace.instance
|
|
41
|
+
)
|
|
42
|
+
config.workspace.image = (
|
|
43
|
+
default_details.cpu_image_id
|
|
44
|
+
if instance_spec.instance_type == InstanceType.INSTANCE_TYPE_CPU
|
|
45
|
+
else default_details.gpu_image_id
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
response = workspace_manager_client.create_workspace(
|
|
49
|
+
config.workspace.name, config.workspace.image, config.workspace.instance
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
print(
|
|
53
|
+
f"Workspace {config.workspace.name} was created successfully with id: {response.workspace_id}"
|
|
54
|
+
)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
|
|
5
|
+
from qwak_sdk.commands.workspaces.config.workspace_config import WorkspaceConfig
|
|
6
|
+
from qwak_sdk.commands.workspaces.create._logic import _create_workspace
|
|
7
|
+
from qwak_sdk.inner.tools.cli_tools import QwakCommand
|
|
8
|
+
from qwak_sdk.inner.tools.config_handler import config_handler
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@click.command("create", cls=QwakCommand)
|
|
12
|
+
@click.option(
|
|
13
|
+
"--name",
|
|
14
|
+
required=False,
|
|
15
|
+
metavar="NAME",
|
|
16
|
+
help="The name of the requested workspace",
|
|
17
|
+
)
|
|
18
|
+
@click.option(
|
|
19
|
+
"--instance",
|
|
20
|
+
required=False,
|
|
21
|
+
metavar="INSTANCE",
|
|
22
|
+
help="The instance id of the requested template",
|
|
23
|
+
)
|
|
24
|
+
@click.option(
|
|
25
|
+
"--image",
|
|
26
|
+
required=False,
|
|
27
|
+
metavar="IMAGE",
|
|
28
|
+
help="The image for the requested workspace",
|
|
29
|
+
)
|
|
30
|
+
@click.option(
|
|
31
|
+
"--out-conf",
|
|
32
|
+
help="Extract workspace conf from commands arguments, the commands will not run it wil only output valid yaml ",
|
|
33
|
+
default=False,
|
|
34
|
+
is_flag=True,
|
|
35
|
+
)
|
|
36
|
+
@click.option(
|
|
37
|
+
"--from-file",
|
|
38
|
+
required=False,
|
|
39
|
+
help="Create by run_config file, Command arguments will overwrite any run_config.",
|
|
40
|
+
)
|
|
41
|
+
def create_workspace(from_file: Optional[str], out_conf: bool, **kwargs):
|
|
42
|
+
config: WorkspaceConfig = config_handler(
|
|
43
|
+
config=WorkspaceConfig,
|
|
44
|
+
from_file=from_file,
|
|
45
|
+
**kwargs,
|
|
46
|
+
out_conf=out_conf,
|
|
47
|
+
)
|
|
48
|
+
_create_workspace(config)
|
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from qwak.clients.workspace_manager import WorkspaceManagerClient
|
|
4
|
+
|
|
5
|
+
from qwak_sdk.commands.workspaces._logic.tools import get_workspace_id_by_name
|
|
6
|
+
from qwak_sdk.commands.workspaces._logic.workspace_validations import (
|
|
7
|
+
validate_id_or_name,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _delete_workspace(workspace_id: Optional[str], workspace_name: Optional[str]):
|
|
12
|
+
"""
|
|
13
|
+
Deleting workspace
|
|
14
|
+
Args:
|
|
15
|
+
workspace_id: The id of the workspace to delete
|
|
16
|
+
"""
|
|
17
|
+
validate_id_or_name(workspace_id=workspace_id, workspace_name=workspace_name)
|
|
18
|
+
workspace_manager_client = WorkspaceManagerClient()
|
|
19
|
+
if workspace_id:
|
|
20
|
+
print(f"Deleting an existing workspace with id {workspace_id}")
|
|
21
|
+
workspace_manager_client.delete_workspace(workspace_id=workspace_id)
|
|
22
|
+
print(f"Workspace {workspace_id} was deleted successfully")
|
|
23
|
+
if workspace_name:
|
|
24
|
+
print(f"Deleting an existing workspace with name {workspace_name}")
|
|
25
|
+
workspace_id = get_workspace_id_by_name(
|
|
26
|
+
workspace_name=workspace_name,
|
|
27
|
+
workspace_manager_client=workspace_manager_client,
|
|
28
|
+
)
|
|
29
|
+
workspace_manager_client.delete_workspace(workspace_id=workspace_id)
|
|
30
|
+
print(f"Workspace {workspace_name} was deleted successfully")
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
|
|
5
|
+
from qwak_sdk.commands.workspaces.delete._logic import _delete_workspace
|
|
6
|
+
from qwak_sdk.inner.tools.cli_tools import QwakCommand
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@click.command("delete", cls=QwakCommand)
|
|
10
|
+
@click.option(
|
|
11
|
+
"--workspace-id",
|
|
12
|
+
required=False,
|
|
13
|
+
metavar="WORKSPACE-ID",
|
|
14
|
+
help="The id of the workspace",
|
|
15
|
+
)
|
|
16
|
+
@click.option(
|
|
17
|
+
"--name",
|
|
18
|
+
required=False,
|
|
19
|
+
metavar="WORKSPACE-NAME",
|
|
20
|
+
help="The name of the workspace",
|
|
21
|
+
)
|
|
22
|
+
def delete_workspace(workspace_id: Optional[str], name: Optional[str], **kwargs):
|
|
23
|
+
_delete_workspace(workspace_id=workspace_id, workspace_name=name)
|
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from qwak.clients.workspace_manager import WorkspaceManagerClient
|
|
4
|
+
|
|
5
|
+
from qwak_sdk.commands.workspaces._logic.tools import get_workspace_id_by_name
|
|
6
|
+
from qwak_sdk.commands.workspaces._logic.workspace_validations import (
|
|
7
|
+
validate_id_or_name,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _start_workspace(workspace_id: Optional[str], workspace_name=Optional[str]):
|
|
12
|
+
"""
|
|
13
|
+
Deploying an existing workspace
|
|
14
|
+
Args:
|
|
15
|
+
workspace_id: The id of the workspace to deploy
|
|
16
|
+
"""
|
|
17
|
+
validate_id_or_name(workspace_id=workspace_id, workspace_name=workspace_name)
|
|
18
|
+
workspace_manager_client = WorkspaceManagerClient()
|
|
19
|
+
if workspace_id:
|
|
20
|
+
print(f"Starting an existing workspace with id {workspace_id}")
|
|
21
|
+
workspace_manager_client.deploy_workspace(workspace_id=workspace_id)
|
|
22
|
+
print(f"Workspace {workspace_id} started successfully")
|
|
23
|
+
if workspace_name:
|
|
24
|
+
print(f"Starting an existing workspace with name {workspace_name}")
|
|
25
|
+
workspace_id = get_workspace_id_by_name(
|
|
26
|
+
workspace_name=workspace_name,
|
|
27
|
+
workspace_manager_client=workspace_manager_client,
|
|
28
|
+
)
|
|
29
|
+
workspace_manager_client.deploy_workspace(workspace_id=workspace_id)
|
|
30
|
+
print(f"Workspace {workspace_name} started successfully")
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
|
|
5
|
+
from qwak_sdk.commands.workspaces.start._logic import _start_workspace
|
|
6
|
+
from qwak_sdk.inner.tools.cli_tools import QwakCommand
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@click.command("start", cls=QwakCommand)
|
|
10
|
+
@click.option(
|
|
11
|
+
"--workspace-id",
|
|
12
|
+
required=False,
|
|
13
|
+
metavar="WORKSPACE-ID",
|
|
14
|
+
help="The id of the workspace",
|
|
15
|
+
)
|
|
16
|
+
@click.option(
|
|
17
|
+
"--name",
|
|
18
|
+
required=False,
|
|
19
|
+
metavar="WORKSPACE-NAME",
|
|
20
|
+
help="The name of the workspace",
|
|
21
|
+
)
|
|
22
|
+
def start_workspace(workspace_id: Optional[str], name: Optional[str], **kwargs):
|
|
23
|
+
_start_workspace(workspace_id=workspace_id, workspace_name=name)
|
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from qwak.clients.workspace_manager import WorkspaceManagerClient
|
|
4
|
+
|
|
5
|
+
from qwak_sdk.commands.workspaces._logic.tools import get_workspace_id_by_name
|
|
6
|
+
from qwak_sdk.commands.workspaces._logic.workspace_validations import (
|
|
7
|
+
validate_id_or_name,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _stop_workspace(workspace_id: Optional[str], workspace_name: Optional[str]):
|
|
12
|
+
"""
|
|
13
|
+
Stop an existing workspace
|
|
14
|
+
Args:
|
|
15
|
+
workspace_id: The id of the workspace to deploy
|
|
16
|
+
"""
|
|
17
|
+
validate_id_or_name(workspace_id=workspace_id, workspace_name=workspace_name)
|
|
18
|
+
workspace_manager_client = WorkspaceManagerClient()
|
|
19
|
+
if workspace_id:
|
|
20
|
+
print(f"Stopping an existing workspace with id {workspace_id}")
|
|
21
|
+
workspace_manager_client.undeploy_workspace(workspace_id=workspace_id)
|
|
22
|
+
print(f"Workspace {workspace_id} was stopped successfully")
|
|
23
|
+
if workspace_name:
|
|
24
|
+
print(f"Stopping an existing workspace with name {workspace_name}")
|
|
25
|
+
workspace_id = get_workspace_id_by_name(
|
|
26
|
+
workspace_name=workspace_name,
|
|
27
|
+
workspace_manager_client=workspace_manager_client,
|
|
28
|
+
)
|
|
29
|
+
workspace_manager_client.undeploy_workspace(workspace_id=workspace_id)
|
|
30
|
+
print(f"Workspace {workspace_name} was stopped successfully")
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
|
|
5
|
+
from qwak_sdk.commands.workspaces.stop._logic import _stop_workspace
|
|
6
|
+
from qwak_sdk.inner.tools.cli_tools import QwakCommand
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@click.command("stop", cls=QwakCommand)
|
|
10
|
+
@click.option(
|
|
11
|
+
"--workspace-id",
|
|
12
|
+
required=False,
|
|
13
|
+
metavar="WORKSPACE-ID",
|
|
14
|
+
help="The id of the workspace",
|
|
15
|
+
)
|
|
16
|
+
@click.option(
|
|
17
|
+
"--name",
|
|
18
|
+
required=False,
|
|
19
|
+
metavar="WORKSPACE-NAME",
|
|
20
|
+
help="The name of the workspace",
|
|
21
|
+
)
|
|
22
|
+
def stop_workspace(workspace_id: Optional[str], name: Optional[str], **kwargs):
|
|
23
|
+
_stop_workspace(workspace_id=workspace_id, workspace_name=name)
|
|
File without changes
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
from qwak.clients.workspace_manager import WorkspaceManagerClient
|
|
2
|
+
|
|
3
|
+
from qwak_sdk.commands.workspaces._logic.tools import get_workspace_by_name
|
|
4
|
+
from qwak_sdk.commands.workspaces._logic.workspace_validations import (
|
|
5
|
+
_validate_workspace_name,
|
|
6
|
+
_verify_image_id,
|
|
7
|
+
_verify_instance,
|
|
8
|
+
validate_id_or_name,
|
|
9
|
+
)
|
|
10
|
+
from qwak_sdk.commands.workspaces.config.workspace_config import WorkspaceConfig
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _update_workspace(config: WorkspaceConfig):
|
|
14
|
+
"""
|
|
15
|
+
Updating a workspace
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
config: The workspace configuration
|
|
19
|
+
|
|
20
|
+
"""
|
|
21
|
+
validate_id_or_name(
|
|
22
|
+
workspace_id=config.workspace.workspace_id, workspace_name=config.workspace.name
|
|
23
|
+
)
|
|
24
|
+
workspace_manager_client = WorkspaceManagerClient()
|
|
25
|
+
if config.workspace.workspace_id:
|
|
26
|
+
print(
|
|
27
|
+
f"Updating a workspace with the workspace id {config.workspace.workspace_id}"
|
|
28
|
+
)
|
|
29
|
+
current_workspace = workspace_manager_client.get_workspace_by_id(
|
|
30
|
+
workspace_id=config.workspace.workspace_id
|
|
31
|
+
).workspace
|
|
32
|
+
else:
|
|
33
|
+
print(f"Updating a workspace with the workspace name {config.workspace.name}")
|
|
34
|
+
current_workspace = get_workspace_by_name(
|
|
35
|
+
workspace_name=config.workspace.name,
|
|
36
|
+
workspace_manager_client=workspace_manager_client,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
workspace_id = current_workspace.workspace_id
|
|
40
|
+
workspace_name = config.workspace.name
|
|
41
|
+
image_id = config.workspace.image
|
|
42
|
+
instance = config.workspace.instance
|
|
43
|
+
|
|
44
|
+
if _is_not_empty_and_not_none(workspace_name):
|
|
45
|
+
_validate_workspace_name(workspace_name)
|
|
46
|
+
|
|
47
|
+
if _is_not_empty_and_not_none(image_id):
|
|
48
|
+
_verify_image_id(image_id, workspace_manager_client)
|
|
49
|
+
|
|
50
|
+
if _is_not_empty_and_not_none(instance):
|
|
51
|
+
_verify_instance(instance)
|
|
52
|
+
|
|
53
|
+
name = (
|
|
54
|
+
workspace_name
|
|
55
|
+
if _is_not_empty_and_not_none(workspace_name)
|
|
56
|
+
else current_workspace.workspace_name
|
|
57
|
+
)
|
|
58
|
+
image_id = (
|
|
59
|
+
image_id if _is_not_empty_and_not_none(image_id) else current_workspace.image_id
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
instance = (
|
|
63
|
+
instance
|
|
64
|
+
if _is_not_empty_and_not_none(instance)
|
|
65
|
+
else current_workspace.client_pod_compute_resources.template_spec.template_id
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
workspace_manager_client.update_workspace(
|
|
69
|
+
workspace_id=workspace_id,
|
|
70
|
+
image_id=image_id,
|
|
71
|
+
template_id=instance,
|
|
72
|
+
workspace_name=name,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
if config.workspace.workspace_id:
|
|
76
|
+
print(f"Workspace {workspace_id} was updated successfully")
|
|
77
|
+
else:
|
|
78
|
+
print(f"Workspace {workspace_name} was updated successfully")
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _is_not_empty_and_not_none(value: str) -> bool:
|
|
82
|
+
return value is not None and value != ""
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
|
|
5
|
+
from qwak_sdk.commands.workspaces.config.workspace_config import WorkspaceConfig
|
|
6
|
+
from qwak_sdk.commands.workspaces.update._logic import _update_workspace
|
|
7
|
+
from qwak_sdk.inner.tools.cli_tools import QwakCommand
|
|
8
|
+
from qwak_sdk.inner.tools.config_handler import config_handler
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@click.command("update", cls=QwakCommand)
|
|
12
|
+
@click.option(
|
|
13
|
+
"--workspace-id",
|
|
14
|
+
required=False,
|
|
15
|
+
metavar="WORKSPACE-ID",
|
|
16
|
+
help="The id of the workspace",
|
|
17
|
+
)
|
|
18
|
+
@click.option(
|
|
19
|
+
"--name",
|
|
20
|
+
metavar="NAME",
|
|
21
|
+
required=False,
|
|
22
|
+
default=None,
|
|
23
|
+
help="The name of the requested workspace",
|
|
24
|
+
)
|
|
25
|
+
@click.option(
|
|
26
|
+
"--instance",
|
|
27
|
+
metavar="INSTANCE",
|
|
28
|
+
required=False,
|
|
29
|
+
default=None,
|
|
30
|
+
help="The instance id of the requested template",
|
|
31
|
+
)
|
|
32
|
+
@click.option(
|
|
33
|
+
"--image",
|
|
34
|
+
required=False,
|
|
35
|
+
metavar="IMAGE",
|
|
36
|
+
default=None,
|
|
37
|
+
help="The image template for the requested workspace",
|
|
38
|
+
)
|
|
39
|
+
@click.option(
|
|
40
|
+
"--out-conf",
|
|
41
|
+
help="Extract workspace conf from commands arguments, the commands will not run it wil only output valid yaml ",
|
|
42
|
+
default=False,
|
|
43
|
+
is_flag=True,
|
|
44
|
+
)
|
|
45
|
+
@click.option(
|
|
46
|
+
"--from-file",
|
|
47
|
+
required=False,
|
|
48
|
+
help="Create by run_config file, Command arguments will overwrite any run_config.",
|
|
49
|
+
)
|
|
50
|
+
def update_workspace(from_file: Optional[str], out_conf: bool, **kwargs):
|
|
51
|
+
config: WorkspaceConfig = config_handler(
|
|
52
|
+
config=WorkspaceConfig,
|
|
53
|
+
from_file=from_file,
|
|
54
|
+
**kwargs,
|
|
55
|
+
out_conf=out_conf,
|
|
56
|
+
)
|
|
57
|
+
_update_workspace(config)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from qwak_sdk.commands.workspaces.create.ui import create_workspace
|
|
4
|
+
from qwak_sdk.commands.workspaces.delete.ui import delete_workspace
|
|
5
|
+
from qwak_sdk.commands.workspaces.start.ui import start_workspace
|
|
6
|
+
from qwak_sdk.commands.workspaces.stop.ui import stop_workspace
|
|
7
|
+
from qwak_sdk.commands.workspaces.update.ui import update_workspace
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@click.group(
|
|
11
|
+
"workspaces",
|
|
12
|
+
help="Commands for interacting with workspaces",
|
|
13
|
+
)
|
|
14
|
+
def workspaces_commands_group():
|
|
15
|
+
# Click commands group injection
|
|
16
|
+
pass
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
workspaces_commands_group.add_command(create_workspace)
|
|
20
|
+
workspaces_commands_group.add_command(update_workspace)
|
|
21
|
+
workspaces_commands_group.add_command(start_workspace)
|
|
22
|
+
workspaces_commands_group.add_command(delete_workspace)
|
|
23
|
+
workspaces_commands_group.add_command(stop_workspace)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from qwak.exceptions import QwakGeneralBuildException, QwakSuggestionException
|
|
2
|
+
|
|
3
|
+
from .qwak_command_exception import QwakCommandException
|
|
4
|
+
from .qwak_resource_not_found import QwakResourceNotFound
|
|
5
|
+
|
|
6
|
+
__all__ = [
|
|
7
|
+
"QwakGeneralBuildException",
|
|
8
|
+
"QwakSuggestionException",
|
|
9
|
+
"QwakResourceNotFound",
|
|
10
|
+
"QwakCommandException",
|
|
11
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import importlib.util
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
from contextlib import contextmanager
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import List, Tuple
|
|
7
|
+
|
|
8
|
+
from yaspin.core import Yaspin
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def list_qwak_python_files(path: Path, sp: Yaspin) -> List[Tuple[str, str]]:
|
|
12
|
+
"""
|
|
13
|
+
Helper function which finds python files with qwak imports in a given module
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
path: path to a directory
|
|
17
|
+
sp: spinner object, used to print
|
|
18
|
+
Returns:
|
|
19
|
+
List of python files which use the Qwak SDK
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
file_paths = []
|
|
23
|
+
if Path.is_dir(path):
|
|
24
|
+
for object_path in path.glob("**/*.py"):
|
|
25
|
+
try:
|
|
26
|
+
if not object_path.is_file():
|
|
27
|
+
continue
|
|
28
|
+
mod_name, file_ext = os.path.splitext(object_path.name)
|
|
29
|
+
if file_ext != ".py" or mod_name == "setup":
|
|
30
|
+
continue
|
|
31
|
+
|
|
32
|
+
with object_path.open("rb") as fp:
|
|
33
|
+
content = fp.read()
|
|
34
|
+
contains_qwak_feature = all(
|
|
35
|
+
[token in content for token in (b"qwak")]
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
if not contains_qwak_feature:
|
|
39
|
+
continue
|
|
40
|
+
|
|
41
|
+
with _add_to_python_path(object_path):
|
|
42
|
+
# Test that the file can be imported cleanly
|
|
43
|
+
spec = importlib.util.spec_from_file_location(mod_name, object_path)
|
|
44
|
+
if not spec:
|
|
45
|
+
sp.write(f"Could not load file: {object_path}. Skipping.")
|
|
46
|
+
continue
|
|
47
|
+
module = importlib.util.module_from_spec(spec)
|
|
48
|
+
spec.loader.exec_module(module)
|
|
49
|
+
|
|
50
|
+
file_paths.append((mod_name, object_path))
|
|
51
|
+
except Exception as e:
|
|
52
|
+
sp.write(
|
|
53
|
+
f"Got an error trying to handle the file {object_path}, error is: {e}. Skipping."
|
|
54
|
+
)
|
|
55
|
+
return file_paths
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def extract_class_objects(python_files, clazz):
|
|
59
|
+
"""
|
|
60
|
+
Helper function which given a list of python files extracts objects of the type `clazz`
|
|
61
|
+
|
|
62
|
+
Args
|
|
63
|
+
python_files: list of python files
|
|
64
|
+
clazz: class object which its instances should be extracted
|
|
65
|
+
Returns
|
|
66
|
+
list of extracted objects of type clazz from the given python files
|
|
67
|
+
"""
|
|
68
|
+
clazz_objects = []
|
|
69
|
+
for mod, file in python_files:
|
|
70
|
+
with _add_to_python_path(Path(file)):
|
|
71
|
+
spec = importlib.util.spec_from_file_location(mod, file)
|
|
72
|
+
if not spec:
|
|
73
|
+
continue
|
|
74
|
+
|
|
75
|
+
module = importlib.util.module_from_spec(spec)
|
|
76
|
+
spec.loader.exec_module(module)
|
|
77
|
+
for feature in list(module.__dict__.values()):
|
|
78
|
+
if isinstance(feature, clazz):
|
|
79
|
+
clazz_objects.append((feature, file))
|
|
80
|
+
|
|
81
|
+
return clazz_objects
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@contextmanager
|
|
85
|
+
def _add_to_python_path(path: Path):
|
|
86
|
+
"""
|
|
87
|
+
Helper function - context adding path to python path and then remove it
|
|
88
|
+
|
|
89
|
+
Args
|
|
90
|
+
path: path of file or folder to add to python path, in case of file adds the containing folder
|
|
91
|
+
Returns
|
|
92
|
+
"""
|
|
93
|
+
try:
|
|
94
|
+
folder = str(path.parent) if path.is_file() else str(path)
|
|
95
|
+
sys.path.append(folder)
|
|
96
|
+
yield
|
|
97
|
+
finally:
|
|
98
|
+
sys.path.remove(folder)
|
|
File without changes
|