cornflow 1.2.4__tar.gz → 1.3.0rc1__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-1.2.4/cornflow.egg-info → cornflow-1.3.0rc1}/PKG-INFO +2 -2
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/service.py +91 -42
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/commands/dag.py +7 -7
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/commands/permissions.py +9 -5
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/config.py +23 -3
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/case.py +37 -21
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/dag.py +5 -5
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/data_check.py +8 -7
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/example_data.py +4 -2
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/execution.py +215 -127
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/health.py +30 -11
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/instance.py +3 -3
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/login.py +9 -2
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/schemas.py +3 -3
- cornflow-1.3.0rc1/cornflow/migrations/versions/999b98e24225.py +34 -0
- cornflow-1.3.0rc1/cornflow/migrations/versions/cef1df240b27_.py +34 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/models/__init__.py +2 -1
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/models/dag.py +8 -9
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/models/dag_permissions.py +3 -3
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/models/execution.py +2 -3
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/models/permissions.py +1 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/models/user.py +1 -1
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/execution.py +14 -1
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/health.py +1 -1
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/shared/authentication/auth.py +14 -1
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/shared/authentication/decorators.py +0 -1
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/shared/const.py +44 -1
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/shared/exceptions.py +2 -1
- cornflow-1.3.0rc1/cornflow/tests/base_test_execution.py +798 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/const.py +1 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/integration/test_commands.py +2 -2
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/integration/test_cornflowclient.py +2 -1
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_cases.py +1 -1
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_commands.py +5 -5
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_dags.py +3 -3
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_example_data.py +1 -1
- cornflow-1.3.0rc1/cornflow/tests/unit/test_executions.py +124 -0
- cornflow-1.3.0rc1/cornflow/tests/unit/test_health.py +118 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_main_alarms.py +1 -1
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_roles.py +2 -1
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_schema_from_models.py +1 -1
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_schemas.py +1 -1
- cornflow-1.3.0rc1/cornflow/tests/unit/tools.py +96 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1/cornflow.egg-info}/PKG-INFO +2 -2
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow.egg-info/SOURCES.txt +3 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow.egg-info/requires.txt +1 -1
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/requirements.txt +1 -1
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/setup.py +1 -1
- cornflow-1.2.4/cornflow/tests/unit/test_executions.py +0 -544
- cornflow-1.2.4/cornflow/tests/unit/test_health.py +0 -37
- cornflow-1.2.4/cornflow/tests/unit/tools.py +0 -13
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/MANIFEST.in +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/README.rst +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/airflow_config/__init__.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/airflow_config/airflow_local_settings.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/airflow_config/plugins/XCom/__init__.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/airflow_config/plugins/XCom/gce_xcom_backend.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/airflow_config/plugins/__init__.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/airflow_config/webserver_ldap.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/__init__.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/app.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/__init__.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/actions.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/arguments.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/config.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/migrations.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/permissions.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/roles.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/schemas.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/tools/__init__.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/tools/api_generator.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/tools/endpoint_tools.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/tools/models_tools.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/tools/schema_generator.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/tools/schemas_tools.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/tools/tools.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/users.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/utils.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/cli/views.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/commands/__init__.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/commands/access.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/commands/actions.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/commands/auxiliar.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/commands/cleanup.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/commands/roles.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/commands/schemas.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/commands/users.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/commands/views.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/__init__.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/action.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/alarms.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/apiview.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/licenses.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/main_alarms.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/meta_resource.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/permission.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/roles.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/signup.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/tables.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/token.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/user.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/endpoints/user_role.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/gunicorn.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/README +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/alembic.ini +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/env.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/script.py.mako +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/versions/00757b557b02_.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/versions/1af47a419bbd_.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/versions/4aac5e0c6e66_.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/versions/7c3ea5ab5501_.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/versions/991b98e24225_.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/versions/a472b5ad50b7_.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/versions/c2db9409cb5f_.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/versions/c8a6c762e818_.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/versions/ca449af8034c_.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/versions/d0e0700dcd8e_.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/versions/d1b5be1f0549_.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/versions/e1a50dae1ac9_.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/versions/e937a5234ce4_.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/versions/ebdd955fcc5e_.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/migrations/versions/f3bee20314a2_.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/models/action.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/models/alarms.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/models/base_data_model.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/models/case.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/models/instance.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/models/main_alarms.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/models/meta_models.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/models/role.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/models/user_role.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/models/view.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/__init__.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/action.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/alarms.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/case.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/common.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/dag.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/example_data.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/instance.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/main_alarms.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/model_json.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/patch.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/permissions.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/query.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/role.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/schemas.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/solution_log.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/tables.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/user.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/user_role.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/schemas/view.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/shared/__init__.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/shared/authentication/__init__.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/shared/authentication/ldap.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/shared/compress.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/shared/email.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/shared/licenses.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/shared/log_config.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/shared/query_tools.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/shared/utils.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/shared/utils_tables.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/shared/validators.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/__init__.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/custom_liveServer.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/custom_test_case.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/integration/__init__.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/ldap/__init__.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/ldap/test_ldap_authentication.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/__init__.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_actions.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_alarms.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_apiview.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_application.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_cli.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_data_checks.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_external_role_creation.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_generate_from_schema.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_get_resources.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_instances.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_instances_file.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_licenses.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_log_in.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_permissions.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_sign_up.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_tables.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_token.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow/tests/unit/test_users.py +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow.egg-info/dependency_links.txt +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow.egg-info/entry_points.txt +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/cornflow.egg-info/top_level.txt +0 -0
- {cornflow-1.2.4 → cornflow-1.3.0rc1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: cornflow
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.3.0rc1
|
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
|
@@ -14,7 +14,7 @@ Requires-Dist: alembic==1.9.2
|
|
14
14
|
Requires-Dist: apispec<=6.3.0
|
15
15
|
Requires-Dist: cachetools==5.3.3
|
16
16
|
Requires-Dist: click<=8.1.7
|
17
|
-
Requires-Dist: cornflow-client
|
17
|
+
Requires-Dist: cornflow-client==1.3.0rc1
|
18
18
|
Requires-Dist: cryptography<=44.0.1
|
19
19
|
Requires-Dist: disposable-email-domains>=0.0.86
|
20
20
|
Requires-Dist: Flask==2.3.2
|
@@ -36,7 +36,12 @@ from cornflow.shared.const import (
|
|
36
36
|
ADMIN_ROLE,
|
37
37
|
SERVICE_ROLE,
|
38
38
|
PLANNER_ROLE,
|
39
|
+
DATABRICKS_BACKEND,
|
40
|
+
AIRFLOW_BACKEND,
|
39
41
|
SIGNUP_WITH_AUTH,
|
42
|
+
OID_PROVIDER_AWS,
|
43
|
+
OID_PROVIDER_AZURE,
|
44
|
+
OID_OTHER,
|
40
45
|
)
|
41
46
|
from cornflow.shared import db
|
42
47
|
from cryptography.fernet import Fernet
|
@@ -83,13 +88,14 @@ def init_cornflow_service():
|
|
83
88
|
config["cornflow_service_email"],
|
84
89
|
config["cornflow_service_pwd"],
|
85
90
|
)
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
91
|
+
if config["cornflow_backend"] == AIRFLOW_BACKEND:
|
92
|
+
_sync_with_airflow(
|
93
|
+
config["airflow_url"],
|
94
|
+
config["airflow_user"],
|
95
|
+
config["airflow_pwd"],
|
96
|
+
config["open_deployment"],
|
97
|
+
external_app=False,
|
98
|
+
)
|
93
99
|
_start_application(external_application, environment)
|
94
100
|
|
95
101
|
elif external_application == 1:
|
@@ -115,14 +121,14 @@ def init_cornflow_service():
|
|
115
121
|
config["cornflow_service_email"],
|
116
122
|
config["cornflow_service_pwd"],
|
117
123
|
)
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
124
|
+
if config["cornflow_backend"] == AIRFLOW_BACKEND:
|
125
|
+
_sync_with_airflow(
|
126
|
+
config["airflow_url"],
|
127
|
+
config["airflow_user"],
|
128
|
+
config["airflow_pwd"],
|
129
|
+
config["open_deployment"],
|
130
|
+
external_app=True,
|
131
|
+
)
|
126
132
|
_start_application(external_application, environment, external_app_module)
|
127
133
|
|
128
134
|
else:
|
@@ -136,14 +142,36 @@ def _setup_environment_variables():
|
|
136
142
|
environment = os.getenv("FLASK_ENV", "development")
|
137
143
|
os.environ["FLASK_ENV"] = environment
|
138
144
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
os.
|
144
|
-
os.environ["
|
145
|
-
|
146
|
-
|
145
|
+
###################################
|
146
|
+
# Global defaults and back-compat #
|
147
|
+
###################################
|
148
|
+
# cornflow backend selection
|
149
|
+
cornflow_backend = os.getenv("CORNFLOW_BACKEND", str(AIRFLOW_BACKEND))
|
150
|
+
os.environ["CORNFLOW_BACKEND"] = cornflow_backend
|
151
|
+
cornflow_backend = int(cornflow_backend)
|
152
|
+
# Airflow global default conn
|
153
|
+
if cornflow_backend == AIRFLOW_BACKEND:
|
154
|
+
airflow_user = os.getenv("AIRFLOW_USER", "admin")
|
155
|
+
airflow_pwd = os.getenv("AIRFLOW_PWD", "admin")
|
156
|
+
airflow_url = os.getenv("AIRFLOW_URL", "http://webserver:8080")
|
157
|
+
os.environ["AIRFLOW_USER"] = airflow_user
|
158
|
+
os.environ["AIRFLOW_PWD"] = airflow_pwd
|
159
|
+
os.environ["AIRFLOW_URL"] = airflow_url
|
160
|
+
elif cornflow_backend == DATABRICKS_BACKEND:
|
161
|
+
databricks_url = os.getenv("DATABRICKS_HOST")
|
162
|
+
databricks_auth_secret = os.getenv("DATABRICKS_CLIENT_SECRET")
|
163
|
+
databricks_token_endpoint = os.getenv("DATABRICKS_TOKEN_ENDPOINT")
|
164
|
+
databricks_ep_clusters = os.getenv("DATABRICKS_EP_CLUSTERS")
|
165
|
+
databricks_client_id = os.getenv("DATABRICKS_CLIENT_ID")
|
166
|
+
databricks_health_path = os.getenv("DATABRICKS_HEALTH_PATH")
|
167
|
+
os.environ["DATABRICKS_HEALTH_PATH"] = databricks_health_path
|
168
|
+
os.environ["DATABRICKS_HOST"] = databricks_url
|
169
|
+
os.environ["DATABRICKS_CLIENT_SECRET"] = databricks_auth_secret
|
170
|
+
os.environ["DATABRICKS_TOKEN_ENDPOINT"] = databricks_token_endpoint
|
171
|
+
os.environ["DATABRICKS_EP_CLUSTERS"] = databricks_ep_clusters
|
172
|
+
os.environ["DATABRICKS_CLIENT_ID"] = databricks_client_id
|
173
|
+
else:
|
174
|
+
raise Exception("Selected backend not among valid options")
|
147
175
|
# Cornflow app config
|
148
176
|
os.environ.setdefault("cornflow_url", "http://cornflow:5000")
|
149
177
|
os.environ["FLASK_APP"] = "cornflow.app"
|
@@ -156,6 +184,10 @@ def _setup_environment_variables():
|
|
156
184
|
|
157
185
|
# Platform auth config and service users
|
158
186
|
auth = int(os.getenv("AUTH_TYPE", AUTH_DB))
|
187
|
+
if auth == AUTH_OID:
|
188
|
+
oid_provider = int(os.getenv("OID_PROVIDER", OID_PROVIDER_AWS))
|
189
|
+
os.environ["OID_PROVIDER"] = str(oid_provider)
|
190
|
+
|
159
191
|
cornflow_admin_user = os.getenv("CORNFLOW_ADMIN_USER", "cornflow_admin")
|
160
192
|
cornflow_admin_email = os.getenv(
|
161
193
|
"CORNFLOW_ADMIN_EMAIL", "cornflow_admin@cornflow.com"
|
@@ -192,25 +224,42 @@ def _setup_environment_variables():
|
|
192
224
|
|
193
225
|
external_application = int(os.getenv("EXTERNAL_APP", 0))
|
194
226
|
external_app_module = os.getenv("EXTERNAL_APP_MODULE")
|
227
|
+
base_dict = {
|
228
|
+
"environment": environment,
|
229
|
+
"auth": auth,
|
230
|
+
"cornflow_db_conn": cornflow_db_conn,
|
231
|
+
"cornflow_admin_user": cornflow_admin_user,
|
232
|
+
"cornflow_admin_email": cornflow_admin_email,
|
233
|
+
"cornflow_admin_pwd": cornflow_admin_pwd,
|
234
|
+
"cornflow_service_user": cornflow_service_user,
|
235
|
+
"cornflow_service_email": cornflow_service_email,
|
236
|
+
"cornflow_service_pwd": cornflow_service_pwd,
|
237
|
+
"cornflow_logging": cornflow_logging,
|
238
|
+
"open_deployment": open_deployment,
|
239
|
+
"external_application": external_application,
|
240
|
+
"external_app_module": external_app_module,
|
241
|
+
"cornflow_backend": cornflow_backend,
|
242
|
+
}
|
243
|
+
if cornflow_backend == AIRFLOW_BACKEND:
|
244
|
+
base_dict["airflow_user"] = airflow_user
|
245
|
+
base_dict["airflow_pwd"] = airflow_pwd
|
246
|
+
base_dict["airflow_url"] = airflow_url
|
247
|
+
|
248
|
+
elif cornflow_backend == DATABRICKS_BACKEND:
|
249
|
+
base_dict["databricks_url"] = databricks_url
|
250
|
+
base_dict["databricks_auth_secret"] = databricks_auth_secret
|
251
|
+
base_dict["databricks_token_endpoint"] = databricks_token_endpoint
|
252
|
+
base_dict["databricks_ep_clusters"] = databricks_ep_clusters
|
253
|
+
base_dict["databricks_client_id"] = databricks_client_id
|
254
|
+
base_dict["databricks_health_path"] = databricks_health_path
|
255
|
+
|
256
|
+
else:
|
257
|
+
raise Exception("Selected backend not among valid options")
|
258
|
+
|
259
|
+
if auth == AUTH_OID:
|
260
|
+
base_dict["oid_provider"] = oid_provider
|
195
261
|
|
196
|
-
return
|
197
|
-
"environment": environment,
|
198
|
-
"auth": auth,
|
199
|
-
"airflow_user": airflow_user,
|
200
|
-
"airflow_pwd": airflow_pwd,
|
201
|
-
"airflow_url": airflow_url,
|
202
|
-
"cornflow_db_conn": cornflow_db_conn,
|
203
|
-
"cornflow_admin_user": cornflow_admin_user,
|
204
|
-
"cornflow_admin_email": cornflow_admin_email,
|
205
|
-
"cornflow_admin_pwd": cornflow_admin_pwd,
|
206
|
-
"cornflow_service_user": cornflow_service_user,
|
207
|
-
"cornflow_service_email": cornflow_service_email,
|
208
|
-
"cornflow_service_pwd": cornflow_service_pwd,
|
209
|
-
"cornflow_logging": cornflow_logging,
|
210
|
-
"open_deployment": open_deployment,
|
211
|
-
"external_application": external_application,
|
212
|
-
"external_app_module": external_app_module,
|
213
|
-
}
|
262
|
+
return base_dict
|
214
263
|
|
215
264
|
|
216
265
|
def _configure_logging(cornflow_logging):
|
@@ -378,4 +427,4 @@ def _register_key():
|
|
378
427
|
os.system(add_key)
|
379
428
|
return True
|
380
429
|
else:
|
381
|
-
return False
|
430
|
+
return False
|
@@ -10,7 +10,7 @@ def register_deployed_dags_command(
|
|
10
10
|
|
11
11
|
# Internal modules imports
|
12
12
|
from cornflow_client.airflow.api import Airflow
|
13
|
-
from cornflow.models import
|
13
|
+
from cornflow.models import DeployedWorkflow
|
14
14
|
from cornflow.shared import db
|
15
15
|
from cornflow.shared.const import AIRFLOW_NOT_REACHABLE_MSG
|
16
16
|
|
@@ -28,7 +28,7 @@ def register_deployed_dags_command(
|
|
28
28
|
current_app.logger.info(f"{AIRFLOW_NOT_REACHABLE_MSG}")
|
29
29
|
return False
|
30
30
|
|
31
|
-
dags_registered = [dag.id for dag in
|
31
|
+
dags_registered = [dag.id for dag in DeployedWorkflow.get_all_objects()]
|
32
32
|
|
33
33
|
response = af_client.get_model_dags()
|
34
34
|
dag_list = response.json()["dags"]
|
@@ -40,7 +40,7 @@ def register_deployed_dags_command(
|
|
40
40
|
}
|
41
41
|
|
42
42
|
processed_dags = [
|
43
|
-
|
43
|
+
DeployedWorkflow(
|
44
44
|
{
|
45
45
|
"id": dag["dag_id"],
|
46
46
|
"description": dag["description"],
|
@@ -76,15 +76,15 @@ def register_deployed_dags_command(
|
|
76
76
|
|
77
77
|
|
78
78
|
def register_deployed_dags_command_test(dags: list = None, verbose: bool = False):
|
79
|
-
from cornflow.models import
|
79
|
+
from cornflow.models import DeployedWorkflow
|
80
80
|
from flask import current_app
|
81
81
|
from cornflow_client import get_pulp_jsonschema, get_empty_schema
|
82
82
|
|
83
83
|
if dags is None:
|
84
|
-
dags = ["solve_model_dag", "gc", "timer"]
|
84
|
+
dags = ["solve_model_dag", "gc", "timer", "979073949072767"]
|
85
85
|
|
86
86
|
deployed_dag = [
|
87
|
-
|
87
|
+
DeployedWorkflow(
|
88
88
|
{
|
89
89
|
"id": "solve_model_dag",
|
90
90
|
"description": None,
|
@@ -96,7 +96,7 @@ def register_deployed_dags_command_test(dags: list = None, verbose: bool = False
|
|
96
96
|
}
|
97
97
|
)
|
98
98
|
] + [
|
99
|
-
|
99
|
+
DeployedWorkflow(
|
100
100
|
{
|
101
101
|
"id": dag,
|
102
102
|
"description": None,
|
@@ -8,6 +8,7 @@ from cornflow.commands.auxiliar import (
|
|
8
8
|
from cornflow.models import ViewModel, PermissionViewRoleModel
|
9
9
|
from cornflow.shared import db
|
10
10
|
from cornflow.shared.const import ALL_DEFAULT_ROLES, GET_ACTION
|
11
|
+
import click
|
11
12
|
from cornflow.shared.const import (
|
12
13
|
BASE_PERMISSION_ASSIGNATION,
|
13
14
|
)
|
@@ -235,7 +236,7 @@ def register_dag_permissions_command(
|
|
235
236
|
from flask import current_app
|
236
237
|
from sqlalchemy.exc import DBAPIError, IntegrityError
|
237
238
|
|
238
|
-
from cornflow.models import
|
239
|
+
from cornflow.models import DeployedWorkflow, PermissionsDAG, UserModel
|
239
240
|
from cornflow.shared import db
|
240
241
|
|
241
242
|
if open_deployment is None:
|
@@ -253,9 +254,10 @@ def register_dag_permissions_command(
|
|
253
254
|
current_app.logger.error(f"Unknown error on database commit: {e}")
|
254
255
|
|
255
256
|
all_users = UserModel.get_all_users().all()
|
256
|
-
all_dags =
|
257
|
+
all_dags = DeployedWorkflow.get_all_objects().all()
|
257
258
|
|
258
259
|
if open_deployment == 1:
|
260
|
+
|
259
261
|
permissions = [
|
260
262
|
PermissionsDAG({"dag_id": dag.id, "user_id": user.id})
|
261
263
|
for user in all_users
|
@@ -297,9 +299,11 @@ def register_dag_permissions_command(
|
|
297
299
|
)
|
298
300
|
|
299
301
|
if verbose:
|
302
|
+
click.echo(f"Workflow permissions registered")
|
300
303
|
if len(permissions) > 1:
|
301
|
-
current_app.logger.info(
|
304
|
+
current_app.logger.info(
|
305
|
+
f"Workflow permissions registered: {len(permissions)}"
|
306
|
+
)
|
302
307
|
else:
|
303
|
-
current_app.logger.info("No new
|
308
|
+
current_app.logger.info("No new Workflow permissions")
|
304
309
|
|
305
|
-
pass
|
@@ -2,6 +2,7 @@ import os
|
|
2
2
|
from .shared.const import AUTH_DB, PLANNER_ROLE, AUTH_OID, SIGNUP_WITH_AUTH, SIGNUP_WITH_NO_AUTH
|
3
3
|
from apispec import APISpec
|
4
4
|
from apispec.ext.marshmallow import MarshmallowPlugin
|
5
|
+
from cornflow.shared.const import AIRFLOW_BACKEND, DATABRICKS_BACKEND
|
5
6
|
|
6
7
|
|
7
8
|
class DefaultConfig(object):
|
@@ -15,9 +16,7 @@ class DefaultConfig(object):
|
|
15
16
|
SECRET_TOKEN_KEY = os.getenv("SECRET_KEY")
|
16
17
|
SECRET_BI_KEY = os.getenv("SECRET_BI_KEY")
|
17
18
|
SQLALCHEMY_DATABASE_URI = os.getenv("DATABASE_URL", "sqlite:///cornflow.db")
|
18
|
-
|
19
|
-
AIRFLOW_USER = os.getenv("AIRFLOW_USER")
|
20
|
-
AIRFLOW_PWD = os.getenv("AIRFLOW_PWD")
|
19
|
+
|
21
20
|
AUTH_TYPE = int(os.getenv("AUTH_TYPE", AUTH_DB))
|
22
21
|
DEFAULT_ROLE = int(os.getenv("DEFAULT_ROLE", PLANNER_ROLE))
|
23
22
|
CORS_ORIGINS = os.getenv("CORS_ORIGINS", "*")
|
@@ -28,6 +27,21 @@ class DefaultConfig(object):
|
|
28
27
|
SIGNUP_ACTIVATED = int(os.getenv("SIGNUP_ACTIVATED", SIGNUP_WITH_AUTH))
|
29
28
|
CORNFLOW_SERVICE_USER = os.getenv("CORNFLOW_SERVICE_USER", "service_user")
|
30
29
|
|
30
|
+
# To change the tasks backend used by cornflow to solve the optimization models
|
31
|
+
CORNFLOW_BACKEND = int(os.getenv("CORNFLOW_BACKEND", AIRFLOW_BACKEND))
|
32
|
+
|
33
|
+
# AIRFLOW config
|
34
|
+
AIRFLOW_URL = os.getenv("AIRFLOW_URL")
|
35
|
+
AIRFLOW_USER = os.getenv("AIRFLOW_USER")
|
36
|
+
AIRFLOW_PWD = os.getenv("AIRFLOW_PWD")
|
37
|
+
|
38
|
+
# DATABRICKS config
|
39
|
+
DATABRICKS_URL = os.getenv("DATABRICKS_HOST")
|
40
|
+
DATABRICKS_AUTH_SECRET = os.getenv("DATABRICKS_CLIENT_SECRET")
|
41
|
+
DATABRICKS_TOKEN_ENDPOINT = os.getenv("DATABRICKS_TOKEN_ENDPOINT")
|
42
|
+
DATABRICKS_EP_CLUSTERS = os.getenv("DATABRICKS_EP_CLUSTERS")
|
43
|
+
DATABRICKS_CLIENT_ID = os.getenv("DATABRICKS_CLIENT_ID")
|
44
|
+
DATABRICKS_HEALTH_PATH = os.getenv("DATABRICKS_HEALTH_PATH", "default path")
|
31
45
|
# If service user is allowed to log with username and password
|
32
46
|
SERVICE_USER_ALLOW_PASSWORD_LOGIN = int(
|
33
47
|
os.getenv("SERVICE_USER_ALLOW_PASSWORD_LOGIN", 1)
|
@@ -121,10 +135,15 @@ class Testing(DefaultConfig):
|
|
121
135
|
LOG_LEVEL = int(os.getenv("LOG_LEVEL", 10))
|
122
136
|
SIGNUP_ACTIVATED = SIGNUP_WITH_NO_AUTH
|
123
137
|
|
138
|
+
class TestingDatabricks(Testing):
|
139
|
+
CORNFLOW_BACKEND = DATABRICKS_BACKEND
|
140
|
+
|
141
|
+
|
124
142
|
class TestingOpenAuth(Testing):
|
125
143
|
"""
|
126
144
|
Configuration class for testing some edge cases with Open Auth login
|
127
145
|
"""
|
146
|
+
|
128
147
|
AUTH_TYPE = AUTH_OID
|
129
148
|
OID_PROVIDER = "https://test-provider.example.com"
|
130
149
|
OID_EXPECTED_AUDIENCE = "test-audience-id"
|
@@ -158,4 +177,5 @@ app_config = {
|
|
158
177
|
"production": Production,
|
159
178
|
"testing-oauth": TestingOpenAuth,
|
160
179
|
"testing-root": TestingApplicationRoot,
|
180
|
+
"testing-databricks": TestingDatabricks,
|
161
181
|
}
|
@@ -3,11 +3,9 @@ External endpoints to manage the cases: create new cases from raw data, from an
|
|
3
3
|
or from an existing case, update the case info, patch its data, get all of them or one, move them and delete them.
|
4
4
|
These endpoints have different access url, but manage the same data entities
|
5
5
|
"""
|
6
|
+
|
6
7
|
# Import from libraries
|
7
|
-
from cornflow_client.constants import
|
8
|
-
INSTANCE_SCHEMA,
|
9
|
-
SOLUTION_SCHEMA
|
10
|
-
)
|
8
|
+
from cornflow_client.constants import INSTANCE_SCHEMA, SOLUTION_SCHEMA
|
11
9
|
from flask import current_app
|
12
10
|
from flask_apispec import marshal_with, use_kwargs, doc
|
13
11
|
from flask_inflate import inflate
|
@@ -16,7 +14,7 @@ import jsonpatch
|
|
16
14
|
|
17
15
|
# Import from internal modules
|
18
16
|
from cornflow.endpoints.meta_resource import BaseMetaResource
|
19
|
-
from cornflow.models import CaseModel, ExecutionModel,
|
17
|
+
from cornflow.models import CaseModel, ExecutionModel, DeployedWorkflow, InstanceModel
|
20
18
|
from cornflow.shared.authentication import Auth, authenticate
|
21
19
|
from cornflow.shared.compress import compressed
|
22
20
|
from cornflow.shared.const import VIEWER_ROLE, PLANNER_ROLE, ADMIN_ROLE
|
@@ -40,6 +38,7 @@ class CaseEndpoint(BaseMetaResource):
|
|
40
38
|
"""
|
41
39
|
Endpoint used to create a new case or get all the cases and their related information
|
42
40
|
"""
|
41
|
+
|
43
42
|
ROLES_WITH_ACCESS = [VIEWER_ROLE, PLANNER_ROLE, ADMIN_ROLE]
|
44
43
|
|
45
44
|
def __init__(self):
|
@@ -79,15 +78,21 @@ class CaseEndpoint(BaseMetaResource):
|
|
79
78
|
|
80
79
|
# We validate the instance data if it exists
|
81
80
|
if kwargs.get("data") is not None:
|
82
|
-
data_schema =
|
81
|
+
data_schema = DeployedWorkflow.get_one_schema(
|
82
|
+
config, schema, INSTANCE_SCHEMA
|
83
|
+
)
|
83
84
|
data_errors = json_schema_validate_as_string(data_schema, kwargs["data"])
|
84
85
|
if data_errors:
|
85
86
|
raise InvalidData(payload=dict(jsonschema_errors=data_errors))
|
86
87
|
|
87
88
|
# And the solution data if it exists
|
88
89
|
if kwargs.get("solution") is not None:
|
89
|
-
solution_schema =
|
90
|
-
|
90
|
+
solution_schema = DeployedWorkflow.get_one_schema(
|
91
|
+
config, schema, SOLUTION_SCHEMA
|
92
|
+
)
|
93
|
+
solution_errors = json_schema_validate_as_string(
|
94
|
+
solution_schema, kwargs["solution"]
|
95
|
+
)
|
91
96
|
if solution_errors:
|
92
97
|
raise InvalidData(payload=dict(jsonschema_errors=solution_errors))
|
93
98
|
|
@@ -102,6 +107,7 @@ class CaseFromInstanceExecutionEndpoint(BaseMetaResource):
|
|
102
107
|
"""
|
103
108
|
Endpoint used to create a new case from an already existing instance and execution
|
104
109
|
"""
|
110
|
+
|
105
111
|
ROLES_WITH_ACCESS = [PLANNER_ROLE, ADMIN_ROLE]
|
106
112
|
|
107
113
|
def __init__(self):
|
@@ -129,7 +135,7 @@ class CaseFromInstanceExecutionEndpoint(BaseMetaResource):
|
|
129
135
|
error="You must provide a valid instance_id OR an execution_id",
|
130
136
|
status_code=400,
|
131
137
|
log_txt=f"Error while user {self.get_user()} tries to create case from instance and execution. "
|
132
|
-
|
138
|
+
f"The instance id or execution id is not valid.",
|
133
139
|
)
|
134
140
|
user = self.get_user()
|
135
141
|
|
@@ -140,7 +146,7 @@ class CaseFromInstanceExecutionEndpoint(BaseMetaResource):
|
|
140
146
|
raise ObjectDoesNotExist(
|
141
147
|
err,
|
142
148
|
log_txt=f"Error while user {self.get_user()} tries to create case "
|
143
|
-
|
149
|
+
f"from instance and execution. " + err,
|
144
150
|
)
|
145
151
|
return dict(
|
146
152
|
data=instance.data, schema=instance.schema, checks=instance.checks
|
@@ -153,7 +159,7 @@ class CaseFromInstanceExecutionEndpoint(BaseMetaResource):
|
|
153
159
|
raise ObjectDoesNotExist(
|
154
160
|
err,
|
155
161
|
log_txt=f"Error while user {self.get_user()} tries to create "
|
156
|
-
|
162
|
+
f"case from instance and execution. " + err,
|
157
163
|
)
|
158
164
|
data = get_instance_data(execution.instance_id)
|
159
165
|
data["solution"] = execution.data
|
@@ -179,6 +185,7 @@ class CaseCopyEndpoint(BaseMetaResource):
|
|
179
185
|
"""
|
180
186
|
Copies the case to a new case. Original case id goes in the url
|
181
187
|
"""
|
188
|
+
|
182
189
|
ROLES_WITH_ACCESS = [PLANNER_ROLE, ADMIN_ROLE]
|
183
190
|
|
184
191
|
def __init__(self):
|
@@ -214,7 +221,9 @@ class CaseCopyEndpoint(BaseMetaResource):
|
|
214
221
|
payload[key] = "Copy_" + data[key]
|
215
222
|
|
216
223
|
response = self.post_list(payload)
|
217
|
-
current_app.logger.info(
|
224
|
+
current_app.logger.info(
|
225
|
+
f"User {self.get_user()} copied case {idx} into {response[0].id}"
|
226
|
+
)
|
218
227
|
return response
|
219
228
|
|
220
229
|
|
@@ -222,6 +231,7 @@ class CaseDetailsEndpoint(BaseMetaResource):
|
|
222
231
|
"""
|
223
232
|
Endpoint used to get the information of a single case, edit it or delete it
|
224
233
|
"""
|
234
|
+
|
225
235
|
ROLES_WITH_ACCESS = [VIEWER_ROLE, PLANNER_ROLE, ADMIN_ROLE]
|
226
236
|
|
227
237
|
def __init__(self):
|
@@ -264,7 +274,8 @@ class CaseDetailsEndpoint(BaseMetaResource):
|
|
264
274
|
err = "The data entity does not exist on the database."
|
265
275
|
raise ObjectDoesNotExist(
|
266
276
|
err,
|
267
|
-
log_txt=f"Error while user {self.get_user()} tries to edit case {idx}. "
|
277
|
+
log_txt=f"Error while user {self.get_user()} tries to edit case {idx}. "
|
278
|
+
+ err,
|
268
279
|
)
|
269
280
|
if parent_id is not None:
|
270
281
|
parent_case = self.data_model.get_one_object(
|
@@ -275,7 +286,7 @@ class CaseDetailsEndpoint(BaseMetaResource):
|
|
275
286
|
raise ObjectDoesNotExist(
|
276
287
|
err,
|
277
288
|
log_txt=f"Error while user {self.get_user()} tries to move "
|
278
|
-
|
289
|
+
f"case {idx} to directory {idx}. " + err,
|
279
290
|
)
|
280
291
|
|
281
292
|
case.move_to(parent_case)
|
@@ -302,6 +313,7 @@ class CaseDataEndpoint(CaseDetailsEndpoint):
|
|
302
313
|
"""
|
303
314
|
Endpoint used to get the data of a given case
|
304
315
|
"""
|
316
|
+
|
305
317
|
ROLES_WITH_ACCESS = [VIEWER_ROLE, PLANNER_ROLE, ADMIN_ROLE]
|
306
318
|
|
307
319
|
@doc(description="Get data of a case", tags=["Cases"], inherit=False)
|
@@ -338,6 +350,7 @@ class CaseToInstance(BaseMetaResource):
|
|
338
350
|
"""
|
339
351
|
Endpoint used to create a new instance or instance and execution from a stored case
|
340
352
|
"""
|
353
|
+
|
341
354
|
ROLES_WITH_ACCESS = [PLANNER_ROLE, ADMIN_ROLE]
|
342
355
|
|
343
356
|
def __init__(self):
|
@@ -383,13 +396,13 @@ class CaseToInstance(BaseMetaResource):
|
|
383
396
|
config = current_app.config
|
384
397
|
|
385
398
|
# Data validation
|
386
|
-
jsonschema =
|
399
|
+
jsonschema = DeployedWorkflow.get_one_schema(config, schema, INSTANCE_SCHEMA)
|
387
400
|
data_errors = json_schema_validate_as_string(jsonschema, payload["data"])
|
388
401
|
if data_errors:
|
389
402
|
raise InvalidData(
|
390
403
|
payload=dict(jsonschema_errors=data_errors),
|
391
404
|
log_txt=f"Error while user {self.get_user()} tries to create instance from case {idx}. "
|
392
|
-
|
405
|
+
f"Data do not match the jsonschema.",
|
393
406
|
)
|
394
407
|
|
395
408
|
response = self.post_list(payload)
|
@@ -403,6 +416,7 @@ class CaseCompare(BaseMetaResource):
|
|
403
416
|
"""
|
404
417
|
Endpoint used to generate the json patch of two given cases
|
405
418
|
"""
|
419
|
+
|
406
420
|
ROLES_WITH_ACCESS = [VIEWER_ROLE, PLANNER_ROLE, ADMIN_ROLE]
|
407
421
|
|
408
422
|
def __init__(self):
|
@@ -435,7 +449,7 @@ class CaseCompare(BaseMetaResource):
|
|
435
449
|
"The case identifiers should be different.",
|
436
450
|
400,
|
437
451
|
log_txt=f"Error while user {self.get_user()} tries to compare cases. "
|
438
|
-
|
452
|
+
f"The cases to compare have the same identifier.",
|
439
453
|
)
|
440
454
|
case_1 = self.model.get_one_object(user=self.get_user(), idx=idx1)
|
441
455
|
case_2 = self.model.get_one_object(user=self.get_user(), idx=idx2)
|
@@ -444,19 +458,19 @@ class CaseCompare(BaseMetaResource):
|
|
444
458
|
raise ObjectDoesNotExist(
|
445
459
|
"You don't have access to the first case or it doesn't exist",
|
446
460
|
log_txt=f"Error while user {self.get_user()} tries to compare cases {idx1} and {idx2}. "
|
447
|
-
|
461
|
+
f"The user doesn't have access to case {idx1} or it does not exist.",
|
448
462
|
)
|
449
463
|
elif case_2 is None:
|
450
464
|
raise ObjectDoesNotExist(
|
451
465
|
"You don't have access to the second case or it doesn't exist",
|
452
466
|
log_txt=f"Error while user {self.get_user()} tries to compare cases {idx1} and {idx2}. "
|
453
|
-
|
467
|
+
f"The user doesn't have access to case {idx2} or it does not exist.",
|
454
468
|
)
|
455
469
|
elif case_1.schema != case_2.schema:
|
456
470
|
raise InvalidData(
|
457
471
|
"The cases asked to compare do not share the same schema",
|
458
472
|
log_txt=f"Error while user {self.get_user()} tries to compare cases {idx1} and {idx2}. "
|
459
|
-
|
473
|
+
f"The cases don't have the same schemas.",
|
460
474
|
)
|
461
475
|
|
462
476
|
data = kwargs.get("data", True)
|
@@ -471,5 +485,7 @@ class CaseCompare(BaseMetaResource):
|
|
471
485
|
).patch
|
472
486
|
|
473
487
|
payload["schema"] = case_1.schema
|
474
|
-
current_app.logger.info(
|
488
|
+
current_app.logger.info(
|
489
|
+
f"User {self.get_user()} compared cases {idx1} and {idx2}"
|
490
|
+
)
|
475
491
|
return payload, 200
|
@@ -10,7 +10,7 @@ from flask_apispec import use_kwargs, doc, marshal_with
|
|
10
10
|
|
11
11
|
# Import from internal modules
|
12
12
|
from cornflow.endpoints.meta_resource import BaseMetaResource
|
13
|
-
from cornflow.models import
|
13
|
+
from cornflow.models import DeployedWorkflow, ExecutionModel, InstanceModel, CaseModel
|
14
14
|
from cornflow.schemas import DeployedDAGSchema, DeployedDAGEditSchema
|
15
15
|
from cornflow.schemas.case import CaseCheckRequest
|
16
16
|
from cornflow.schemas.instance import InstanceCheckRequest
|
@@ -118,7 +118,7 @@ class DAGDetailEndpoint(BaseMetaResource):
|
|
118
118
|
if solution_schema is not None:
|
119
119
|
config = current_app.config
|
120
120
|
|
121
|
-
solution_schema =
|
121
|
+
solution_schema = DeployedWorkflow.get_one_schema(
|
122
122
|
config, solution_schema, SOLUTION_SCHEMA
|
123
123
|
)
|
124
124
|
solution_errors = json_schema_validate_as_string(solution_schema, data)
|
@@ -215,7 +215,7 @@ class DAGEndpointManual(BaseMetaResource):
|
|
215
215
|
solution_schema = "solve_model_dag"
|
216
216
|
if solution_schema is not None:
|
217
217
|
config = current_app.config
|
218
|
-
solution_schema =
|
218
|
+
solution_schema = DeployedWorkflow.get_one_schema(
|
219
219
|
config, solution_schema, SOLUTION_SCHEMA
|
220
220
|
)
|
221
221
|
solution_errors = json_schema_validate_as_string(solution_schema, data)
|
@@ -246,7 +246,7 @@ class DeployedDAGEndpoint(BaseMetaResource):
|
|
246
246
|
|
247
247
|
def __init__(self):
|
248
248
|
super().__init__()
|
249
|
-
self.data_model =
|
249
|
+
self.data_model = DeployedWorkflow
|
250
250
|
|
251
251
|
@doc(
|
252
252
|
description="Get list of deployed dags registered on the data base",
|
@@ -270,7 +270,7 @@ class DeployedDagDetailEndpoint(BaseMetaResource):
|
|
270
270
|
|
271
271
|
def __init__(self):
|
272
272
|
super().__init__()
|
273
|
-
self.data_model =
|
273
|
+
self.data_model = DeployedWorkflow
|
274
274
|
|
275
275
|
@doc(
|
276
276
|
description="Endpoint to update the schemas of a deployed DAG",
|