cornflow 2.0.0a8__tar.gz → 2.0.0a10__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.0a8/cornflow.egg-info → cornflow-2.0.0a10}/PKG-INFO +1 -1
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/service.py +10 -4
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/commands/permissions.py +19 -10
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/config.py +1 -1
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/execution_databricks.py +75 -97
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/models/execution.py +0 -1
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/shared/const.py +2 -2
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/shared/databricks.py +54 -36
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/integration/test_cornflowclient.py +2 -1
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_executions.py +9 -9
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_health.py +2 -2
- {cornflow-2.0.0a8 → cornflow-2.0.0a10/cornflow.egg-info}/PKG-INFO +1 -1
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/setup.py +1 -1
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/MANIFEST.in +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/README.rst +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/airflow_config/__init__.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/airflow_config/airflow_local_settings.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/airflow_config/plugins/XCom/__init__.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/airflow_config/plugins/XCom/gce_xcom_backend.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/airflow_config/plugins/__init__.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/airflow_config/webserver_ldap.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/__init__.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/app.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/__init__.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/actions.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/arguments.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/config.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/migrations.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/permissions.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/roles.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/schemas.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/tools/__init__.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/tools/api_generator.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/tools/endpoint_tools.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/tools/models_tools.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/tools/schema_generator.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/tools/schemas_tools.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/tools/tools.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/users.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/utils.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/cli/views.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/commands/__init__.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/commands/access.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/commands/actions.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/commands/cleanup.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/commands/dag.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/commands/roles.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/commands/schemas.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/commands/users.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/commands/views.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/__init__.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/action.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/alarms.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/apiview.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/case.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/dag.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/data_check.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/example_data.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/execution.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/health.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/instance.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/licenses.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/login.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/main_alarms.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/meta_resource.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/permission.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/roles.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/schemas.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/signup.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/tables.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/token.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/user.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/endpoints/user_role.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/gunicorn.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/README +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/alembic.ini +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/env.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/script.py.mako +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/versions/00757b557b02_.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/versions/1af47a419bbd_.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/versions/4aac5e0c6e66_.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/versions/7c3ea5ab5501_.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/versions/991b98e24225_.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/versions/a472b5ad50b7_.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/versions/c2db9409cb5f_.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/versions/c8a6c762e818_.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/versions/ca449af8034c_.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/versions/d0e0700dcd8e_.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/versions/d1b5be1f0549_.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/versions/e1a50dae1ac9_.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/versions/e937a5234ce4_.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/versions/ebdd955fcc5e_.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/migrations/versions/f3bee20314a2_.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/models/__init__.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/models/action.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/models/alarms.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/models/base_data_model.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/models/case.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/models/dag.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/models/dag_permissions.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/models/instance.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/models/main_alarms.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/models/meta_models.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/models/permissions.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/models/role.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/models/user.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/models/user_role.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/models/view.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/orchestrator_constants.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/__init__.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/action.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/alarms.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/case.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/common.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/dag.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/example_data.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/execution.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/health.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/instance.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/main_alarms.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/model_json.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/patch.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/permissions.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/query.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/role.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/schemas.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/solution_log.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/tables.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/user.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/user_role.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/schemas/view.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/shared/__init__.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/shared/authentication/__init__.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/shared/authentication/auth.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/shared/authentication/decorators.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/shared/authentication/ldap.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/shared/compress.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/shared/email.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/shared/exceptions.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/shared/licenses.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/shared/log_config.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/shared/query_tools.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/shared/utils.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/shared/utils_tables.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/shared/validators.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/__init__.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/const.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/custom_liveServer.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/custom_test_case.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/integration/__init__.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/integration/test_commands.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/ldap/__init__.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/ldap/test_ldap_authentication.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/__init__.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_actions.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_alarms.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_apiview.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_application.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_cases.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_cli.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_commands.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_dags.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_data_checks.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_example_data.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_generate_from_schema.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_instances.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_instances_file.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_licenses.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_log_in.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_main_alarms.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_permissions.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_roles.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_schema_from_models.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_schemas.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_sign_up.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_tables.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_token.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/test_users.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow/tests/unit/tools.py +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow.egg-info/SOURCES.txt +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow.egg-info/dependency_links.txt +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow.egg-info/entry_points.txt +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow.egg-info/requires.txt +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/cornflow.egg-info/top_level.txt +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/requirements.txt +0 -0
- {cornflow-2.0.0a8 → cornflow-2.0.0a10}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: cornflow
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.0a10
|
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
|
@@ -16,7 +16,13 @@ from cornflow.commands import (
|
|
16
16
|
update_schemas_command,
|
17
17
|
update_dag_registry_command,
|
18
18
|
)
|
19
|
-
from cornflow.shared.const import
|
19
|
+
from cornflow.shared.const import (
|
20
|
+
AUTH_DB,
|
21
|
+
ADMIN_ROLE,
|
22
|
+
DATABRICKS_BACKEND,
|
23
|
+
SERVICE_ROLE,
|
24
|
+
AIRFLOW_BACKEND,
|
25
|
+
)
|
20
26
|
from cornflow.shared import db
|
21
27
|
from cryptography.fernet import Fernet
|
22
28
|
from flask_migrate import Migrate, upgrade
|
@@ -106,7 +112,7 @@ def init_cornflow_service():
|
|
106
112
|
|
107
113
|
# Check LDAP parameters for active directory and show message
|
108
114
|
if os.getenv("AUTH_TYPE") == 2:
|
109
|
-
|
115
|
+
click.echo(
|
110
116
|
"WARNING: Cornflow will be deployed with LDAP Authorization. Please review your ldap auth configuration."
|
111
117
|
)
|
112
118
|
|
@@ -129,10 +135,10 @@ def init_cornflow_service():
|
|
129
135
|
f"cat > /etc/logrotate.d/cornflow <<EOF\n {conf} \nEOF", shell=True
|
130
136
|
)
|
131
137
|
out_logrotate = logrotate.stdout
|
132
|
-
|
138
|
+
click.echo(out_logrotate)
|
133
139
|
|
134
140
|
except error:
|
135
|
-
|
141
|
+
click.echo(error)
|
136
142
|
|
137
143
|
external_application = int(os.getenv("EXTERNAL_APP", 0))
|
138
144
|
if external_application == 0:
|
@@ -14,13 +14,22 @@ from sqlalchemy.exc import DBAPIError, IntegrityError
|
|
14
14
|
def register_base_permissions_command(external_app: str = None, verbose: bool = False):
|
15
15
|
if external_app is None:
|
16
16
|
from cornflow.endpoints import resources, alarms_resources
|
17
|
+
|
17
18
|
resources_to_register = resources
|
19
|
+
extra_permissions = EXTRA_PERMISSION_ASSIGNATION
|
18
20
|
if current_app.config["ALARMS_ENDPOINTS"]:
|
19
21
|
resources_to_register = resources + alarms_resources
|
20
22
|
elif external_app is not None:
|
21
23
|
sys.path.append("./")
|
22
24
|
external_module = import_module(external_app)
|
23
25
|
resources_to_register = external_module.endpoints.resources
|
26
|
+
try:
|
27
|
+
extra_permissions = (
|
28
|
+
EXTRA_PERMISSION_ASSIGNATION
|
29
|
+
+ external_module.shared.const.EXTRA_PERMISSION_ASSIGNATION
|
30
|
+
)
|
31
|
+
except AttributeError:
|
32
|
+
extra_permissions = EXTRA_PERMISSION_ASSIGNATION
|
24
33
|
else:
|
25
34
|
resources_to_register = []
|
26
35
|
exit()
|
@@ -52,7 +61,7 @@ def register_base_permissions_command(external_app: str = None, verbose: bool =
|
|
52
61
|
"api_view_id": views_in_db[endpoint],
|
53
62
|
}
|
54
63
|
)
|
55
|
-
for role, action, endpoint in
|
64
|
+
for role, action, endpoint in extra_permissions
|
56
65
|
]
|
57
66
|
|
58
67
|
permissions_in_app_keys = [
|
@@ -124,7 +133,7 @@ def register_base_permissions_command(external_app: str = None, verbose: bool =
|
|
124
133
|
def register_dag_permissions_command(
|
125
134
|
open_deployment: int = None, verbose: bool = False
|
126
135
|
):
|
127
|
-
|
136
|
+
|
128
137
|
from flask import current_app
|
129
138
|
from sqlalchemy.exc import DBAPIError, IntegrityError
|
130
139
|
|
@@ -138,7 +147,7 @@ def register_dag_permissions_command(
|
|
138
147
|
(permission.dag_id, permission.user_id)
|
139
148
|
for permission in PermissionsDAG.get_all_objects()
|
140
149
|
]
|
141
|
-
|
150
|
+
|
142
151
|
try:
|
143
152
|
db.session.commit()
|
144
153
|
except DBAPIError as e:
|
@@ -149,14 +158,13 @@ def register_dag_permissions_command(
|
|
149
158
|
all_dags = DeployedOrch.get_all_objects().all()
|
150
159
|
|
151
160
|
if open_deployment == 1:
|
152
|
-
|
161
|
+
|
153
162
|
permissions = [
|
154
163
|
PermissionsDAG({"dag_id": dag.id, "user_id": user.id})
|
155
164
|
for user in all_users
|
156
165
|
for dag in all_dags
|
157
166
|
if (dag.id, user.id) not in existing_permissions
|
158
167
|
]
|
159
|
-
click.echo(f"Checkpoint 4")
|
160
168
|
|
161
169
|
else:
|
162
170
|
permissions = [
|
@@ -165,10 +173,10 @@ def register_dag_permissions_command(
|
|
165
173
|
for dag in all_dags
|
166
174
|
if (dag.id, user.id) not in existing_permissions and user.is_service_user()
|
167
175
|
]
|
168
|
-
|
176
|
+
|
169
177
|
if len(permissions) > 1:
|
170
178
|
db.session.bulk_save_objects(permissions)
|
171
|
-
|
179
|
+
|
172
180
|
try:
|
173
181
|
db.session.commit()
|
174
182
|
except IntegrityError as e:
|
@@ -177,7 +185,7 @@ def register_dag_permissions_command(
|
|
177
185
|
except DBAPIError as e:
|
178
186
|
db.session.rollback()
|
179
187
|
current_app.logger.error(f"Unknown error on dag permissions register: {e}")
|
180
|
-
|
188
|
+
|
181
189
|
if "postgres" in str(db.session.get_bind()):
|
182
190
|
db.engine.execute(
|
183
191
|
"SELECT setval(pg_get_serial_sequence('permission_dag', 'id'), MAX(id)) FROM permission_dag;"
|
@@ -190,11 +198,12 @@ def register_dag_permissions_command(
|
|
190
198
|
current_app.logger.error(
|
191
199
|
f"Unknown error on dag permissions sequence updating: {e}"
|
192
200
|
)
|
193
|
-
|
201
|
+
|
194
202
|
if verbose:
|
203
|
+
click.echo(f"DAG permissions registered")
|
195
204
|
if len(permissions) > 1:
|
196
205
|
current_app.logger.info(f"DAG permissions registered: {permissions}")
|
197
206
|
else:
|
198
207
|
current_app.logger.info("No new DAG permissions")
|
199
|
-
|
208
|
+
|
200
209
|
pass
|
@@ -41,7 +41,7 @@ class DefaultConfig(object):
|
|
41
41
|
DATABRICKS_EP_CLUSTERS = os.getenv("DATABRICKS_EP_CLUSTERS")
|
42
42
|
DATABRICKS_CLIENT_ID = os.getenv("DATABRICKS_CLIENT_ID")
|
43
43
|
|
44
|
-
# If service user is
|
44
|
+
# If service user is allowed to log with username and password
|
45
45
|
SERVICE_USER_ALLOW_PASSWORD_LOGIN = int(
|
46
46
|
os.getenv("SERVICE_USER_ALLOW_PASSWORD_LOGIN", 1)
|
47
47
|
)
|
@@ -5,29 +5,17 @@ These endpoints hve different access url, but manage the same data entities
|
|
5
5
|
"""
|
6
6
|
|
7
7
|
# Import from libraries
|
8
|
-
import datetime
|
9
|
-
import logging
|
10
|
-
import time
|
11
|
-
from databricks.sdk import WorkspaceClient
|
12
|
-
import databricks.sdk.service.jobs as j
|
13
|
-
from cornflow.constants import *
|
14
|
-
from cornflow.shared.const import (
|
15
|
-
AIRFLOW_BACKEND,
|
16
|
-
DATABRICKS_BACKEND,
|
17
|
-
STATUS_HEALTHY,
|
18
|
-
STATUS_UNHEALTHY,
|
19
|
-
)
|
20
|
-
# TODO AGA: Modificar import para sacarlo de cornflow_client
|
21
|
-
from cornflow.shared.databricks import Databricks
|
22
|
-
from cornflow_client.constants import INSTANCE_SCHEMA, CONFIG_SCHEMA, SOLUTION_SCHEMA
|
23
8
|
from cornflow_client.airflow.api import Airflow
|
24
|
-
|
9
|
+
from cornflow_client.constants import INSTANCE_SCHEMA, CONFIG_SCHEMA, SOLUTION_SCHEMA
|
10
|
+
|
11
|
+
# TODO AGA: Porqué el import no funcina correctamente
|
25
12
|
from flask import request, current_app
|
26
13
|
from flask_apispec import marshal_with, use_kwargs, doc
|
27
14
|
|
28
15
|
# Import from internal modules
|
29
16
|
from cornflow.endpoints.meta_resource import BaseMetaResource
|
30
17
|
from cornflow.models import InstanceModel, DeployedOrch, ExecutionModel
|
18
|
+
from cornflow.orchestrator_constants import config_orchestrator
|
31
19
|
from cornflow.schemas.execution import (
|
32
20
|
ExecutionDetailsEndpointResponse,
|
33
21
|
ExecutionDetailsEndpointWithIndicatorsResponse,
|
@@ -39,10 +27,14 @@ from cornflow.schemas.execution import (
|
|
39
27
|
ExecutionEditRequest,
|
40
28
|
QueryFiltersExecution,
|
41
29
|
ReLaunchExecutionRequest,
|
42
|
-
ExecutionDetailsWithIndicatorsAndLogResponse
|
30
|
+
ExecutionDetailsWithIndicatorsAndLogResponse,
|
43
31
|
)
|
44
32
|
from cornflow.shared.authentication import Auth, authenticate
|
45
33
|
from cornflow.shared.compress import compressed
|
34
|
+
from cornflow.shared.const import (
|
35
|
+
AIRFLOW_BACKEND,
|
36
|
+
DATABRICKS_BACKEND,
|
37
|
+
)
|
46
38
|
from cornflow.shared.const import (
|
47
39
|
EXEC_STATE_RUNNING,
|
48
40
|
EXEC_STATE_ERROR,
|
@@ -52,16 +44,23 @@ from cornflow.shared.const import (
|
|
52
44
|
EXECUTION_STATE_MESSAGE_DICT,
|
53
45
|
AIRFLOW_TO_STATE_MAP,
|
54
46
|
DATABRICKS_TO_STATE_MAP,
|
55
|
-
DATABRICKS_FINISH_TO_STATE_MAP,
|
56
47
|
EXEC_STATE_STOPPED,
|
57
48
|
EXEC_STATE_QUEUED,
|
58
49
|
)
|
59
|
-
|
50
|
+
|
51
|
+
# TODO AGA: Modificar import para sacarlo de cornflow_client
|
52
|
+
from cornflow.shared.databricks import Databricks
|
53
|
+
from cornflow.shared.exceptions import (
|
54
|
+
AirflowError,
|
55
|
+
DatabricksError,
|
56
|
+
ObjectDoesNotExist,
|
57
|
+
InvalidData,
|
58
|
+
EndpointNotImplemented,
|
59
|
+
)
|
60
60
|
from cornflow.shared.validators import (
|
61
61
|
json_schema_validate_as_string,
|
62
62
|
json_schema_extend_and_validate_as_string,
|
63
63
|
)
|
64
|
-
from cornflow.orchestrator_constants import config_orchestrator
|
65
64
|
|
66
65
|
|
67
66
|
class ExecutionEndpoint(BaseMetaResource):
|
@@ -159,13 +158,13 @@ class ExecutionEndpoint(BaseMetaResource):
|
|
159
158
|
# TODO: should the schema field be cross validated with the instance schema field?
|
160
159
|
|
161
160
|
ORQ_TYPE = current_app.config["CORNFLOW_BACKEND"]
|
162
|
-
if ORQ_TYPE==AIRFLOW_BACKEND:
|
163
|
-
orq_const= config_orchestrator["airflow"]
|
164
|
-
ORQ_ERROR=AirflowError
|
165
|
-
elif ORQ_TYPE==DATABRICKS_BACKEND:
|
166
|
-
orq_const= config_orchestrator["databricks"]
|
161
|
+
if ORQ_TYPE == AIRFLOW_BACKEND:
|
162
|
+
orq_const = config_orchestrator["airflow"]
|
163
|
+
ORQ_ERROR = AirflowError
|
164
|
+
elif ORQ_TYPE == DATABRICKS_BACKEND:
|
165
|
+
orq_const = config_orchestrator["databricks"]
|
167
166
|
# TODO AGA: Revisar si esto funcionaría correctamente
|
168
|
-
ORQ_ERROR=DatabricksError
|
167
|
+
ORQ_ERROR = DatabricksError
|
169
168
|
|
170
169
|
if "schema" not in kwargs:
|
171
170
|
kwargs["schema"] = orq_const["def_schema"]
|
@@ -189,13 +188,15 @@ class ExecutionEndpoint(BaseMetaResource):
|
|
189
188
|
# We try to create an orch client
|
190
189
|
# Note schema is a string with the name of the job/dag
|
191
190
|
schema = execution.schema
|
192
|
-
# If we are dealing with DataBricks, the schema will
|
191
|
+
# If we are dealing with DataBricks, the schema will
|
193
192
|
# be the job id
|
194
|
-
orch_client, schema_info, execution= get_orch_client(
|
193
|
+
orch_client, schema_info, execution = get_orch_client(
|
194
|
+
schema, ORQ_TYPE, execution
|
195
|
+
)
|
195
196
|
# endregion
|
196
197
|
|
197
198
|
# region VALIDACIONES
|
198
|
-
# We check if the job/dag exists
|
199
|
+
# We check if the job/dag exists
|
199
200
|
orch_client.get_orch_info(schema)
|
200
201
|
# Validate config before running the dag
|
201
202
|
config_schema = DeployedOrch.get_one_schema(config, schema, CONFIG_SCHEMA)
|
@@ -249,8 +250,8 @@ class ExecutionEndpoint(BaseMetaResource):
|
|
249
250
|
execution.update_log_txt(f"{solution_errors}")
|
250
251
|
raise InvalidData(payload=dict(jsonschema_errors=solution_errors))
|
251
252
|
# endregion
|
252
|
-
|
253
|
-
if ORQ_TYPE==AIRFLOW_BACKEND:
|
253
|
+
|
254
|
+
if ORQ_TYPE == AIRFLOW_BACKEND:
|
254
255
|
info = schema_info.json()
|
255
256
|
if info["is_paused"]:
|
256
257
|
err = "The dag exists but it is paused in airflow"
|
@@ -268,7 +269,7 @@ class ExecutionEndpoint(BaseMetaResource):
|
|
268
269
|
# TODO AGA: revisar si hay que hacer alguna verificación a los JOBS
|
269
270
|
|
270
271
|
try:
|
271
|
-
# TODO AGA: Hay que genestionar la posible eliminación de execution.id como
|
272
|
+
# TODO AGA: Hay que genestionar la posible eliminación de execution.id como
|
272
273
|
# parámetro, ya que no se puede seleccionar el id en databricks
|
273
274
|
# revisar las consecuencias que puede tener
|
274
275
|
response = orch_client.run_workflow(execution.id, orch_name=schema)
|
@@ -319,13 +320,13 @@ class ExecutionRelaunchEndpoint(BaseMetaResource):
|
|
319
320
|
:rtype: Tuple(dict, integer)
|
320
321
|
"""
|
321
322
|
ORQ_TYPE = current_app.config["CORNFLOW_BACKEND"]
|
322
|
-
if ORQ_TYPE==AIRFLOW_BACKEND:
|
323
|
-
orq_const= config_orchestrator["airflow"]
|
324
|
-
ORQ_ERROR=AirflowError
|
325
|
-
elif ORQ_TYPE==DATABRICKS_BACKEND:
|
326
|
-
orq_const= config_orchestrator["databricks"]
|
323
|
+
if ORQ_TYPE == AIRFLOW_BACKEND:
|
324
|
+
orq_const = config_orchestrator["airflow"]
|
325
|
+
ORQ_ERROR = AirflowError
|
326
|
+
elif ORQ_TYPE == DATABRICKS_BACKEND:
|
327
|
+
orq_const = config_orchestrator["databricks"]
|
327
328
|
# TODO AGA: Revisar si esto funcionaría correctamente
|
328
|
-
ORQ_ERROR=DatabricksError
|
329
|
+
ORQ_ERROR = DatabricksError
|
329
330
|
|
330
331
|
config = current_app.config
|
331
332
|
if "schema" not in kwargs:
|
@@ -370,10 +371,12 @@ class ExecutionRelaunchEndpoint(BaseMetaResource):
|
|
370
371
|
log_txt=f"Error while user {self.get_user()} tries to relaunch execution {idx}. "
|
371
372
|
f"Configuration data does not match the jsonschema.",
|
372
373
|
)
|
373
|
-
orch_client, schema_info, execution = get_orch_client(
|
374
|
-
|
374
|
+
orch_client, schema_info, execution = get_orch_client(
|
375
|
+
kwargs["schema"], ORQ_TYPE, execution
|
376
|
+
)
|
377
|
+
|
375
378
|
if not orch_client.is_alive():
|
376
|
-
err = orq_const["name"]+" is not accessible"
|
379
|
+
err = orq_const["name"] + " is not accessible"
|
377
380
|
current_app.logger.error(err)
|
378
381
|
execution.update_state(EXEC_STATE_ERROR_START)
|
379
382
|
raise ORQ_ERROR(
|
@@ -385,13 +388,13 @@ class ExecutionRelaunchEndpoint(BaseMetaResource):
|
|
385
388
|
log_txt=f"Error while user {self.get_user()} tries to relaunch execution {idx}. "
|
386
389
|
+ err,
|
387
390
|
)
|
388
|
-
|
391
|
+
|
389
392
|
# ask airflow if dag_name exists
|
390
393
|
schema = execution.schema
|
391
394
|
schema_info = orch_client.get_orch_info(schema)
|
392
395
|
|
393
396
|
info = schema_info.json()
|
394
|
-
if ORQ_TYPE==AIRFLOW_BACKEND:
|
397
|
+
if ORQ_TYPE == AIRFLOW_BACKEND:
|
395
398
|
if info["is_paused"]:
|
396
399
|
err = "The dag exists but it is paused in airflow"
|
397
400
|
current_app.logger.error(err)
|
@@ -409,7 +412,7 @@ class ExecutionRelaunchEndpoint(BaseMetaResource):
|
|
409
412
|
try:
|
410
413
|
response = orch_client.run_workflow(execution.id, orch_name=schema)
|
411
414
|
except ORQ_ERROR as err:
|
412
|
-
error = orq_const["name"]+" responded with an error: {}".format(err)
|
415
|
+
error = orq_const["name"] + " responded with an error: {}".format(err)
|
413
416
|
current_app.logger.error(error)
|
414
417
|
execution.update_state(EXEC_STATE_ERROR)
|
415
418
|
raise ORQ_ERROR(
|
@@ -437,6 +440,7 @@ class ExecutionDetailsEndpointBase(BaseMetaResource):
|
|
437
440
|
"""
|
438
441
|
Endpoint used to get the information of a certain execution. But not the data!
|
439
442
|
"""
|
443
|
+
|
440
444
|
# TODO AGA DUDA: Se usa? Qué debería devolver?
|
441
445
|
def __init__(self):
|
442
446
|
super().__init__()
|
@@ -565,13 +569,13 @@ class ExecutionStatusEndpoint(BaseMetaResource):
|
|
565
569
|
:rtype: Tuple(dict, integer)
|
566
570
|
"""
|
567
571
|
ORQ_TYPE = current_app.config["CORNFLOW_BACKEND"]
|
568
|
-
if ORQ_TYPE==AIRFLOW_BACKEND:
|
569
|
-
orq_const= config_orchestrator["airflow"]
|
570
|
-
ORQ_ERROR=AirflowError
|
571
|
-
elif ORQ_TYPE==DATABRICKS_BACKEND:
|
572
|
-
orq_const= config_orchestrator["databricks"]
|
572
|
+
if ORQ_TYPE == AIRFLOW_BACKEND:
|
573
|
+
orq_const = config_orchestrator["airflow"]
|
574
|
+
ORQ_ERROR = AirflowError
|
575
|
+
elif ORQ_TYPE == DATABRICKS_BACKEND:
|
576
|
+
orq_const = config_orchestrator["databricks"]
|
573
577
|
# TODO AGA: Revisar si esto funcionaría correctamente
|
574
|
-
ORQ_ERROR=DatabricksError
|
578
|
+
ORQ_ERROR = DatabricksError
|
575
579
|
execution = self.data_model.get_one_object(user=self.get_user(), idx=idx)
|
576
580
|
if execution is None:
|
577
581
|
raise ObjectDoesNotExist(
|
@@ -594,6 +598,7 @@ class ExecutionStatusEndpoint(BaseMetaResource):
|
|
594
598
|
raise ORQ_ERROR(
|
595
599
|
error=error, payload=dict(message=message, state=state), log_txt=log_txt
|
596
600
|
)
|
601
|
+
|
597
602
|
print("The execution is ", execution)
|
598
603
|
print("The execution user is ", self.get_user())
|
599
604
|
print("The execution id is ", idx)
|
@@ -611,10 +616,12 @@ class ExecutionStatusEndpoint(BaseMetaResource):
|
|
611
616
|
)
|
612
617
|
schema = execution.schema
|
613
618
|
# TODO AGA: Revisar si merece la pena hacer una funcion que solo
|
614
|
-
orch_client, schema_info, execution= get_orch_client(
|
619
|
+
orch_client, schema_info, execution = get_orch_client(
|
620
|
+
schema, ORQ_TYPE, execution
|
621
|
+
)
|
615
622
|
|
616
623
|
if not orch_client.is_alive():
|
617
|
-
err = orq_const["name"] +" is not accessible"
|
624
|
+
err = orq_const["name"] + " is not accessible"
|
618
625
|
_raise_af_error(
|
619
626
|
execution,
|
620
627
|
err,
|
@@ -624,11 +631,9 @@ class ExecutionStatusEndpoint(BaseMetaResource):
|
|
624
631
|
|
625
632
|
try:
|
626
633
|
# TODO: get the dag_name from somewhere!
|
627
|
-
state = orch_client.get_run_status(
|
628
|
-
dag_run_id
|
629
|
-
)
|
634
|
+
state = orch_client.get_run_status(schema, dag_run_id)
|
630
635
|
except ORQ_ERROR as err:
|
631
|
-
error = orq_const["name"] +f" responded with an error: {err}"
|
636
|
+
error = orq_const["name"] + f" responded with an error: {err}"
|
632
637
|
_raise_af_error(
|
633
638
|
execution,
|
634
639
|
error,
|
@@ -723,38 +728,9 @@ class ExecutionLogEndpoint(ExecutionDetailsEndpointBase):
|
|
723
728
|
current_app.logger.info(f"User {self.get_user()} gets log of execution {idx}")
|
724
729
|
return self.get_detail(user=self.get_user(), idx=idx)
|
725
730
|
|
731
|
+
|
726
732
|
# region aux_functions
|
727
|
-
|
728
|
-
# trigger one-time-run job and get waiter object
|
729
|
-
waiter = w.jobs.submit(run_name=f'cornflow-job-{time.time()}', tasks=[
|
730
|
-
j.SubmitTask(
|
731
|
-
task_key='nippon_production_scheduling',
|
732
|
-
existing_cluster_id=cid,
|
733
|
-
libraries=[],
|
734
|
-
spark_python_task=j.SparkPythonTask(
|
735
|
-
python_file='/Workspace/Repos/nippon/nippon_production_scheduling/main.py',
|
736
|
-
),
|
737
|
-
timeout_seconds=0,
|
738
|
-
)
|
739
|
-
])
|
740
|
-
logging.info(f'starting to poll: {waiter.run_id}')
|
741
|
-
# callback, that receives a polled entity between state updates
|
742
|
-
# If you want to perform polling in a separate thread, process, or service,
|
743
|
-
# you can use w.jobs.wait_get_run_job_terminated_or_skipped(
|
744
|
-
# run_id=waiter.run_id,
|
745
|
-
# timeout=datetime.timedelta(minutes=15),
|
746
|
-
# callback=print_status) to achieve the same results.
|
747
|
-
#
|
748
|
-
# Waiter interface allows for `w.jobs.submit(..).result()` simplicity in
|
749
|
-
# the scenarios, where you need to block the calling thread for the job to finish.
|
750
|
-
run = waiter.result(timeout=datetime.timedelta(minutes=15),
|
751
|
-
callback=print_status)
|
752
|
-
logging.info(f'job finished: {run.run_page_url}')
|
753
|
-
return waiter.run_id
|
754
|
-
|
755
|
-
def print_status(run: j.Run):
|
756
|
-
statuses = [f'{t.task_key}: {t.state.life_cycle_state}' for t in run.tasks]
|
757
|
-
logging.info(f'workflow intermediate status: {", ".join(statuses)}')
|
733
|
+
|
758
734
|
|
759
735
|
def get_orch_client(schema, orq_type, execution):
|
760
736
|
"""
|
@@ -763,10 +739,10 @@ def get_orch_client(schema, orq_type, execution):
|
|
763
739
|
if orq_type == AIRFLOW_BACKEND:
|
764
740
|
return get_airflow(schema, execution=execution)
|
765
741
|
elif orq_type == DATABRICKS_BACKEND:
|
766
|
-
return get_databricks(schema,execution=execution)
|
742
|
+
return get_databricks(schema, execution=execution)
|
767
743
|
else:
|
768
744
|
raise EndpointNotImplemented()
|
769
|
-
|
745
|
+
|
770
746
|
|
771
747
|
def get_airflow(schema, execution):
|
772
748
|
"""
|
@@ -784,12 +760,12 @@ def get_airflow(schema, execution):
|
|
784
760
|
message=EXECUTION_STATE_MESSAGE_DICT[EXEC_STATE_ERROR_START],
|
785
761
|
state=EXEC_STATE_ERROR_START,
|
786
762
|
),
|
787
|
-
log_txt=f"Error while user {
|
763
|
+
log_txt=f"Error while user {execution.user_id} tries to create an execution "
|
788
764
|
+ err,
|
789
765
|
)
|
790
|
-
# TODO AGA: revisar si tiene sentido que se devuelva execution o si
|
766
|
+
# TODO AGA: revisar si tiene sentido que se devuelva execution o si
|
791
767
|
# es un puntero
|
792
|
-
return af_client,schema_info, execution
|
768
|
+
return af_client, schema_info, execution
|
793
769
|
|
794
770
|
|
795
771
|
def get_databricks(schema, execution):
|
@@ -808,21 +784,23 @@ def get_databricks(schema, execution):
|
|
808
784
|
message=EXECUTION_STATE_MESSAGE_DICT[EXEC_STATE_ERROR_START],
|
809
785
|
state=EXEC_STATE_ERROR_START,
|
810
786
|
),
|
811
|
-
log_txt=f"Error while user {
|
787
|
+
log_txt=f"Error while user {execution.user_id} tries to create an execution "
|
812
788
|
+ err,
|
813
789
|
)
|
814
790
|
return db_client, schema_info, execution
|
815
791
|
# endregion
|
816
792
|
|
817
|
-
|
793
|
+
|
794
|
+
def map_run_state(state, ORQ_TYPE):
|
818
795
|
"""
|
819
796
|
Maps the state of the execution in the orchestrator to the state of the execution in cornflow
|
820
797
|
"""
|
821
|
-
if ORQ_TYPE==AIRFLOW_BACKEND:
|
798
|
+
if ORQ_TYPE == AIRFLOW_BACKEND:
|
799
|
+
state = state.json()["state"]
|
822
800
|
return AIRFLOW_TO_STATE_MAP.get(state, EXEC_STATE_UNKNOWN)
|
823
|
-
elif ORQ_TYPE==DATABRICKS_BACKEND:
|
801
|
+
elif ORQ_TYPE == DATABRICKS_BACKEND:
|
824
802
|
print("The state is ", state)
|
825
|
-
preliminar_state = DATABRICKS_TO_STATE_MAP.get(state,EXEC_STATE_UNKNOWN)
|
803
|
+
preliminar_state = DATABRICKS_TO_STATE_MAP.get(state, EXEC_STATE_UNKNOWN)
|
826
804
|
# print("The preliminar state is ", preliminar_state)
|
827
805
|
# if preliminar_state =="TERMINATED":
|
828
806
|
# # TODO AGA DUDA: Revisar si es correcto el error predeterminado
|
@@ -117,7 +117,6 @@ class ExecutionModel(BaseDataModel):
|
|
117
117
|
:param str message: Message for the error
|
118
118
|
:return: nothing
|
119
119
|
"""
|
120
|
-
print("Updating state to ", code)
|
121
120
|
self.state = code
|
122
121
|
if message is None:
|
123
122
|
self.state_message = EXECUTION_STATE_MESSAGE_DICT[code]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
"""
|
2
|
-
In this
|
2
|
+
In this file we import the values for different constants on cornflow server
|
3
3
|
"""
|
4
4
|
|
5
5
|
# CORNFLOW BACKEND
|
@@ -62,7 +62,7 @@ DATABRICKS_TO_STATE_MAP = dict(
|
|
62
62
|
DATABRICKS_FINISH_TO_STATE_MAP = dict(
|
63
63
|
SUCCESS=EXEC_STATE_CORRECT,
|
64
64
|
USER_CANCELED=EXEC_STATE_STOPPED,
|
65
|
-
|
65
|
+
)
|
66
66
|
|
67
67
|
DATABRICKS_TERMINATE_STATE = "TERMINATED"
|
68
68
|
# These codes and names are inherited from flask app builder in order to have the same names and values
|