cornflow 1.2.4__py3-none-any.whl → 1.3.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cornflow/cli/service.py +91 -42
- cornflow/commands/dag.py +7 -7
- cornflow/commands/permissions.py +9 -5
- cornflow/config.py +23 -3
- cornflow/endpoints/case.py +37 -21
- cornflow/endpoints/dag.py +5 -5
- cornflow/endpoints/data_check.py +8 -7
- cornflow/endpoints/example_data.py +4 -2
- cornflow/endpoints/execution.py +215 -127
- cornflow/endpoints/health.py +30 -11
- cornflow/endpoints/instance.py +3 -3
- cornflow/endpoints/login.py +9 -2
- cornflow/endpoints/schemas.py +3 -3
- cornflow/migrations/versions/999b98e24225.py +34 -0
- cornflow/migrations/versions/cef1df240b27_.py +34 -0
- cornflow/models/__init__.py +2 -1
- cornflow/models/dag.py +8 -9
- cornflow/models/dag_permissions.py +3 -3
- cornflow/models/execution.py +2 -3
- cornflow/models/permissions.py +1 -0
- cornflow/models/user.py +1 -1
- cornflow/schemas/execution.py +14 -1
- cornflow/schemas/health.py +1 -1
- cornflow/shared/authentication/auth.py +14 -1
- cornflow/shared/authentication/decorators.py +0 -1
- cornflow/shared/const.py +44 -1
- cornflow/shared/exceptions.py +2 -1
- cornflow/tests/base_test_execution.py +798 -0
- cornflow/tests/const.py +1 -0
- cornflow/tests/integration/test_commands.py +2 -2
- cornflow/tests/integration/test_cornflowclient.py +2 -1
- cornflow/tests/unit/test_cases.py +1 -1
- cornflow/tests/unit/test_commands.py +5 -5
- cornflow/tests/unit/test_dags.py +3 -3
- cornflow/tests/unit/test_example_data.py +1 -1
- cornflow/tests/unit/test_executions.py +115 -535
- cornflow/tests/unit/test_health.py +84 -3
- cornflow/tests/unit/test_main_alarms.py +1 -1
- cornflow/tests/unit/test_roles.py +2 -1
- cornflow/tests/unit/test_schema_from_models.py +1 -1
- cornflow/tests/unit/test_schemas.py +1 -1
- cornflow/tests/unit/tools.py +93 -10
- {cornflow-1.2.4.dist-info → cornflow-1.3.0rc1.dist-info}/METADATA +2 -2
- {cornflow-1.2.4.dist-info → cornflow-1.3.0rc1.dist-info}/RECORD +47 -44
- {cornflow-1.2.4.dist-info → cornflow-1.3.0rc1.dist-info}/WHEEL +0 -0
- {cornflow-1.2.4.dist-info → cornflow-1.3.0rc1.dist-info}/entry_points.txt +0 -0
- {cornflow-1.2.4.dist-info → cornflow-1.3.0rc1.dist-info}/top_level.txt +0 -0
cornflow/tests/const.py
CHANGED
@@ -15,6 +15,7 @@ INSTANCE_URL = PREFIX + "/instance/"
|
|
15
15
|
INSTANCE_MPS = _get_file("./data/test_mps.mps")
|
16
16
|
INSTANCE_GC_20 = _get_file("./data/gc_20_7.json")
|
17
17
|
INSTANCE_FILE_FAIL = _get_file("./unit/test_instances.py")
|
18
|
+
EDIT_EXECUTION_SOLUTION = _get_file("./data/edit_execution_solution.json")
|
18
19
|
|
19
20
|
EXECUTION_PATH = _get_file("./data/new_execution.json")
|
20
21
|
CUSTOM_CONFIG_PATH = _get_file("./data/new_execution_custom_config.json")
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from flask import current_app
|
2
2
|
|
3
3
|
from cornflow.commands.dag import register_deployed_dags_command
|
4
|
-
from cornflow.models import
|
4
|
+
from cornflow.models import DeployedWorkflow
|
5
5
|
from cornflow.tests.const import PUBLIC_DAGS
|
6
6
|
from cornflow.tests.custom_liveServer import CustomTestCaseLive
|
7
7
|
|
@@ -15,7 +15,7 @@ class TestCornflowCommands(CustomTestCaseLive):
|
|
15
15
|
register_deployed_dags_command(
|
16
16
|
config["AIRFLOW_URL"], config["AIRFLOW_USER"], config["AIRFLOW_PWD"], False
|
17
17
|
)
|
18
|
-
dags =
|
18
|
+
dags = DeployedWorkflow.get_all_objects()
|
19
19
|
|
20
20
|
for dag in PUBLIC_DAGS:
|
21
21
|
self.assertIn(dag, [d.id for d in dags])
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"""
|
2
2
|
|
3
3
|
"""
|
4
|
+
|
4
5
|
# Full imports
|
5
6
|
import json
|
6
7
|
import pulp
|
@@ -279,7 +280,7 @@ class TestCornflowClientOpen(TestCornflowClientBasic):
|
|
279
280
|
def test_server_alive(self):
|
280
281
|
data = self.client.is_alive()
|
281
282
|
cf_status = data["cornflow_status"]
|
282
|
-
af_status = data["
|
283
|
+
af_status = data["backend_status"]
|
283
284
|
self.assertEqual(str, type(cf_status))
|
284
285
|
self.assertEqual(str, type(af_status))
|
285
286
|
self.assertEqual(cf_status, STATUS_HEALTHY)
|
@@ -41,7 +41,7 @@ import zlib
|
|
41
41
|
|
42
42
|
|
43
43
|
# Import from internal modules
|
44
|
-
from cornflow.models import CaseModel, ExecutionModel, InstanceModel
|
44
|
+
from cornflow.models import CaseModel, ExecutionModel, InstanceModel
|
45
45
|
from cornflow.shared.const import DATA_DOES_NOT_EXIST_MSG
|
46
46
|
from cornflow.shared.utils import hash_json_256
|
47
47
|
from cornflow.tests.const import (
|
@@ -39,7 +39,7 @@ from cornflow.models import (
|
|
39
39
|
ViewModel,
|
40
40
|
)
|
41
41
|
from cornflow.models import (
|
42
|
-
|
42
|
+
DeployedWorkflow,
|
43
43
|
PermissionsDAG,
|
44
44
|
UserModel,
|
45
45
|
)
|
@@ -357,7 +357,7 @@ class TestCommands(TestCase):
|
|
357
357
|
- Presence of required DAGs
|
358
358
|
"""
|
359
359
|
register_deployed_dags_command_test(verbose=True)
|
360
|
-
dags =
|
360
|
+
dags = DeployedWorkflow.get_all_objects()
|
361
361
|
for dag in ["solve_model_dag", "gc", "timer"]:
|
362
362
|
self.assertIn(dag, [d.id for d in dags])
|
363
363
|
|
@@ -382,8 +382,8 @@ class TestCommands(TestCase):
|
|
382
382
|
service_permissions = PermissionsDAG.get_user_dag_permissions(service.id)
|
383
383
|
admin_permissions = PermissionsDAG.get_user_dag_permissions(admin.id)
|
384
384
|
|
385
|
-
self.assertEqual(
|
386
|
-
self.assertEqual(
|
385
|
+
self.assertEqual(4, len(service_permissions))
|
386
|
+
self.assertEqual(4, len(admin_permissions))
|
387
387
|
|
388
388
|
def test_dag_permissions_command_no_open(self):
|
389
389
|
"""
|
@@ -406,7 +406,7 @@ class TestCommands(TestCase):
|
|
406
406
|
service_permissions = PermissionsDAG.get_user_dag_permissions(service.id)
|
407
407
|
admin_permissions = PermissionsDAG.get_user_dag_permissions(admin.id)
|
408
408
|
|
409
|
-
self.assertEqual(
|
409
|
+
self.assertEqual(4, len(service_permissions))
|
410
410
|
self.assertEqual(0, len(admin_permissions))
|
411
411
|
|
412
412
|
def test_argument_parsing_correct(self):
|
cornflow/tests/unit/test_dags.py
CHANGED
@@ -24,7 +24,7 @@ from cornflow.commands.access import access_init_command
|
|
24
24
|
from cornflow.commands.dag import register_deployed_dags_command_test
|
25
25
|
from cornflow.commands.permissions import register_dag_permissions_command
|
26
26
|
from cornflow.shared.const import ADMIN_ROLE, SERVICE_ROLE
|
27
|
-
from cornflow.models import
|
27
|
+
from cornflow.models import DeployedWorkflow, PermissionsDAG, UserModel, UserRoleModel
|
28
28
|
from cornflow.shared.const import EXEC_STATE_CORRECT, EXEC_STATE_MANUAL
|
29
29
|
from cornflow.shared import db
|
30
30
|
from cornflow.tests.const import (
|
@@ -38,7 +38,7 @@ from cornflow.tests.const import (
|
|
38
38
|
USER_URL,
|
39
39
|
EXECUTION_URL,
|
40
40
|
)
|
41
|
-
from cornflow.tests.
|
41
|
+
from cornflow.tests.base_test_execution import TestExecutionsDetailEndpointMock
|
42
42
|
from cornflow_client import get_pulp_jsonschema, get_empty_schema
|
43
43
|
|
44
44
|
|
@@ -350,7 +350,7 @@ class TestDeployedDAG(TestCase):
|
|
350
350
|
"""
|
351
351
|
before = PermissionsDAG.get_user_dag_permissions(self.admin["id"])
|
352
352
|
self.assertIsNotNone(before)
|
353
|
-
dag =
|
353
|
+
dag = DeployedWorkflow.query.get("solve_model_dag")
|
354
354
|
dag.delete()
|
355
355
|
after = PermissionsDAG.get_user_dag_permissions(self.admin["id"])
|
356
356
|
self.assertNotEqual(before, after)
|
@@ -35,7 +35,7 @@ class TestExampleDataEndpoint(CustomTestCase):
|
|
35
35
|
def patch_af_client(self, Airflow_mock):
|
36
36
|
af_client = Airflow_mock.return_value
|
37
37
|
af_client.is_alive.return_value = True
|
38
|
-
af_client.
|
38
|
+
af_client.get_workflow_info.return_value = {}
|
39
39
|
af_client.get_one_variable.return_value = {
|
40
40
|
"value": json.dumps(self.example),
|
41
41
|
"key": self.schema_name,
|