cornflow 2.0.0a21__tar.gz → 2.0.0rc2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cornflow-2.0.0a21/cornflow.egg-info → cornflow-2.0.0rc2}/PKG-INFO +26 -26
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/app.py +264 -219
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/migrations.py +13 -20
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/roles.py +1 -1
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/service.py +71 -40
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/commands/access.py +14 -3
- cornflow-2.0.0rc2/cornflow/commands/auxiliar.py +109 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/commands/dag.py +7 -7
- cornflow-2.0.0rc2/cornflow/commands/permissions.py +309 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/commands/roles.py +15 -14
- cornflow-2.0.0rc2/cornflow/commands/views.py +217 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/config.py +17 -5
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/__init__.py +27 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/case.py +37 -21
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/dag.py +5 -5
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/data_check.py +6 -7
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/example_data.py +4 -2
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/execution.py +76 -246
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/health.py +12 -23
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/instance.py +3 -3
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/login.py +9 -2
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/meta_resource.py +25 -4
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/permission.py +1 -2
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/schemas.py +3 -3
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/signup.py +17 -11
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/user_role.py +12 -2
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/versions/999b98e24225.py +1 -1
- cornflow-2.0.0rc2/cornflow/migrations/versions/cef1df240b27_.py +34 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/models/__init__.py +2 -1
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/models/base_data_model.py +3 -4
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/models/dag.py +9 -11
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/models/dag_permissions.py +3 -3
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/models/execution.py +1 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/models/permissions.py +1 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/models/user.py +1 -1
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/execution.py +21 -1
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/health.py +1 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/shared/authentication/auth.py +16 -8
- cornflow-2.0.0rc2/cornflow/shared/authentication/decorators.py +72 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/shared/const.py +42 -5
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/shared/exceptions.py +0 -1
- cornflow-2.0.0rc2/cornflow/tests/base_test_execution.py +798 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/const.py +1 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/integration/test_commands.py +2 -2
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_apiview.py +7 -1
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_cases.py +1 -1
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_cli.py +6 -3
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_commands.py +4 -3
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_dags.py +3 -3
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_example_data.py +1 -1
- cornflow-2.0.0rc2/cornflow/tests/unit/test_executions.py +124 -0
- cornflow-2.0.0rc2/cornflow/tests/unit/test_external_role_creation.py +785 -0
- cornflow-2.0.0rc2/cornflow/tests/unit/test_get_resources.py +103 -0
- cornflow-2.0.0rc2/cornflow/tests/unit/test_health.py +118 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_instances.py +3 -2
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_main_alarms.py +1 -1
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_roles.py +19 -13
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_schema_from_models.py +1 -1
- cornflow-2.0.0rc2/cornflow/tests/unit/test_sign_up.py +297 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/tools.py +6 -6
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2/cornflow.egg-info}/PKG-INFO +26 -26
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow.egg-info/SOURCES.txt +5 -3
- cornflow-2.0.0rc2/cornflow.egg-info/requires.txt +36 -0
- cornflow-2.0.0rc2/requirements.txt +32 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/setup.py +2 -2
- cornflow-2.0.0a21/cornflow/commands/permissions.py +0 -209
- cornflow-2.0.0a21/cornflow/commands/views.py +0 -70
- cornflow-2.0.0a21/cornflow/orchestrator_constants.py +0 -12
- cornflow-2.0.0a21/cornflow/shared/airflow.py +0 -157
- cornflow-2.0.0a21/cornflow/shared/authentication/decorators.py +0 -42
- cornflow-2.0.0a21/cornflow/shared/databricks.py +0 -133
- cornflow-2.0.0a21/cornflow/tests/unit/test_executions.py +0 -905
- cornflow-2.0.0a21/cornflow/tests/unit/test_health.py +0 -34
- cornflow-2.0.0a21/cornflow/tests/unit/test_sign_up.py +0 -122
- cornflow-2.0.0a21/cornflow.egg-info/requires.txt +0 -36
- cornflow-2.0.0a21/requirements.txt +0 -32
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/MANIFEST.in +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/README.rst +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/airflow_config/__init__.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/airflow_config/airflow_local_settings.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/airflow_config/plugins/XCom/__init__.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/airflow_config/plugins/XCom/gce_xcom_backend.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/airflow_config/plugins/__init__.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/airflow_config/webserver_ldap.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/__init__.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/__init__.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/actions.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/arguments.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/config.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/permissions.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/schemas.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/tools/__init__.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/tools/api_generator.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/tools/endpoint_tools.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/tools/models_tools.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/tools/schema_generator.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/tools/schemas_tools.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/tools/tools.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/users.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/utils.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/cli/views.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/commands/__init__.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/commands/actions.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/commands/cleanup.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/commands/schemas.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/commands/users.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/action.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/alarms.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/apiview.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/licenses.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/main_alarms.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/roles.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/tables.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/token.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/endpoints/user.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/gunicorn.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/README +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/alembic.ini +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/env.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/script.py.mako +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/versions/00757b557b02_.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/versions/1af47a419bbd_.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/versions/4aac5e0c6e66_.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/versions/7c3ea5ab5501_.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/versions/991b98e24225_.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/versions/a472b5ad50b7_.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/versions/c2db9409cb5f_.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/versions/c8a6c762e818_.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/versions/ca449af8034c_.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/versions/d0e0700dcd8e_.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/versions/d1b5be1f0549_.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/versions/e1a50dae1ac9_.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/versions/e937a5234ce4_.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/versions/ebdd955fcc5e_.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/migrations/versions/f3bee20314a2_.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/models/action.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/models/alarms.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/models/case.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/models/instance.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/models/main_alarms.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/models/meta_models.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/models/role.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/models/user_role.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/models/view.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/__init__.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/action.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/alarms.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/case.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/common.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/dag.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/example_data.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/instance.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/main_alarms.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/model_json.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/patch.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/permissions.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/query.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/role.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/schemas.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/solution_log.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/tables.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/user.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/user_role.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/schemas/view.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/shared/__init__.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/shared/authentication/__init__.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/shared/authentication/ldap.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/shared/compress.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/shared/email.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/shared/licenses.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/shared/log_config.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/shared/query_tools.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/shared/utils.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/shared/utils_tables.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/shared/validators.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/__init__.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/custom_liveServer.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/custom_test_case.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/integration/__init__.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/integration/test_cornflowclient.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/ldap/__init__.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/ldap/test_ldap_authentication.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/__init__.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_actions.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_alarms.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_application.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_data_checks.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_generate_from_schema.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_instances_file.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_licenses.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_log_in.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_permissions.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_schemas.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_tables.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_token.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow/tests/unit/test_users.py +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow.egg-info/dependency_links.txt +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow.egg-info/entry_points.txt +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/cornflow.egg-info/top_level.txt +0 -0
- {cornflow-2.0.0a21 → cornflow-2.0.0rc2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cornflow
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.0rc2
|
|
4
4
|
Summary: cornflow is an open source multi-solver optimization server with a REST API built using flask.
|
|
5
5
|
Home-page: https://github.com/baobabsoluciones/cornflow
|
|
6
6
|
Author: baobab soluciones
|
|
@@ -9,39 +9,39 @@ Classifier: Programming Language :: Python :: 3
|
|
|
9
9
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
-
Requires-Python: >=3.
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
13
|
Requires-Dist: alembic==1.9.2
|
|
14
|
-
Requires-Dist: apispec
|
|
14
|
+
Requires-Dist: apispec==6.3.0
|
|
15
15
|
Requires-Dist: cachetools==5.3.3
|
|
16
|
-
Requires-Dist: click
|
|
17
|
-
Requires-Dist: cornflow-client==2.0.
|
|
18
|
-
Requires-Dist: cryptography
|
|
19
|
-
Requires-Dist:
|
|
20
|
-
Requires-Dist: disposable-email-domains>=0.0.86
|
|
16
|
+
Requires-Dist: click==8.1.7
|
|
17
|
+
Requires-Dist: cornflow-client==2.0.0rc2
|
|
18
|
+
Requires-Dist: cryptography==46.0.5
|
|
19
|
+
Requires-Dist: disposable-email-domains==0.0.162
|
|
21
20
|
Requires-Dist: Flask==2.3.2
|
|
22
|
-
Requires-Dist: flask-apispec
|
|
23
|
-
Requires-Dist: Flask-Bcrypt
|
|
24
|
-
Requires-Dist: Flask-Compress
|
|
25
|
-
Requires-Dist: flask-cors
|
|
26
|
-
Requires-Dist: flask-inflate
|
|
27
|
-
Requires-Dist: Flask-Migrate
|
|
28
|
-
Requires-Dist: Flask-RESTful
|
|
21
|
+
Requires-Dist: flask-apispec==0.11.4
|
|
22
|
+
Requires-Dist: Flask-Bcrypt==1.0.1
|
|
23
|
+
Requires-Dist: Flask-Compress==1.14
|
|
24
|
+
Requires-Dist: flask-cors==6.0.0
|
|
25
|
+
Requires-Dist: flask-inflate==0.3
|
|
26
|
+
Requires-Dist: Flask-Migrate==4.0.5
|
|
27
|
+
Requires-Dist: Flask-RESTful==0.3.10
|
|
29
28
|
Requires-Dist: Flask-SQLAlchemy==2.5.1
|
|
30
29
|
Requires-Dist: gevent==23.9.1
|
|
31
|
-
Requires-Dist: greenlet
|
|
30
|
+
Requires-Dist: greenlet==2.0.2; python_version < "3.11"
|
|
32
31
|
Requires-Dist: greenlet==3.0.3; python_version >= "3.11"
|
|
33
|
-
Requires-Dist: gunicorn
|
|
34
|
-
Requires-Dist: jsonpatch
|
|
35
|
-
Requires-Dist: ldap3
|
|
36
|
-
Requires-Dist: marshmallow
|
|
37
|
-
Requires-Dist: PuLP
|
|
38
|
-
Requires-Dist: psycopg2
|
|
39
|
-
Requires-Dist: PyJWT
|
|
40
|
-
Requires-Dist: pytups
|
|
41
|
-
Requires-Dist: requests
|
|
32
|
+
Requires-Dist: gunicorn==23.0.0
|
|
33
|
+
Requires-Dist: jsonpatch==1.33
|
|
34
|
+
Requires-Dist: ldap3==2.9.1
|
|
35
|
+
Requires-Dist: marshmallow==3.26.2
|
|
36
|
+
Requires-Dist: PuLP==2.9.0
|
|
37
|
+
Requires-Dist: psycopg2==2.9.9
|
|
38
|
+
Requires-Dist: PyJWT==2.12.0
|
|
39
|
+
Requires-Dist: pytups==0.86.2
|
|
40
|
+
Requires-Dist: requests==2.32.4
|
|
42
41
|
Requires-Dist: SQLAlchemy==1.3.21
|
|
43
|
-
Requires-Dist: webargs
|
|
42
|
+
Requires-Dist: webargs==8.3.0
|
|
44
43
|
Requires-Dist: Werkzeug==3.0.6
|
|
44
|
+
Requires-Dist: setuptools==78.1.1
|
|
45
45
|
Dynamic: author
|
|
46
46
|
Dynamic: author-email
|
|
47
47
|
Dynamic: classifier
|
|
@@ -1,219 +1,264 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Main file with the creation of the app logic
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
# Full imports
|
|
6
|
-
import os
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
from
|
|
17
|
-
from
|
|
18
|
-
from werkzeug.exceptions import NotFound
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
from cornflow.
|
|
35
|
-
from cornflow.endpoints
|
|
36
|
-
from cornflow.endpoints.
|
|
37
|
-
from cornflow.
|
|
38
|
-
from cornflow.shared
|
|
39
|
-
from cornflow.shared.
|
|
40
|
-
from cornflow.shared.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
app.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
@click.
|
|
179
|
-
@
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
@click.
|
|
192
|
-
@click.option("-v", "--verbose", is_flag=True, default=False)
|
|
193
|
-
@with_appcontext
|
|
194
|
-
def
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
@click.command("
|
|
199
|
-
@click.option("-
|
|
200
|
-
@click.option("-
|
|
201
|
-
@click.option("-p", "--password", type=str)
|
|
202
|
-
@click.option("-v", "--verbose", is_flag=True, default=False)
|
|
203
|
-
@with_appcontext
|
|
204
|
-
def
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
@click.command("
|
|
209
|
-
@click.option("-
|
|
210
|
-
@
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
1
|
+
"""
|
|
2
|
+
Main file with the creation of the app logic
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
# Full imports
|
|
6
|
+
import os
|
|
7
|
+
from logging.config import dictConfig
|
|
8
|
+
|
|
9
|
+
import click
|
|
10
|
+
|
|
11
|
+
# Partial imports
|
|
12
|
+
from flask import Flask, Blueprint
|
|
13
|
+
from flask.cli import with_appcontext
|
|
14
|
+
from flask_apispec.extension import FlaskApiSpec
|
|
15
|
+
from flask_cors import CORS
|
|
16
|
+
from flask_migrate import Migrate
|
|
17
|
+
from flask_restful import Api
|
|
18
|
+
from werkzeug.exceptions import NotFound
|
|
19
|
+
from werkzeug.middleware.dispatcher import DispatcherMiddleware
|
|
20
|
+
|
|
21
|
+
# Module imports
|
|
22
|
+
from cornflow.commands import (
|
|
23
|
+
create_service_user_command,
|
|
24
|
+
create_admin_user_command,
|
|
25
|
+
create_planner_user_command,
|
|
26
|
+
register_roles_command,
|
|
27
|
+
register_actions_command,
|
|
28
|
+
register_views_command,
|
|
29
|
+
register_base_permissions_command,
|
|
30
|
+
access_init_command,
|
|
31
|
+
register_deployed_dags_command,
|
|
32
|
+
register_dag_permissions_command,
|
|
33
|
+
)
|
|
34
|
+
from cornflow.config import app_config
|
|
35
|
+
from cornflow.endpoints import resources, alarms_resources
|
|
36
|
+
from cornflow.endpoints.login import LoginEndpoint, LoginOpenAuthEndpoint
|
|
37
|
+
from cornflow.endpoints.signup import SignUpEndpoint
|
|
38
|
+
from cornflow.shared import db, bcrypt
|
|
39
|
+
from cornflow.shared.compress import init_compress
|
|
40
|
+
from cornflow.shared.const import (
|
|
41
|
+
AUTH_DB,
|
|
42
|
+
AUTH_LDAP,
|
|
43
|
+
AUTH_OID,
|
|
44
|
+
CONDITIONAL_ENDPOINTS,
|
|
45
|
+
SIGNUP_WITH_AUTH,
|
|
46
|
+
SIGNUP_WITH_NO_AUTH,
|
|
47
|
+
)
|
|
48
|
+
from cornflow.shared.exceptions import initialize_errorhandlers, ConfigurationError
|
|
49
|
+
from cornflow.shared.log_config import log_config
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def create_app(env_name="development", dataconn=None):
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
:param str env_name: 'testing' or 'development' or 'production'
|
|
56
|
+
:param str dataconn: string to connect to the database
|
|
57
|
+
:return: the application that is going to be running :class:`Flask`
|
|
58
|
+
:rtype: :class:`Flask`
|
|
59
|
+
"""
|
|
60
|
+
dictConfig(log_config(app_config[env_name].LOG_LEVEL))
|
|
61
|
+
|
|
62
|
+
# Note: Explicit CSRF protection is not configured as the application uses
|
|
63
|
+
# JWT for authentication via headers, mitigating standard CSRF vulnerabilities.
|
|
64
|
+
app = Flask(__name__)
|
|
65
|
+
app.json.sort_keys = False
|
|
66
|
+
app.logger.setLevel(app_config[env_name].LOG_LEVEL)
|
|
67
|
+
|
|
68
|
+
app.config.from_object(app_config[env_name])
|
|
69
|
+
# initialization for init_cornflow_service.py
|
|
70
|
+
if dataconn is not None:
|
|
71
|
+
app.config["SQLALCHEMY_DATABASE_URI"] = dataconn
|
|
72
|
+
CORS(app)
|
|
73
|
+
bcrypt.init_app(app)
|
|
74
|
+
db.init_app(app)
|
|
75
|
+
Migrate(app=app, db=db)
|
|
76
|
+
|
|
77
|
+
if "sqlite" in app.config["SQLALCHEMY_DATABASE_URI"]:
|
|
78
|
+
|
|
79
|
+
def _fk_pragma_on_connect(dbapi_con, _con_record):
|
|
80
|
+
dbapi_con.execute("pragma foreign_keys=ON")
|
|
81
|
+
|
|
82
|
+
with app.app_context():
|
|
83
|
+
from sqlalchemy import event
|
|
84
|
+
|
|
85
|
+
event.listen(db.engine, "connect", _fk_pragma_on_connect)
|
|
86
|
+
|
|
87
|
+
# Rutas del Core bajo /cornflow/ via Blueprint (URLs canónicas)
|
|
88
|
+
cornflow_bp = Blueprint("cornflow", __name__, url_prefix="/cornflow")
|
|
89
|
+
api = Api(cornflow_bp)
|
|
90
|
+
for res in resources:
|
|
91
|
+
api.add_resource(res["resource"], res["urls"], endpoint=res["endpoint"])
|
|
92
|
+
if app.config["ALARMS_ENDPOINTS"]:
|
|
93
|
+
for res in alarms_resources:
|
|
94
|
+
api.add_resource(res["resource"], res["urls"], endpoint=res["endpoint"])
|
|
95
|
+
|
|
96
|
+
# Resource for the log-in
|
|
97
|
+
auth_type = app.config["AUTH_TYPE"]
|
|
98
|
+
|
|
99
|
+
if auth_type == AUTH_DB:
|
|
100
|
+
signup_activated = int(app.config["SIGNUP_ACTIVATED"])
|
|
101
|
+
if signup_activated in [SIGNUP_WITH_AUTH, SIGNUP_WITH_NO_AUTH]:
|
|
102
|
+
api.add_resource(
|
|
103
|
+
SignUpEndpoint, CONDITIONAL_ENDPOINTS["signup"], endpoint="signup"
|
|
104
|
+
)
|
|
105
|
+
api.add_resource(
|
|
106
|
+
LoginEndpoint, CONDITIONAL_ENDPOINTS["login"], endpoint="login"
|
|
107
|
+
)
|
|
108
|
+
elif auth_type == AUTH_LDAP:
|
|
109
|
+
api.add_resource(
|
|
110
|
+
LoginEndpoint, CONDITIONAL_ENDPOINTS["login"], endpoint="login"
|
|
111
|
+
)
|
|
112
|
+
elif auth_type == AUTH_OID:
|
|
113
|
+
api.add_resource(
|
|
114
|
+
LoginOpenAuthEndpoint, CONDITIONAL_ENDPOINTS["login"], endpoint="login"
|
|
115
|
+
)
|
|
116
|
+
else:
|
|
117
|
+
raise ConfigurationError(
|
|
118
|
+
error="Invalid authentication type",
|
|
119
|
+
log_txt="Error while configuring authentication. The authentication type is not valid.",
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
app.register_blueprint(cornflow_bp)
|
|
123
|
+
|
|
124
|
+
# Alias de compatibilidad: mismas rutas sin prefijo (URLs legacy)
|
|
125
|
+
api_compat = Api(app)
|
|
126
|
+
for res in resources:
|
|
127
|
+
api_compat.add_resource(res["resource"], res["urls"], endpoint=res["endpoint"] + "_compat")
|
|
128
|
+
if app.config["ALARMS_ENDPOINTS"]:
|
|
129
|
+
for res in alarms_resources:
|
|
130
|
+
api_compat.add_resource(res["resource"], res["urls"], endpoint=res["endpoint"] + "_compat")
|
|
131
|
+
if auth_type == AUTH_DB:
|
|
132
|
+
_signup_activated = int(app.config["SIGNUP_ACTIVATED"])
|
|
133
|
+
if _signup_activated in [SIGNUP_WITH_AUTH, SIGNUP_WITH_NO_AUTH]:
|
|
134
|
+
api_compat.add_resource(SignUpEndpoint, CONDITIONAL_ENDPOINTS["signup"], endpoint="signup_compat")
|
|
135
|
+
api_compat.add_resource(LoginEndpoint, CONDITIONAL_ENDPOINTS["login"], endpoint="login_compat")
|
|
136
|
+
elif auth_type == AUTH_LDAP:
|
|
137
|
+
api_compat.add_resource(LoginEndpoint, CONDITIONAL_ENDPOINTS["login"], endpoint="login_compat")
|
|
138
|
+
elif auth_type == AUTH_OID:
|
|
139
|
+
api_compat.add_resource(LoginOpenAuthEndpoint, CONDITIONAL_ENDPOINTS["login"], endpoint="login_compat")
|
|
140
|
+
|
|
141
|
+
docs = FlaskApiSpec(app)
|
|
142
|
+
for res in resources:
|
|
143
|
+
docs.register(target=res["resource"], endpoint=res["endpoint"], blueprint="cornflow")
|
|
144
|
+
if app.config["ALARMS_ENDPOINTS"]:
|
|
145
|
+
for res in alarms_resources:
|
|
146
|
+
docs.register(target=res["resource"], endpoint=res["endpoint"], blueprint="cornflow")
|
|
147
|
+
|
|
148
|
+
initialize_errorhandlers(app)
|
|
149
|
+
init_compress(app)
|
|
150
|
+
|
|
151
|
+
app.cli.add_command(create_service_user)
|
|
152
|
+
app.cli.add_command(create_admin_user)
|
|
153
|
+
app.cli.add_command(register_roles)
|
|
154
|
+
app.cli.add_command(create_base_user)
|
|
155
|
+
app.cli.add_command(register_actions)
|
|
156
|
+
app.cli.add_command(register_views)
|
|
157
|
+
app.cli.add_command(register_base_assignations)
|
|
158
|
+
app.cli.add_command(access_init)
|
|
159
|
+
app.cli.add_command(register_deployed_dags)
|
|
160
|
+
app.cli.add_command(register_dag_permissions)
|
|
161
|
+
|
|
162
|
+
if int(app.config["EXTERNAL_APP"]) == 1:
|
|
163
|
+
# Legacy mode: DispatcherMiddleware mounts cornflow under APPLICATION_ROOT.
|
|
164
|
+
# The external app is responsible for combining both apps via wsgi.py.
|
|
165
|
+
if app.config["APPLICATION_ROOT"] != "/":
|
|
166
|
+
app.wsgi_app = DispatcherMiddleware(
|
|
167
|
+
NotFound(), {app.config["APPLICATION_ROOT"]: app.wsgi_app}
|
|
168
|
+
)
|
|
169
|
+
else:
|
|
170
|
+
# Plugin mode: autodiscover and mount plugins registered under cornflow.plugins.
|
|
171
|
+
from importlib.metadata import entry_points
|
|
172
|
+
for ep in entry_points(group="cornflow.plugins"):
|
|
173
|
+
ep.load()().init_app(app)
|
|
174
|
+
|
|
175
|
+
return app
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
@click.command("create_service_user")
|
|
179
|
+
@click.option("-u", "--username", required=True, type=str)
|
|
180
|
+
@click.option("-e", "--email", required=True, type=str)
|
|
181
|
+
@click.option("-p", "--password", required=True, type=str)
|
|
182
|
+
@click.option("-v", "--verbose", is_flag=True, default=False)
|
|
183
|
+
@with_appcontext
|
|
184
|
+
def create_service_user(username, email, password, verbose):
|
|
185
|
+
create_service_user_command(username, email, password, verbose)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
@click.command("create_admin_user")
|
|
189
|
+
@click.option("-u", "--username", required=True, type=str)
|
|
190
|
+
@click.option("-e", "--email", required=True, type=str)
|
|
191
|
+
@click.option("-p", "--password", required=True, type=str)
|
|
192
|
+
@click.option("-v", "--verbose", is_flag=True, default=False)
|
|
193
|
+
@with_appcontext
|
|
194
|
+
def create_admin_user(username, email, password, verbose):
|
|
195
|
+
create_admin_user_command(username, email, password, verbose)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
@click.command("create_base_user")
|
|
199
|
+
@click.option("-u", "--username", required=True, type=str)
|
|
200
|
+
@click.option("-e", "--email", required=True, type=str)
|
|
201
|
+
@click.option("-p", "--password", required=True, type=str)
|
|
202
|
+
@click.option("-v", "--verbose", is_flag=True, default=False)
|
|
203
|
+
@with_appcontext
|
|
204
|
+
def create_base_user(username, email, password, verbose):
|
|
205
|
+
create_planner_user_command(username, email, password, verbose)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
@click.command("register_roles")
|
|
209
|
+
@click.option("-v", "--verbose", is_flag=True, default=False)
|
|
210
|
+
@with_appcontext
|
|
211
|
+
def register_roles(verbose):
|
|
212
|
+
register_roles_command(verbose=verbose)
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
@click.command("register_actions")
|
|
216
|
+
@click.option("-v", "--verbose", is_flag=True, default=False)
|
|
217
|
+
@with_appcontext
|
|
218
|
+
def register_actions(verbose):
|
|
219
|
+
register_actions_command(verbose)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
@click.command("register_views")
|
|
223
|
+
@click.option("-v", "--verbose", is_flag=True, default=False)
|
|
224
|
+
@with_appcontext
|
|
225
|
+
def register_views(verbose):
|
|
226
|
+
register_views_command(verbose=verbose)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
@click.command("register_base_assignations")
|
|
230
|
+
@click.option("-v", "--verbose", is_flag=True, default=False)
|
|
231
|
+
@with_appcontext
|
|
232
|
+
def register_base_assignations(verbose):
|
|
233
|
+
register_base_permissions_command(verbose=verbose)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
@click.command("access_init")
|
|
237
|
+
@click.option("-v", "--verbose", is_flag=True, default=False)
|
|
238
|
+
@with_appcontext
|
|
239
|
+
def access_init(verbose):
|
|
240
|
+
access_init_command(verbose=verbose)
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
@click.command("register_deployed_dags")
|
|
244
|
+
@click.option("-r", "--url", type=str)
|
|
245
|
+
@click.option("-u", "--username", type=str)
|
|
246
|
+
@click.option("-p", "--password", type=str)
|
|
247
|
+
@click.option("-v", "--verbose", is_flag=True, default=False)
|
|
248
|
+
@with_appcontext
|
|
249
|
+
def register_deployed_dags(url, username, password, verbose):
|
|
250
|
+
register_deployed_dags_command(url, username, password, verbose)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
@click.command("register_dag_permissions")
|
|
254
|
+
@click.option("-o", "--open_deployment", default=0, type=int)
|
|
255
|
+
@click.option("-v", "--verbose", is_flag=True, default=False)
|
|
256
|
+
@with_appcontext
|
|
257
|
+
def register_dag_permissions(open_deployment, verbose):
|
|
258
|
+
register_dag_permissions_command(open_deployment=open_deployment, verbose=verbose)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
if __name__ == "__main__":
|
|
262
|
+
environment_name = os.getenv("FLASK_ENV", "development")
|
|
263
|
+
flask_app = create_app(environment_name)
|
|
264
|
+
flask_app.run()
|
|
@@ -2,8 +2,8 @@ import os.path
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
import click
|
|
5
|
+
import cornflow
|
|
5
6
|
from cornflow.shared import db
|
|
6
|
-
from cornflow.shared.const import MIGRATIONS_DEFAULT_PATH
|
|
7
7
|
from flask_migrate import Migrate, migrate, upgrade, downgrade, init
|
|
8
8
|
|
|
9
9
|
from .utils import get_app
|
|
@@ -22,10 +22,7 @@ def migrations():
|
|
|
22
22
|
def migrate_migrations():
|
|
23
23
|
app = get_app()
|
|
24
24
|
external = int(os.getenv("EXTERNAL_APP", 0))
|
|
25
|
-
|
|
26
|
-
path = MIGRATIONS_DEFAULT_PATH
|
|
27
|
-
else:
|
|
28
|
-
path = f"./{os.getenv('EXTERNAL_APP_MODULE', 'external_app')}/migrations"
|
|
25
|
+
path = _get_migrations_path()
|
|
29
26
|
|
|
30
27
|
with app.app_context():
|
|
31
28
|
Migrate(app=app, db=db, directory=path)
|
|
@@ -38,11 +35,7 @@ def migrate_migrations():
|
|
|
38
35
|
)
|
|
39
36
|
def upgrade_migrations(revision="head"):
|
|
40
37
|
app = get_app()
|
|
41
|
-
|
|
42
|
-
if external == 0:
|
|
43
|
-
path = MIGRATIONS_DEFAULT_PATH
|
|
44
|
-
else:
|
|
45
|
-
path = f"./{os.getenv('EXTERNAL_APP_MODULE', 'external_app')}/migrations"
|
|
38
|
+
path = _get_migrations_path()
|
|
46
39
|
|
|
47
40
|
with app.app_context():
|
|
48
41
|
Migrate(app=app, db=db, directory=path)
|
|
@@ -55,11 +48,7 @@ def upgrade_migrations(revision="head"):
|
|
|
55
48
|
)
|
|
56
49
|
def downgrade_migrations(revision="-1"):
|
|
57
50
|
app = get_app()
|
|
58
|
-
|
|
59
|
-
if external == 0:
|
|
60
|
-
path = MIGRATIONS_DEFAULT_PATH
|
|
61
|
-
else:
|
|
62
|
-
path = f"./{os.getenv('EXTERNAL_APP_MODULE', 'external_app')}/migrations"
|
|
51
|
+
path = _get_migrations_path()
|
|
63
52
|
|
|
64
53
|
with app.app_context():
|
|
65
54
|
Migrate(app=app, db=db, directory=path)
|
|
@@ -72,12 +61,16 @@ def downgrade_migrations(revision="-1"):
|
|
|
72
61
|
)
|
|
73
62
|
def init_migrations():
|
|
74
63
|
app = get_app()
|
|
75
|
-
|
|
76
|
-
if external == 0:
|
|
77
|
-
path = MIGRATIONS_DEFAULT_PATH
|
|
78
|
-
else:
|
|
79
|
-
path = f"./{os.getenv('EXTERNAL_APP_MODULE', 'external_app')}/migrations"
|
|
64
|
+
path = _get_migrations_path()
|
|
80
65
|
|
|
81
66
|
with app.app_context():
|
|
82
67
|
Migrate(app=app, db=db, directory=path)
|
|
83
68
|
init()
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def _get_migrations_path():
|
|
72
|
+
external = int(os.getenv("EXTERNAL_APP", 0))
|
|
73
|
+
if external == 0:
|
|
74
|
+
return os.path.join(os.path.dirname(cornflow.__file__), "migrations")
|
|
75
|
+
else:
|
|
76
|
+
return f"./{os.getenv('EXTERNAL_APP_MODULE', 'external_app')}/migrations"
|