cornflow 1.1.0a1__tar.gz → 1.1.0a2__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.
Files changed (184) hide show
  1. {cornflow-1.1.0a1/cornflow.egg-info → cornflow-1.1.0a2}/PKG-INFO +1 -1
  2. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/__init__.py +15 -20
  3. cornflow-1.1.0a2/cornflow/endpoints/example_data.py +119 -0
  4. cornflow-1.1.0a2/cornflow/schemas/example_data.py +11 -0
  5. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_cli.py +5 -5
  6. cornflow-1.1.0a2/cornflow/tests/unit/test_example_data.py +124 -0
  7. {cornflow-1.1.0a1 → cornflow-1.1.0a2/cornflow.egg-info}/PKG-INFO +1 -1
  8. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow.egg-info/requires.txt +1 -1
  9. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/setup.py +1 -1
  10. cornflow-1.1.0a1/cornflow/endpoints/example_data.py +0 -68
  11. cornflow-1.1.0a1/cornflow/schemas/example_data.py +0 -6
  12. cornflow-1.1.0a1/cornflow/tests/unit/test_example_data.py +0 -54
  13. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/MANIFEST.in +0 -0
  14. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/README.rst +0 -0
  15. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/airflow_config/__init__.py +0 -0
  16. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/airflow_config/airflow_local_settings.py +0 -0
  17. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/airflow_config/plugins/XCom/__init__.py +0 -0
  18. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/airflow_config/plugins/XCom/gce_xcom_backend.py +0 -0
  19. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/airflow_config/plugins/__init__.py +0 -0
  20. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/airflow_config/webserver_ldap.py +0 -0
  21. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/__init__.py +0 -0
  22. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/app.py +0 -0
  23. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/__init__.py +0 -0
  24. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/actions.py +0 -0
  25. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/arguments.py +0 -0
  26. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/config.py +0 -0
  27. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/migrations.py +0 -0
  28. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/permissions.py +0 -0
  29. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/roles.py +0 -0
  30. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/schemas.py +0 -0
  31. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/service.py +0 -0
  32. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/tools/__init__.py +0 -0
  33. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/tools/api_generator.py +0 -0
  34. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/tools/endpoint_tools.py +0 -0
  35. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/tools/models_tools.py +0 -0
  36. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/tools/schema_generator.py +0 -0
  37. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/tools/schemas_tools.py +0 -0
  38. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/tools/tools.py +0 -0
  39. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/users.py +0 -0
  40. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/utils.py +0 -0
  41. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/cli/views.py +0 -0
  42. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/commands/__init__.py +0 -0
  43. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/commands/access.py +0 -0
  44. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/commands/actions.py +0 -0
  45. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/commands/cleanup.py +0 -0
  46. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/commands/dag.py +0 -0
  47. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/commands/permissions.py +0 -0
  48. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/commands/roles.py +0 -0
  49. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/commands/schemas.py +0 -0
  50. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/commands/users.py +0 -0
  51. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/commands/views.py +0 -0
  52. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/config.py +0 -0
  53. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/action.py +0 -0
  54. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/alarms.py +0 -0
  55. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/apiview.py +0 -0
  56. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/case.py +0 -0
  57. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/dag.py +0 -0
  58. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/data_check.py +0 -0
  59. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/execution.py +0 -0
  60. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/health.py +0 -0
  61. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/instance.py +0 -0
  62. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/licenses.py +0 -0
  63. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/login.py +0 -0
  64. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/main_alarms.py +0 -0
  65. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/meta_resource.py +0 -0
  66. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/permission.py +0 -0
  67. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/roles.py +0 -0
  68. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/schemas.py +0 -0
  69. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/signup.py +0 -0
  70. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/tables.py +0 -0
  71. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/token.py +0 -0
  72. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/user.py +0 -0
  73. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/endpoints/user_role.py +0 -0
  74. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/gunicorn.py +0 -0
  75. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/README +0 -0
  76. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/alembic.ini +0 -0
  77. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/env.py +0 -0
  78. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/script.py.mako +0 -0
  79. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/versions/00757b557b02_.py +0 -0
  80. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/versions/1af47a419bbd_.py +0 -0
  81. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/versions/4aac5e0c6e66_.py +0 -0
  82. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/versions/7c3ea5ab5501_.py +0 -0
  83. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/versions/991b98e24225_.py +0 -0
  84. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/versions/a472b5ad50b7_.py +0 -0
  85. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/versions/c2db9409cb5f_.py +0 -0
  86. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/versions/c8a6c762e818_.py +0 -0
  87. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/versions/ca449af8034c_.py +0 -0
  88. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/versions/d0e0700dcd8e_.py +0 -0
  89. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/versions/d1b5be1f0549_.py +0 -0
  90. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/versions/e1a50dae1ac9_.py +0 -0
  91. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/versions/e937a5234ce4_.py +0 -0
  92. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/versions/ebdd955fcc5e_.py +0 -0
  93. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/migrations/versions/f3bee20314a2_.py +0 -0
  94. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/models/__init__.py +0 -0
  95. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/models/action.py +0 -0
  96. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/models/alarms.py +0 -0
  97. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/models/base_data_model.py +0 -0
  98. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/models/case.py +0 -0
  99. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/models/dag.py +0 -0
  100. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/models/dag_permissions.py +0 -0
  101. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/models/execution.py +0 -0
  102. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/models/instance.py +0 -0
  103. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/models/main_alarms.py +0 -0
  104. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/models/meta_models.py +0 -0
  105. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/models/permissions.py +0 -0
  106. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/models/role.py +0 -0
  107. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/models/user.py +0 -0
  108. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/models/user_role.py +0 -0
  109. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/models/view.py +0 -0
  110. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/__init__.py +0 -0
  111. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/action.py +0 -0
  112. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/alarms.py +0 -0
  113. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/case.py +0 -0
  114. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/common.py +0 -0
  115. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/dag.py +0 -0
  116. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/execution.py +0 -0
  117. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/health.py +0 -0
  118. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/instance.py +0 -0
  119. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/main_alarms.py +0 -0
  120. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/model_json.py +0 -0
  121. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/patch.py +0 -0
  122. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/permissions.py +0 -0
  123. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/query.py +0 -0
  124. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/role.py +0 -0
  125. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/schemas.py +0 -0
  126. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/solution_log.py +0 -0
  127. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/tables.py +0 -0
  128. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/user.py +0 -0
  129. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/user_role.py +0 -0
  130. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/schemas/view.py +0 -0
  131. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/shared/__init__.py +0 -0
  132. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/shared/authentication/__init__.py +0 -0
  133. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/shared/authentication/auth.py +0 -0
  134. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/shared/authentication/decorators.py +0 -0
  135. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/shared/authentication/ldap.py +0 -0
  136. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/shared/compress.py +0 -0
  137. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/shared/const.py +0 -0
  138. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/shared/email.py +0 -0
  139. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/shared/exceptions.py +0 -0
  140. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/shared/licenses.py +0 -0
  141. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/shared/log_config.py +0 -0
  142. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/shared/query_tools.py +0 -0
  143. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/shared/utils.py +0 -0
  144. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/shared/utils_tables.py +0 -0
  145. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/shared/validators.py +0 -0
  146. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/__init__.py +0 -0
  147. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/const.py +0 -0
  148. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/custom_liveServer.py +0 -0
  149. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/custom_test_case.py +0 -0
  150. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/integration/__init__.py +0 -0
  151. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/integration/test_commands.py +0 -0
  152. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/integration/test_cornflowclient.py +0 -0
  153. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/ldap/__init__.py +0 -0
  154. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/ldap/test_ldap_authentication.py +0 -0
  155. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/__init__.py +0 -0
  156. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_actions.py +0 -0
  157. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_alarms.py +0 -0
  158. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_apiview.py +0 -0
  159. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_cases.py +0 -0
  160. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_commands.py +0 -0
  161. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_dags.py +0 -0
  162. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_data_checks.py +0 -0
  163. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_executions.py +0 -0
  164. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_generate_from_schema.py +0 -0
  165. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_health.py +0 -0
  166. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_instances.py +0 -0
  167. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_instances_file.py +0 -0
  168. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_licenses.py +0 -0
  169. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_log_in.py +0 -0
  170. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_main_alarms.py +0 -0
  171. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_permissions.py +0 -0
  172. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_roles.py +0 -0
  173. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_schema_from_models.py +0 -0
  174. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_schemas.py +0 -0
  175. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_sign_up.py +0 -0
  176. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_tables.py +0 -0
  177. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_token.py +0 -0
  178. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/test_users.py +0 -0
  179. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow/tests/unit/tools.py +0 -0
  180. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow.egg-info/SOURCES.txt +0 -0
  181. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow.egg-info/dependency_links.txt +0 -0
  182. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow.egg-info/entry_points.txt +0 -0
  183. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/cornflow.egg-info/top_level.txt +0 -0
  184. {cornflow-1.1.0a1 → cornflow-1.1.0a2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.2
2
2
  Name: cornflow
3
- Version: 1.1.0a1
3
+ Version: 1.1.0a2
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
@@ -4,8 +4,8 @@ All references to endpoints should be imported from here
4
4
  The login resource gets created on app startup as it depends on configuration
5
5
  """
6
6
  from .action import ActionListEndpoint
7
+ from .alarms import AlarmsEndpoint
7
8
  from .apiview import ApiViewListEndpoint
8
-
9
9
  from .case import (
10
10
  CaseEndpoint,
11
11
  CaseFromInstanceExecutionEndpoint,
@@ -15,7 +15,6 @@ from .case import (
15
15
  CaseToInstance,
16
16
  CaseCompare,
17
17
  )
18
-
19
18
  from .dag import (
20
19
  DAGDetailEndpoint,
21
20
  DAGEndpointManual,
@@ -24,7 +23,12 @@ from .dag import (
24
23
  DeployedDAGEndpoint,
25
24
  DeployedDagDetailEndpoint,
26
25
  )
27
-
26
+ from .data_check import (
27
+ DataCheckExecutionEndpoint,
28
+ DataCheckInstanceEndpoint,
29
+ DataCheckCaseEndpoint,
30
+ )
31
+ from .example_data import ExampleDataListEndpoint, ExampleDataDetailEndpoint
28
32
  from .execution import (
29
33
  ExecutionEndpoint,
30
34
  ExecutionDetailsEndpoint,
@@ -33,36 +37,22 @@ from .execution import (
33
37
  ExecutionLogEndpoint,
34
38
  ExecutionRelaunchEndpoint,
35
39
  )
36
-
37
40
  from .health import HealthEndpoint
38
-
39
41
  from .instance import (
40
42
  InstanceEndpoint,
41
43
  InstanceDetailsEndpoint,
42
44
  InstanceFileEndpoint,
43
45
  InstanceDataEndpoint,
44
46
  )
45
-
46
- from .data_check import (
47
- DataCheckExecutionEndpoint,
48
- DataCheckInstanceEndpoint,
49
- DataCheckCaseEndpoint,
50
- )
51
47
  from .licenses import LicensesEndpoint
48
+ from .main_alarms import MainAlarmsEndpoint
52
49
  from .permission import PermissionsViewRoleEndpoint, PermissionsViewRoleDetailEndpoint
53
-
54
50
  from .roles import RolesListEndpoint, RoleDetailEndpoint
55
-
56
51
  from .schemas import SchemaDetailsEndpoint, SchemaEndpoint
52
+ from .tables import TablesEndpoint, TablesDetailsEndpoint
57
53
  from .token import TokenEndpoint
58
- from .example_data import ExampleDataDetailsEndpoint
59
54
  from .user import UserEndpoint, UserDetailsEndpoint, ToggleUserAdmin, RecoverPassword
60
55
  from .user_role import UserRoleListEndpoint, UserRoleDetailEndpoint
61
- from .alarms import AlarmsEndpoint
62
- from .main_alarms import MainAlarmsEndpoint
63
-
64
- from .tables import TablesEndpoint, TablesDetailsEndpoint
65
-
66
56
 
67
57
  resources = [
68
58
  dict(resource=InstanceEndpoint, urls="/instance/", endpoint="instance"),
@@ -157,10 +147,15 @@ resources = [
157
147
  endpoint="schema-details",
158
148
  ),
159
149
  dict(
160
- resource=ExampleDataDetailsEndpoint,
150
+ resource=ExampleDataListEndpoint,
161
151
  urls="/example/<string:dag_name>/",
162
152
  endpoint="example-data",
163
153
  ),
154
+ dict(
155
+ resource=ExampleDataDetailEndpoint,
156
+ urls="/example/<string:dag_name>/<string:example_name>/",
157
+ endpoint="example-data-detail",
158
+ ),
164
159
  dict(resource=HealthEndpoint, urls="/health/", endpoint="health"),
165
160
  dict(
166
161
  resource=CaseFromInstanceExecutionEndpoint,
@@ -0,0 +1,119 @@
1
+ """
2
+ Endpoints to get the example data from a DAG
3
+ """
4
+ import json
5
+
6
+ from cornflow_client.airflow.api import Airflow
7
+ from flask import current_app, request
8
+ from flask_apispec import marshal_with, doc
9
+
10
+ from cornflow.endpoints.meta_resource import BaseMetaResource
11
+ from cornflow.models import PermissionsDAG
12
+ from cornflow.schemas.example_data import ExampleListData, ExampleDetailData
13
+ from cornflow.shared.authentication import Auth, authenticate
14
+ from cornflow.shared.const import VIEWER_ROLE, PLANNER_ROLE, ADMIN_ROLE
15
+ from cornflow.shared.exceptions import AirflowError, NoPermission, ObjectDoesNotExist
16
+
17
+
18
+ class ExampleDataListEndpoint(BaseMetaResource):
19
+ """
20
+ Endpoint used to obtain schemas for one app
21
+ """
22
+
23
+ ROLES_WITH_ACCESS = [VIEWER_ROLE, PLANNER_ROLE, ADMIN_ROLE]
24
+
25
+ @doc(description="Get lsit of example data from DAG", tags=["DAG"])
26
+ @authenticate(auth_class=Auth())
27
+ @marshal_with(ExampleListData(many=True))
28
+ def get(self, dag_name):
29
+ """
30
+ API method to get example data for a given dag
31
+
32
+ :return: A dictionary with the names and descriptions of available data examples
33
+ and an integer with the HTTP status code
34
+ :rtype: Tuple(dict, integer)
35
+ """
36
+ user = Auth().get_user_from_header(request.headers)
37
+ permission = PermissionsDAG.check_if_has_permissions(
38
+ user_id=user.id, dag_id=dag_name
39
+ )
40
+
41
+ if permission:
42
+ af_client = Airflow.from_config(current_app.config)
43
+ if not af_client.is_alive():
44
+ current_app.logger.error(
45
+ "Airflow not accessible when getting data {}".format(dag_name)
46
+ )
47
+ raise AirflowError(error="Airflow is not accessible")
48
+
49
+ # try airflow and see if dag_name exists
50
+ af_client.get_dag_info(dag_name)
51
+
52
+ current_app.logger.info("User gets example data from {}".format(dag_name))
53
+
54
+ variable_name = f"z_{dag_name}_examples"
55
+ response = af_client.get_one_variable(variable_name)
56
+
57
+ return json.loads(response["value"])
58
+ else:
59
+ err = "User does not have permission to access this dag."
60
+ raise NoPermission(
61
+ error=err,
62
+ status_code=403,
63
+ log_txt=f"Error while user {user} tries to get example data for dag {dag_name}. "
64
+ + err,
65
+ )
66
+
67
+
68
+ class ExampleDataDetailEndpoint(BaseMetaResource):
69
+ @doc(description="Get example data from DAG", tags=["DAG"])
70
+ @authenticate(auth_class=Auth())
71
+ @marshal_with(ExampleDetailData)
72
+ def get(self, dag_name, example_name):
73
+ """
74
+ API method to get one example data for a given dag
75
+
76
+ :return: A dictionary with a message and a integer with the HTTP status code
77
+ :rtype: Tuple(dict, integer)
78
+ """
79
+ user = Auth().get_user_from_header(request.headers)
80
+ permission = PermissionsDAG.check_if_has_permissions(
81
+ user_id=user.id, dag_id=dag_name
82
+ )
83
+
84
+ if permission:
85
+ af_client = Airflow.from_config(current_app.config)
86
+ if not af_client.is_alive():
87
+ current_app.logger.error(
88
+ "Airflow not accessible when getting data {}".format(dag_name)
89
+ )
90
+ raise AirflowError(error="Airflow is not accessible")
91
+
92
+ # try airflow and see if dag_name exists
93
+ af_client.get_dag_info(dag_name)
94
+
95
+ current_app.logger.info("User gets example data from {}".format(dag_name))
96
+
97
+ variable_name = f"z_{dag_name}_examples"
98
+ response = af_client.get_one_variable(variable_name)
99
+
100
+ example = None
101
+ for item in json.loads(response["value"]):
102
+ if item["name"] == example_name:
103
+ example = item
104
+ break
105
+
106
+ if example is None:
107
+ raise ObjectDoesNotExist(
108
+ error="The example does not exist", status_code=404
109
+ )
110
+
111
+ return example
112
+ else:
113
+ err = "User does not have permission to access this dag."
114
+ raise NoPermission(
115
+ error=err,
116
+ status_code=403,
117
+ log_txt=f"Error while user {user} tries to get example data for dag {dag_name}. "
118
+ + err,
119
+ )
@@ -0,0 +1,11 @@
1
+ from marshmallow import fields, Schema
2
+
3
+
4
+ class ExampleListData(Schema):
5
+ name = fields.Str(required=True)
6
+ description = fields.Str(required=False)
7
+
8
+
9
+ class ExampleDetailData(ExampleListData):
10
+ instance = fields.Raw(required=True)
11
+ solution = fields.Raw(required=False)
@@ -131,7 +131,7 @@ class CLITests(TestCase):
131
131
  result = runner.invoke(cli, ["views", "init", "-v"])
132
132
  self.assertEqual(result.exit_code, 0)
133
133
  views = ViewModel.get_all_objects().all()
134
- self.assertEqual(len(views), 48)
134
+ self.assertEqual(len(views), 49)
135
135
 
136
136
  def test_permissions_entrypoint(self):
137
137
  runner = CliRunner()
@@ -155,8 +155,8 @@ class CLITests(TestCase):
155
155
  permissions = PermissionViewRoleModel.get_all_objects().all()
156
156
  self.assertEqual(len(actions), 5)
157
157
  self.assertEqual(len(roles), 4)
158
- self.assertEqual(len(views), 48)
159
- self.assertEqual(len(permissions), 530)
158
+ self.assertEqual(len(views), 49)
159
+ self.assertEqual(len(permissions), 546)
160
160
 
161
161
  def test_permissions_base_command(self):
162
162
  runner = CliRunner()
@@ -171,8 +171,8 @@ class CLITests(TestCase):
171
171
  permissions = PermissionViewRoleModel.get_all_objects().all()
172
172
  self.assertEqual(len(actions), 5)
173
173
  self.assertEqual(len(roles), 4)
174
- self.assertEqual(len(views), 48)
175
- self.assertEqual(len(permissions), 530)
174
+ self.assertEqual(len(views), 49)
175
+ self.assertEqual(len(permissions), 546)
176
176
 
177
177
  def test_service_entrypoint(self):
178
178
  runner = CliRunner()
@@ -0,0 +1,124 @@
1
+ import json
2
+
3
+
4
+ from unittest.mock import patch
5
+
6
+ from cornflow.models import PermissionsDAG
7
+ from cornflow.tests.const import EXAMPLE_URL, INSTANCE_PATH
8
+ from cornflow.tests.custom_test_case import CustomTestCase
9
+
10
+
11
+ class TestExampleDataEndpoint(CustomTestCase):
12
+ def setUp(self):
13
+ super().setUp()
14
+
15
+ def load_file(_file):
16
+ with open(_file) as f:
17
+ temp = json.load(f)
18
+ return temp
19
+
20
+ self.example = [
21
+ {
22
+ "name": "test_example_1",
23
+ "description": "some_description",
24
+ "instance": load_file(INSTANCE_PATH),
25
+ },
26
+ {
27
+ "name": "test_example_2",
28
+ "description": "some_description",
29
+ "instance": load_file(INSTANCE_PATH),
30
+ },
31
+ ]
32
+ self.url = EXAMPLE_URL
33
+ self.schema_name = "solve_model_dag"
34
+
35
+ def patch_af_client(self, Airflow_mock):
36
+ af_client = Airflow_mock.return_value
37
+ af_client.is_alive.return_value = True
38
+ af_client.get_dag_info.return_value = {}
39
+ af_client.get_one_variable.return_value = {
40
+ "value": json.dumps(self.example),
41
+ "key": self.schema_name,
42
+ }
43
+ af_client.get_all_schemas.return_value = [{"name": self.schema_name}]
44
+ return af_client
45
+
46
+ def patch_af_client_not_alive(self, Airflow_mock):
47
+ af_client = Airflow_mock.return_value
48
+ af_client.is_alive.return_value = False
49
+ af_client.is_alive.return_value = False
50
+ return af_client
51
+
52
+ @patch("cornflow.endpoints.example_data.Airflow.from_config")
53
+ def test_get_list_of_examples(self, airflow_init):
54
+ af_client = self.patch_af_client(airflow_init)
55
+ examples = self.get_one_row(
56
+ f"{self.url}/{self.schema_name}/",
57
+ {},
58
+ expected_status=200,
59
+ check_payload=False,
60
+ )
61
+
62
+ for pos, item in enumerate(examples):
63
+ self.assertIn("name", item)
64
+ self.assertEqual(self.example[pos]["name"], item["name"])
65
+ self.assertIn("description", item)
66
+ self.assertEqual(self.example[pos]["description"], item["description"])
67
+
68
+ @patch("cornflow.endpoints.example_data.Airflow.from_config")
69
+ def test_get_one_example(self, airflow_init):
70
+ def load_file(_file):
71
+ with open(_file) as f:
72
+ temp = json.load(f)
73
+ return temp
74
+
75
+ af_client = self.patch_af_client(airflow_init)
76
+ keys_to_check = ["name", "examples"]
77
+ example = self.get_one_row(
78
+ f"{self.url}/{self.schema_name}/test_example_1/",
79
+ {},
80
+ expected_status=200,
81
+ check_payload=False,
82
+ keys_to_check=keys_to_check,
83
+ )
84
+
85
+ self.assertIn("name", example)
86
+ self.assertEqual("test_example_1", example["name"])
87
+ self.assertIn("description", example)
88
+ self.assertIn("instance", example)
89
+ self.assertEqual(load_file(INSTANCE_PATH), example["instance"])
90
+
91
+ @patch("cornflow.endpoints.example_data.Airflow.from_config")
92
+ def test_airflow_not_available(self, airflow_init):
93
+ af_client = self.patch_af_client_not_alive(airflow_init)
94
+ self.get_one_row(
95
+ f"{self.url}/{self.schema_name}/test_example_1/",
96
+ {},
97
+ expected_status=400,
98
+ check_payload=False,
99
+ )
100
+
101
+ self.get_one_row(
102
+ f"{self.url}/{self.schema_name}/",
103
+ {},
104
+ expected_status=400,
105
+ check_payload=False,
106
+ )
107
+
108
+ def test_if_no_permission(self):
109
+ with patch.object(
110
+ PermissionsDAG, "check_if_has_permissions", return_value=False
111
+ ) as mock_permission:
112
+ self.get_one_row(
113
+ f"{self.url}/{self.schema_name}/",
114
+ {},
115
+ expected_status=403,
116
+ check_payload=False,
117
+ )
118
+
119
+ self.get_one_row(
120
+ f"{self.url}/{self.schema_name}/test_example_1/",
121
+ {},
122
+ expected_status=403,
123
+ check_payload=False,
124
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.2
2
2
  Name: cornflow
3
- Version: 1.1.0a1
3
+ Version: 1.1.0a2
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
@@ -1,7 +1,7 @@
1
1
  alembic==1.9.2
2
2
  apispec<=6.2.0
3
3
  click<=8.1.3
4
- cornflow-client==1.1.0a1
4
+ cornflow-client==1.1.0a2
5
5
  cryptography<=42.0.5
6
6
  disposable-email-domains>=0.0.86
7
7
  Flask==2.3.2
@@ -9,7 +9,7 @@ with open("requirements.txt", "r") as fh:
9
9
 
10
10
  setuptools.setup(
11
11
  name="cornflow",
12
- version="1.1.0a1",
12
+ version="1.1.0a2",
13
13
  author="baobab soluciones",
14
14
  author_email="cornflow@baobabsoluciones.es",
15
15
  description="Cornflow is an open source multi-solver optimization server with a REST API built using flask.",
@@ -1,68 +0,0 @@
1
- """
2
- Endpoints to get the example data from a DAG
3
- """
4
-
5
- # Import from libraries
6
- from cornflow_client.airflow.api import Airflow
7
- from flask import current_app, request
8
- from flask_apispec import marshal_with, doc
9
- import json
10
-
11
- # Import from internal modules
12
- from cornflow.endpoints.meta_resource import BaseMetaResource
13
- from cornflow.models import PermissionsDAG
14
- from cornflow.schemas.example_data import ExampleData
15
- from cornflow.shared.authentication import Auth, authenticate
16
- from cornflow.shared.const import VIEWER_ROLE, PLANNER_ROLE, ADMIN_ROLE
17
- from cornflow.shared.exceptions import AirflowError, NoPermission
18
-
19
-
20
- class ExampleDataDetailsEndpoint(BaseMetaResource):
21
- """
22
- Endpoint used to obtain schemas for one app
23
- """
24
-
25
- ROLES_WITH_ACCESS = [VIEWER_ROLE, PLANNER_ROLE, ADMIN_ROLE]
26
-
27
- @doc(description="Get example data from DAG", tags=["DAG"])
28
- @authenticate(auth_class=Auth())
29
- @marshal_with(ExampleData)
30
- def get(self, dag_name):
31
- """
32
- API method to get example data for a given dag
33
-
34
- :return: A dictionary with a message and a integer with the HTTP status code
35
- :rtype: Tuple(dict, integer)
36
- """
37
- user = Auth().get_user_from_header(request.headers)
38
- permission = PermissionsDAG.check_if_has_permissions(
39
- user_id=user.id, dag_id=dag_name
40
- )
41
-
42
- if permission:
43
- af_client = Airflow.from_config(current_app.config)
44
- if not af_client.is_alive():
45
- current_app.logger.error(
46
- "Airflow not accessible when getting data {}".format(dag_name)
47
- )
48
- raise AirflowError(error="Airflow is not accessible")
49
-
50
- # try airflow and see if dag_name exists
51
- af_client.get_dag_info(dag_name)
52
-
53
- current_app.logger.info("User gets example data from {}".format(dag_name))
54
-
55
- variable_name = f"z_{dag_name}_examples"
56
- response = af_client.get_one_variable(variable_name)
57
- result = dict()
58
- result["examples"] = json.loads(response["value"])
59
- result["name"] = response["key"]
60
-
61
- return result
62
- else:
63
- err = "User does not have permission to access this dag."
64
- raise NoPermission(
65
- error=err,
66
- status_code=403,
67
- log_txt=f"Error while user {user} tries to get example data for dag {dag_name}. " + err
68
- )
@@ -1,6 +0,0 @@
1
- from marshmallow import fields, Schema
2
-
3
-
4
- class ExampleData(Schema):
5
- name = fields.Str(required=True)
6
- examples = fields.Raw(required=True)
@@ -1,54 +0,0 @@
1
- """
2
-
3
- """
4
-
5
- # General imports
6
- import json
7
-
8
- # Partial imports
9
- from unittest.mock import patch
10
-
11
-
12
- # Imports from internal modules
13
- from cornflow.tests.const import EXAMPLE_URL, INSTANCE_PATH
14
- from cornflow.tests.custom_test_case import CustomTestCase
15
-
16
-
17
- class TestExampleDataEndpoint(CustomTestCase):
18
- def setUp(self):
19
- super().setUp()
20
-
21
- def load_file(_file):
22
- with open(_file) as f:
23
- temp = json.load(f)
24
- return temp
25
-
26
- self.example = load_file(INSTANCE_PATH)
27
- self.url = EXAMPLE_URL
28
- self.schema_name = "solve_model_dag"
29
-
30
- def patch_af_client(self, Airflow_mock):
31
- af_client = Airflow_mock.return_value
32
- af_client.is_alive.return_value = True
33
- af_client.get_dag_info.return_value = {}
34
- af_client.get_one_variable.return_value = {
35
- "value": json.dumps(self.example),
36
- "key": self.schema_name,
37
- }
38
- af_client.get_all_schemas.return_value = [{"name": self.schema_name}]
39
- return af_client
40
-
41
- @patch("cornflow.endpoints.example_data.Airflow.from_config")
42
- def test_get_example(self, airflow_init):
43
- af_client = self.patch_af_client(airflow_init)
44
- keys_to_check = ["name", "examples"]
45
- example = self.get_one_row(
46
- self.url + "{}/".format(self.schema_name),
47
- {},
48
- expected_status=200,
49
- check_payload=False,
50
- keys_to_check=keys_to_check,
51
- )
52
- self.assertIn("examples", example)
53
- self.assertIn("name", example)
54
- self.assertEqual(example["examples"], self.example)
File without changes
File without changes
File without changes