mage-ai 0.9.44__py3-none-any.whl → 0.9.46__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.
Potentially problematic release.
This version of mage-ai might be problematic. Click here for more details.
- mage_ai/api/constants.py +2 -0
- mage_ai/api/operations/base.py +208 -12
- mage_ai/api/policies/BasePolicy.py +3 -3
- mage_ai/api/policies/ComputeClusterPolicy.py +96 -0
- mage_ai/api/policies/ComputeConnectionPolicy.py +74 -0
- mage_ai/api/policies/ComputeServicePolicy.py +50 -0
- mage_ai/api/policies/DownloadPolicy.py +29 -0
- mage_ai/api/policies/GitCustomBranchPolicy.py +1 -0
- mage_ai/api/policies/GlobalHookPolicy.py +126 -0
- mage_ai/api/policies/OauthPolicy.py +56 -7
- mage_ai/api/policies/ProjectPolicy.py +1 -0
- mage_ai/api/policies/RolePolicy.py +12 -1
- mage_ai/api/presenters/ComputeClusterPresenter.py +19 -0
- mage_ai/api/presenters/ComputeConnectionPresenter.py +26 -0
- mage_ai/api/presenters/ComputeServicePresenter.py +15 -0
- mage_ai/api/presenters/DownloadPresenter.py +13 -0
- mage_ai/api/presenters/GlobalHookPresenter.py +74 -0
- mage_ai/api/presenters/OauthPresenter.py +1 -0
- mage_ai/api/presenters/PipelinePresenter.py +1 -0
- mage_ai/api/presenters/ProjectPresenter.py +1 -0
- mage_ai/api/presenters/SparkApplicationPresenter.py +2 -0
- mage_ai/api/presenters/WorkspacePresenter.py +22 -22
- mage_ai/api/resources/AsyncBaseResource.py +39 -0
- mage_ai/api/resources/BackfillResource.py +1 -0
- mage_ai/api/resources/BlockResource.py +57 -0
- mage_ai/api/resources/ClusterResource.py +1 -1
- mage_ai/api/resources/ComputeClusterResource.py +109 -0
- mage_ai/api/resources/ComputeConnectionResource.py +103 -0
- mage_ai/api/resources/ComputeServiceResource.py +35 -0
- mage_ai/api/resources/DownloadResource.py +56 -0
- mage_ai/api/resources/ExecutionStateResource.py +1 -1
- mage_ai/api/resources/GitBranchResource.py +35 -29
- mage_ai/api/resources/GitCustomBranchResource.py +9 -0
- mage_ai/api/resources/GlobalHookResource.py +192 -0
- mage_ai/api/resources/KernelResource.py +10 -0
- mage_ai/api/resources/OauthResource.py +60 -98
- mage_ai/api/resources/PipelineResource.py +4 -4
- mage_ai/api/resources/PipelineScheduleResource.py +37 -16
- mage_ai/api/resources/ProjectResource.py +5 -3
- mage_ai/api/resources/SessionResource.py +24 -9
- mage_ai/api/resources/SparkApplicationResource.py +5 -5
- mage_ai/api/resources/SparkEnvironmentResource.py +1 -2
- mage_ai/api/resources/SparkExecutorResource.py +1 -2
- mage_ai/api/resources/SparkJobResource.py +3 -6
- mage_ai/api/resources/SparkSqlResource.py +6 -11
- mage_ai/api/resources/SparkStageAttemptResource.py +2 -3
- mage_ai/api/resources/SparkStageAttemptTaskResource.py +1 -2
- mage_ai/api/resources/SparkStageAttemptTaskSummaryResource.py +1 -2
- mage_ai/api/resources/SparkStageResource.py +3 -6
- mage_ai/api/resources/SparkThreadResource.py +1 -2
- mage_ai/api/resources/UserResource.py +32 -31
- mage_ai/api/resources/mixins/spark.py +25 -4
- mage_ai/authentication/oauth/constants.py +4 -0
- mage_ai/authentication/oauth2.py +1 -3
- mage_ai/authentication/permissions/constants.py +4 -0
- mage_ai/authentication/providers/__init__.py +0 -0
- mage_ai/authentication/providers/active_directory.py +136 -0
- mage_ai/authentication/providers/constants.py +17 -0
- mage_ai/authentication/providers/ghe.py +81 -0
- mage_ai/authentication/providers/google.py +86 -0
- mage_ai/authentication/providers/oauth.py +60 -0
- mage_ai/authentication/providers/okta.py +101 -0
- mage_ai/authentication/providers/sso.py +20 -0
- mage_ai/authentication/providers/utils.py +12 -0
- mage_ai/cluster_manager/aws/emr_cluster_manager.py +2 -1
- mage_ai/cluster_manager/workspace/base.py +7 -3
- mage_ai/data_integrations/destinations/constants.py +2 -0
- mage_ai/data_preparation/executors/block_executor.py +3 -0
- mage_ai/data_preparation/executors/pipeline_executor.py +9 -0
- mage_ai/data_preparation/git/__init__.py +3 -3
- mage_ai/data_preparation/git/api.py +69 -35
- mage_ai/data_preparation/models/block/__init__.py +95 -60
- mage_ai/data_preparation/models/block/data_integration/data.py +1 -1
- mage_ai/data_preparation/models/block/dbt/block_sql.py +95 -1
- mage_ai/data_preparation/models/block/dbt/utils.py +6 -0
- mage_ai/data_preparation/models/block/spark/mixins.py +82 -34
- mage_ai/data_preparation/models/download/__init__.py +8 -0
- mage_ai/data_preparation/models/global_hooks/__init__.py +0 -0
- mage_ai/data_preparation/models/global_hooks/constants.py +44 -0
- mage_ai/data_preparation/models/global_hooks/models.py +928 -0
- mage_ai/data_preparation/models/global_hooks/utils.py +21 -0
- mage_ai/data_preparation/models/pipeline.py +82 -6
- mage_ai/data_preparation/models/pipelines/models.py +16 -0
- mage_ai/data_preparation/models/project/__init__.py +6 -0
- mage_ai/data_preparation/models/project/constants.py +1 -0
- mage_ai/data_preparation/models/project/models.py +12 -0
- mage_ai/data_preparation/repo_manager.py +23 -1
- mage_ai/data_preparation/templates/callbacks/base.jinja +4 -0
- mage_ai/data_preparation/templates/data_exporters/streaming/kafka.yaml +1 -0
- mage_ai/data_preparation/templates/data_loaders/streaming/activemq.yaml +6 -0
- mage_ai/data_preparation/templates/data_loaders/streaming/kafka.yaml +1 -0
- mage_ai/data_preparation/templates/data_loaders/streaming/nats.yaml +20 -0
- mage_ai/data_preparation/templates/repo/io_config.yaml +2 -2
- mage_ai/io/duckdb.py +0 -1
- mage_ai/orchestration/concurrency.py +8 -1
- mage_ai/orchestration/db/models/schedules.py +23 -2
- mage_ai/orchestration/pipeline_scheduler.py +168 -105
- mage_ai/orchestration/queue/process_queue.py +9 -1
- mage_ai/orchestration/triggers/api.py +11 -3
- mage_ai/orchestration/triggers/constants.py +1 -0
- mage_ai/orchestration/triggers/utils.py +23 -0
- mage_ai/server/active_kernel.py +37 -4
- mage_ai/server/api/downloads.py +76 -1
- mage_ai/server/api/triggers.py +1 -0
- mage_ai/server/constants.py +1 -1
- mage_ai/server/frontend_dist/404.html +2 -2
- mage_ai/server/frontend_dist/_next/static/9jB4XPuz6BzxBcG9VNao5/_buildManifest.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/1749-9a6276b2918fdae1.js +1 -0
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/7519-8c29bbb92e03cc77.js → frontend_dist/_next/static/chunks/1845-5ce774d5ab81ed57.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/1952-ac7722e8b1ab88fe.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/3419-f8d518d024e7b5c8.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/4267-fd4d8049e83178de.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/4366-93e09e5a4a7e182c.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/5457-949640f4037bf12f.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/5499-76cf8f023c6b0985.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/553-7f7919e14392ca67.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/5638-a65610405a70961c.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/5810-12eadc488265d55b.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/5820-28adeabb5cda2b96.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/595-0d174b1f9fbfce4f.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/600-705fe234320ec5de.js +1 -0
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/3122-f27de34d0b5426af.js → frontend_dist/_next/static/chunks/6285-e9b45335bfb9ccaf.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/6333-bc1b433b428a9095.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{5397-b5f2e477acc6bd6b.js → 6965-c613d1834c8ed92d.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{7022-18fde36eb46e1d65.js → 7022-070ec0144a4d029c.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/722-a1584445357a276c.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{7858-c83d25349d0e980f.js → 7858-d9df72e95e438284.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/8264-0d582a6ca33c3dfa.js +1 -0
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/3684-cbda680fd8927d07.js → frontend_dist/_next/static/chunks/8432-f191e39f9b5893f2.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/90-a7308bae028d7001.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/9264-1d4f0327d42fed91.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/9618-2c5045255ac5a6e7.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{976-27c4eed1c9b20c44.js → 976-18c98af60b76f1a7.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/framework-22b71764bf44ede4.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/_app-ebef928183f9a3bb.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/block-layout-a24cb24b6f08bbc9.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/compute-419775ca1293b354.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/files-0f2d4be6fdca86ca.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/global-data-products/{[...slug]-3f6fc312f67ff72e.js → [...slug]-cfd68e760ae00958.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{global-data-products-f4cd03036c3e8723.js → global-data-products-c3b79ef31007f95b.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/global-hooks/[...slug]-77edfa32d000e88b.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/global-hooks-e561ae38cf5592e8.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/files-449a022f2f0f2d94.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/settings-60845f0b59142f32.js +1 -0
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/pages/manage/users/[user]-1d9b298fdceabbf1.js → frontend_dist/_next/static/chunks/pages/manage/users/[user]-9384c5f1efa2ac18.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users/new-abd8571907664fdf.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/{users-a7c970122a10afdc.js → users-28a930b148d99766.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage-f83deb790548693b.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/oauth-8bb62c4f6a511c43.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/overview-f0c40645f385f23f.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{pipeline-runs-c79819d6826e5416.js → pipeline-runs-b35d37bfba8fbccc.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills/[...slug]-10e9a2d19541caa2.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills-c8d3a5289ab93f88.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/dashboard-571c0962333b92f0.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-ff7e9108502f5716.js +1 -0
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/logs-a52d2d3e0c2978f4.js → frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/logs-ef680455ae54ccbe.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors/block-runs-ddddcddd2f74b4f6.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors/block-runtime-4a238307feddb522.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors-e051057d9fe94f23.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/runs/{[run]-4977276c8f84b5f4.js → [run]-0691711636fa95c7.js} +1 -1
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/runs-ce717786f31e8f04.js → frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/runs-2d20b2cd08907afd.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/settings-2914e326a5f1ffe0.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/syncs-b75bf17498e87354.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers/[...slug]-3a7500e6e53084d3.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers-c0e551d265a8d467.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/{[pipeline]-35fe7762cb83a733.js → [pipeline]-02c843b9c8418bb5.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines-e47db5c3eaf683af.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/account/profile-55ac955dfa9a5a8d.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/permissions/{[...slug]-d6a62284c7c99cb3.js → [...slug]-b78b1be5b9ed84b9.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/{permissions-b1389695f758c32b.js → permissions-37b78a436eeab258.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/preferences-29c92a9bc54ae5cd.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/roles/{[...slug]-0bdb66265286ab22.js → [...slug]-db05a80d18c168e5.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/{roles-e04e18fc295ca76a.js → roles-f55c77e4f46c8d33.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/sync-data-2a1f8737561fdd94.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/users/{[...slug]-0267358c91122109.js → [...slug]-e3bf6e5d8bb250c4.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/{users-50fed18bb9b8d142.js → users-20f0a050a42a015d.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{settings-56f83205752b1323.js → settings-0f0121db7f5ff93d.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/sign-in-99e2748e3c1d57a3.js +1 -0
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/pages/templates/[...slug]-9370551ffa462144.js → frontend_dist/_next/static/chunks/pages/templates/[...slug]-f44ccd1499ffd23a.js} +1 -1
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/pages/templates-3cff90df13a1a755.js → frontend_dist/_next/static/chunks/pages/templates-1bfaa1c50e844813.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/terminal-ed121e305169cf1c.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/test-9ae68758102cc843.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{triggers-ffaab4c013e62ba1.js → triggers-572d82d6eb7a5d43.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/version-control-2d26d80370a2e481.js +1 -0
- mage_ai/server/frontend_dist/block-layout.html +2 -2
- mage_ai/server/frontend_dist/compute.html +5 -5
- mage_ai/server/frontend_dist/files.html +5 -5
- mage_ai/server/frontend_dist/global-data-products/[...slug].html +5 -5
- mage_ai/server/frontend_dist/global-data-products.html +5 -5
- mage_ai/server/frontend_dist/global-hooks/[...slug].html +24 -0
- mage_ai/server/frontend_dist/global-hooks.html +24 -0
- mage_ai/server/frontend_dist/index.html +2 -2
- mage_ai/server/frontend_dist/manage/files.html +5 -5
- mage_ai/server/frontend_dist/manage/settings.html +5 -5
- mage_ai/server/frontend_dist/manage/users/[user].html +5 -5
- mage_ai/server/frontend_dist/manage/users/new.html +5 -5
- mage_ai/server/frontend_dist/manage/users.html +5 -5
- mage_ai/server/frontend_dist/manage.html +5 -5
- mage_ai/server/frontend_dist/oauth.html +4 -4
- mage_ai/server/frontend_dist/overview.html +5 -5
- mage_ai/server/frontend_dist/pipeline-runs.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/backfills/[...slug].html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/backfills.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/dashboard.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/edit.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/logs.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors/block-runs.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors/block-runtime.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/runs/[run].html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/runs.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/settings.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/syncs.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/triggers/[...slug].html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline]/triggers.html +5 -5
- mage_ai/server/frontend_dist/pipelines/[pipeline].html +2 -2
- mage_ai/server/frontend_dist/pipelines.html +5 -5
- mage_ai/server/frontend_dist/settings/account/profile.html +5 -5
- mage_ai/server/frontend_dist/settings/workspace/permissions/[...slug].html +5 -5
- mage_ai/server/frontend_dist/settings/workspace/permissions.html +5 -5
- mage_ai/server/frontend_dist/settings/workspace/preferences.html +5 -5
- mage_ai/server/frontend_dist/settings/workspace/roles/[...slug].html +5 -5
- mage_ai/server/frontend_dist/settings/workspace/roles.html +5 -5
- mage_ai/server/frontend_dist/settings/workspace/sync-data.html +5 -5
- mage_ai/server/frontend_dist/settings/workspace/users/[...slug].html +5 -5
- mage_ai/server/frontend_dist/settings/workspace/users.html +5 -5
- mage_ai/server/frontend_dist/settings.html +2 -2
- mage_ai/server/frontend_dist/sign-in.html +17 -17
- mage_ai/server/frontend_dist/templates/[...slug].html +5 -5
- mage_ai/server/frontend_dist/templates.html +5 -5
- mage_ai/server/frontend_dist/terminal.html +5 -5
- mage_ai/server/frontend_dist/test.html +15 -15
- mage_ai/server/frontend_dist/triggers.html +5 -5
- mage_ai/server/frontend_dist/version-control.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/404.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/1749-9a6276b2918fdae1.js +1 -0
- mage_ai/server/{frontend_dist/_next/static/chunks/7519-8c29bbb92e03cc77.js → frontend_dist_base_path_template/_next/static/chunks/1845-5ce774d5ab81ed57.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/1952-ac7722e8b1ab88fe.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/3419-f8d518d024e7b5c8.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/4267-fd4d8049e83178de.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/4366-93e09e5a4a7e182c.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/5457-949640f4037bf12f.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/5499-76cf8f023c6b0985.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/553-7f7919e14392ca67.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/5638-a65610405a70961c.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/5810-12eadc488265d55b.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/5820-28adeabb5cda2b96.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/595-0d174b1f9fbfce4f.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/600-705fe234320ec5de.js +1 -0
- mage_ai/server/{frontend_dist/_next/static/chunks/3122-f27de34d0b5426af.js → frontend_dist_base_path_template/_next/static/chunks/6285-e9b45335bfb9ccaf.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/6333-bc1b433b428a9095.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/{5397-b5f2e477acc6bd6b.js → 6965-c613d1834c8ed92d.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/{7022-18fde36eb46e1d65.js → 7022-070ec0144a4d029c.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/722-a1584445357a276c.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/{7858-c83d25349d0e980f.js → 7858-d9df72e95e438284.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/8264-0d582a6ca33c3dfa.js +1 -0
- mage_ai/server/{frontend_dist/_next/static/chunks/3684-cbda680fd8927d07.js → frontend_dist_base_path_template/_next/static/chunks/8432-f191e39f9b5893f2.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/90-a7308bae028d7001.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/9264-1d4f0327d42fed91.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/9618-2c5045255ac5a6e7.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/{976-27c4eed1c9b20c44.js → 976-18c98af60b76f1a7.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/framework-22b71764bf44ede4.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/_app-ebef928183f9a3bb.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/block-layout-a24cb24b6f08bbc9.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/compute-419775ca1293b354.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/files-0f2d4be6fdca86ca.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/global-data-products/{[...slug]-3f6fc312f67ff72e.js → [...slug]-cfd68e760ae00958.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/{global-data-products-f4cd03036c3e8723.js → global-data-products-c3b79ef31007f95b.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/global-hooks/[...slug]-77edfa32d000e88b.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/global-hooks-e561ae38cf5592e8.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/manage/files-449a022f2f0f2d94.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/manage/settings-60845f0b59142f32.js +1 -0
- mage_ai/server/{frontend_dist/_next/static/chunks/pages/manage/users/[user]-1d9b298fdceabbf1.js → frontend_dist_base_path_template/_next/static/chunks/pages/manage/users/[user]-9384c5f1efa2ac18.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/manage/users/new-abd8571907664fdf.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/manage/{users-a7c970122a10afdc.js → users-28a930b148d99766.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/manage-f83deb790548693b.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/oauth-8bb62c4f6a511c43.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/overview-f0c40645f385f23f.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/{pipeline-runs-c79819d6826e5416.js → pipeline-runs-b35d37bfba8fbccc.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/backfills/[...slug]-10e9a2d19541caa2.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/backfills-c8d3a5289ab93f88.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/dashboard-571c0962333b92f0.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/edit-ff7e9108502f5716.js +1 -0
- mage_ai/server/{frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/logs-a52d2d3e0c2978f4.js → frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/logs-ef680455ae54ccbe.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/monitors/block-runs-ddddcddd2f74b4f6.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/monitors/block-runtime-4a238307feddb522.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/monitors-e051057d9fe94f23.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/runs/{[run]-4977276c8f84b5f4.js → [run]-0691711636fa95c7.js} +1 -1
- mage_ai/server/{frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/runs-ce717786f31e8f04.js → frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/runs-2d20b2cd08907afd.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/settings-2914e326a5f1ffe0.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/syncs-b75bf17498e87354.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/triggers/[...slug]-3a7500e6e53084d3.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/triggers-c0e551d265a8d467.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/{[pipeline]-35fe7762cb83a733.js → [pipeline]-02c843b9c8418bb5.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines-e47db5c3eaf683af.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/account/profile-55ac955dfa9a5a8d.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/permissions/{[...slug]-d6a62284c7c99cb3.js → [...slug]-b78b1be5b9ed84b9.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/{permissions-b1389695f758c32b.js → permissions-37b78a436eeab258.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/preferences-29c92a9bc54ae5cd.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/roles/{[...slug]-0bdb66265286ab22.js → [...slug]-db05a80d18c168e5.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/{roles-e04e18fc295ca76a.js → roles-f55c77e4f46c8d33.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/sync-data-2a1f8737561fdd94.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/users/{[...slug]-0267358c91122109.js → [...slug]-e3bf6e5d8bb250c4.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/{users-50fed18bb9b8d142.js → users-20f0a050a42a015d.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/{settings-56f83205752b1323.js → settings-0f0121db7f5ff93d.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/sign-in-99e2748e3c1d57a3.js +1 -0
- mage_ai/server/{frontend_dist/_next/static/chunks/pages/templates/[...slug]-9370551ffa462144.js → frontend_dist_base_path_template/_next/static/chunks/pages/templates/[...slug]-f44ccd1499ffd23a.js} +1 -1
- mage_ai/server/{frontend_dist/_next/static/chunks/pages/templates-3cff90df13a1a755.js → frontend_dist_base_path_template/_next/static/chunks/pages/templates-1bfaa1c50e844813.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/terminal-ed121e305169cf1c.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/test-9ae68758102cc843.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/{triggers-ffaab4c013e62ba1.js → triggers-572d82d6eb7a5d43.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/version-control-2d26d80370a2e481.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/uPDjJYpJMst1q6psbRyte/_buildManifest.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/block-layout.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/compute.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/files.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/global-data-products/[...slug].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/global-data-products.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/global-hooks/[...slug].html +24 -0
- mage_ai/server/frontend_dist_base_path_template/global-hooks.html +24 -0
- mage_ai/server/frontend_dist_base_path_template/index.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/manage/files.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/manage/settings.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/manage/users/[user].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/manage/users/new.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/manage/users.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/manage.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/oauth.html +3 -3
- mage_ai/server/frontend_dist_base_path_template/overview.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipeline-runs.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/backfills/[...slug].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/backfills.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/dashboard.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/edit.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/logs.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/monitors/block-runs.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/monitors/block-runtime.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/monitors.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/runs/[run].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/runs.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/settings.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/syncs.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/triggers/[...slug].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/triggers.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/account/profile.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/permissions/[...slug].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/permissions.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/preferences.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/roles/[...slug].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/roles.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/sync-data.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/users/[...slug].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/users.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/settings.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/sign-in.html +9 -9
- mage_ai/server/frontend_dist_base_path_template/templates/[...slug].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/templates.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/terminal.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/test.html +14 -14
- mage_ai/server/frontend_dist_base_path_template/triggers.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/version-control.html +2 -2
- mage_ai/server/server.py +43 -15
- mage_ai/server/utils/output_display.py +6 -0
- mage_ai/server/websocket_server.py +14 -0
- mage_ai/services/aws/ecs/config.py +11 -8
- mage_ai/services/aws/emr/config.py +1 -0
- mage_ai/services/aws/emr/constants.py +1 -0
- mage_ai/services/aws/emr/emr.py +20 -7
- mage_ai/services/compute/__init__.py +0 -0
- mage_ai/services/compute/aws/__init__.py +0 -0
- mage_ai/services/compute/aws/constants.py +21 -0
- mage_ai/services/compute/aws/models.py +459 -0
- mage_ai/services/compute/aws/steps.py +482 -0
- mage_ai/services/compute/constants.py +27 -0
- mage_ai/services/compute/models.py +212 -0
- mage_ai/services/k8s/job_manager.py +3 -0
- mage_ai/services/spark/api/aws_emr.py +38 -0
- mage_ai/services/spark/api/base.py +7 -4
- mage_ai/services/spark/api/constants.py +4 -0
- mage_ai/services/spark/api/local.py +25 -24
- mage_ai/services/spark/api/service.py +15 -5
- mage_ai/services/spark/constants.py +1 -1
- mage_ai/services/spark/models/applications.py +45 -3
- mage_ai/services/spark/models/base.py +3 -19
- mage_ai/services/spark/models/environments.py +16 -11
- mage_ai/services/spark/models/executors.py +2 -2
- mage_ai/services/spark/models/sqls.py +46 -15
- mage_ai/services/spark/models/stages.py +55 -32
- mage_ai/services/spark/models/threads.py +2 -2
- mage_ai/services/spark/utils.py +22 -6
- mage_ai/services/ssh/__init__.py +0 -0
- mage_ai/services/ssh/aws/__init__.py +0 -0
- mage_ai/services/ssh/aws/emr/__init__.py +0 -0
- mage_ai/services/ssh/aws/emr/constants.py +10 -0
- mage_ai/services/ssh/aws/emr/models.py +326 -0
- mage_ai/services/ssh/aws/emr/utils.py +151 -0
- mage_ai/settings/__init__.py +16 -1
- mage_ai/settings/secret_generation.py +7 -0
- mage_ai/settings/sso.py +20 -0
- mage_ai/shared/hash.py +17 -1
- mage_ai/shared/models.py +253 -0
- mage_ai/streaming/constants.py +2 -0
- mage_ai/streaming/sources/activemq.py +89 -0
- mage_ai/streaming/sources/nats_js.py +182 -0
- mage_ai/streaming/sources/source_factory.py +8 -0
- mage_ai/tests/ai/test_ai_functions.py +53 -8
- mage_ai/tests/api/endpoints/test_oauths.py +33 -0
- mage_ai/tests/api/endpoints/test_projects.py +1 -0
- mage_ai/tests/api/endpoints/test_workspaces.py +55 -0
- mage_ai/tests/api/operations/test_base.py +7 -5
- mage_ai/tests/api/operations/test_operations.py +0 -1
- mage_ai/tests/api/operations/test_operations_with_hooks.py +577 -0
- mage_ai/tests/api/operations/test_syncs.py +0 -1
- mage_ai/tests/api/operations/test_users.py +13 -2
- mage_ai/tests/data_preparation/executors/test_block_executor.py +1 -0
- mage_ai/tests/data_preparation/models/global_hooks/__init__.py +0 -0
- mage_ai/tests/data_preparation/models/global_hooks/test_global_hooks.py +575 -0
- mage_ai/tests/data_preparation/models/global_hooks/test_hook.py +760 -0
- mage_ai/tests/data_preparation/models/global_hooks/test_utils.py +33 -0
- mage_ai/tests/data_preparation/models/test_pipeline.py +5 -0
- mage_ai/tests/data_preparation/test_repo_manager.py +11 -0
- mage_ai/tests/data_preparation/test_templates.py +1 -0
- mage_ai/tests/factory.py +132 -10
- mage_ai/tests/orchestration/queue/test_process_queue.py +15 -2
- mage_ai/tests/orchestration/test_pipeline_scheduler.py +447 -79
- mage_ai/tests/services/aws/ecs/__init__.py +0 -0
- mage_ai/tests/services/aws/ecs/test_config.py +144 -0
- mage_ai/tests/services/k8s/test_job_manager.py +22 -1
- mage_ai/tests/shared/mixins.py +291 -0
- mage_ai/tests/shared/test_hash.py +17 -1
- mage_ai/tests/streaming/sources/test_activemq.py +32 -0
- mage_ai/tests/streaming/sources/test_nats_js.py +32 -0
- mage_ai/tests/streaming/sources/test_source_factory.py +26 -1
- {mage_ai-0.9.44.dist-info → mage_ai-0.9.46.dist-info}/METADATA +28 -66
- {mage_ai-0.9.44.dist-info → mage_ai-0.9.46.dist-info}/RECORD +443 -364
- mage_ai/authentication/oauth/active_directory.py +0 -17
- mage_ai/server/frontend_dist/_next/static/RPXiX8RpZ7oO-yeaEtV2c/_buildManifest.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/1125-91d3ce33140ef041.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/1749-607014ecf28268bf.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/1952-573c7fc7ad84da6e.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3004-231cad9039ae5dcb.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3419-0873e170ef7d6303.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3932-0ceca9599d6e6d00.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/4267-335766a915ee2fa9.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/5457-8be2e0a3fe0ba64b.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/5499-bca977f466e259e1.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/553-edf533e634e85192.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/5810-37c6091b29a1fe53.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/600-0733eb84f0a0a9e0.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/6333-53b6ebbef95a3691.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/722-3fff38a9019369fe.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/8224-39a93ee1058b6069.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/8264-6ef8fdb195694807.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/9264-1b5c4b071ed544c3.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/framework-7c365855dab1bf41.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/_app-a4a660fa14cf05a9.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/block-layout-c465c14d48392b11.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/compute-b1f8d5a7a9a30f2d.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/files-93c094bad0f299fb.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/files-891e5bd5935f7473.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/settings-d2e4ee4e68d36807.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users/new-4a49126fcfe8ced0.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage-5f8c5d0bc6ad1113.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/oauth-09467512a85c96ed.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/overview-31bde04718d0d3a8.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills/[...slug]-96718f95103d7844.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills-a9266d353f288e8c.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/dashboard-b5c29c852262312e.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-5d525454ff7aeb3f.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors/block-runs-883f4ae9a4a264c0.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors/block-runtime-c65be964e6398cb7.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors-1f5b4a974bd39740.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/settings-074c32397d341de9.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/syncs-50f5d8706ed0bc73.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers/[...slug]-e151c1552fcb67bd.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers-cc36f0f8c73fee4b.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines-8336c4326f1e7d96.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/account/profile-01dd679e4a21e0d9.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/preferences-4d9051c073a9b2ff.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/sync-data-88d41c33b8fcb300.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/sign-in-d859e07561eb9010.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/terminal-578d862f3e56e6e6.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/test-1c0588d685b909b9.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/version-control-e284cf1535d93798.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/1125-91d3ce33140ef041.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/1749-607014ecf28268bf.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/1952-573c7fc7ad84da6e.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/3004-231cad9039ae5dcb.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/3419-0873e170ef7d6303.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/3932-0ceca9599d6e6d00.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/4267-335766a915ee2fa9.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/5457-8be2e0a3fe0ba64b.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/5499-bca977f466e259e1.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/553-edf533e634e85192.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/5810-37c6091b29a1fe53.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/600-0733eb84f0a0a9e0.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/6333-53b6ebbef95a3691.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/722-3fff38a9019369fe.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/8224-39a93ee1058b6069.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/8264-6ef8fdb195694807.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/9264-1b5c4b071ed544c3.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/framework-7c365855dab1bf41.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/_app-a4a660fa14cf05a9.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/block-layout-c465c14d48392b11.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/compute-b1f8d5a7a9a30f2d.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/files-93c094bad0f299fb.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/manage/files-891e5bd5935f7473.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/manage/settings-d2e4ee4e68d36807.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/manage/users/new-4a49126fcfe8ced0.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/manage-5f8c5d0bc6ad1113.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/oauth-09467512a85c96ed.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/overview-31bde04718d0d3a8.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/backfills/[...slug]-96718f95103d7844.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/backfills-a9266d353f288e8c.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/dashboard-b5c29c852262312e.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/edit-5d525454ff7aeb3f.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/monitors/block-runs-883f4ae9a4a264c0.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/monitors/block-runtime-c65be964e6398cb7.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/monitors-1f5b4a974bd39740.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/settings-074c32397d341de9.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/syncs-50f5d8706ed0bc73.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/triggers/[...slug]-e151c1552fcb67bd.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/triggers-cc36f0f8c73fee4b.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines-8336c4326f1e7d96.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/account/profile-01dd679e4a21e0d9.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/preferences-4d9051c073a9b2ff.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/sync-data-88d41c33b8fcb300.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/sign-in-d859e07561eb9010.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/terminal-578d862f3e56e6e6.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/test-1c0588d685b909b9.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/version-control-e284cf1535d93798.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/rNR5JgSxO3eA2BWGa_i7U/_buildManifest.js +0 -1
- /mage_ai/server/frontend_dist/_next/static/{RPXiX8RpZ7oO-yeaEtV2c → 9jB4XPuz6BzxBcG9VNao5}/_ssgManifest.js +0 -0
- /mage_ai/server/frontend_dist_base_path_template/_next/static/{rNR5JgSxO3eA2BWGa_i7U → uPDjJYpJMst1q6psbRyte}/_ssgManifest.js +0 -0
- {mage_ai-0.9.44.dist-info → mage_ai-0.9.46.dist-info}/LICENSE +0 -0
- {mage_ai-0.9.44.dist-info → mage_ai-0.9.46.dist-info}/WHEEL +0 -0
- {mage_ai-0.9.44.dist-info → mage_ai-0.9.46.dist-info}/entry_points.txt +0 -0
- {mage_ai-0.9.44.dist-info → mage_ai-0.9.46.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,928 @@
|
|
|
1
|
+
import hashlib
|
|
2
|
+
import os
|
|
3
|
+
from collections.abc import Iterable
|
|
4
|
+
from dataclasses import dataclass, field, make_dataclass
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
from enum import Enum
|
|
7
|
+
from typing import Any, Dict, List, Tuple, Union
|
|
8
|
+
|
|
9
|
+
import yaml
|
|
10
|
+
|
|
11
|
+
from mage_ai.api.operations.constants import OperationType
|
|
12
|
+
from mage_ai.api.resources.BaseResource import BaseResource
|
|
13
|
+
from mage_ai.authentication.permissions.constants import EntityName
|
|
14
|
+
from mage_ai.data_preparation.models.block import Block
|
|
15
|
+
from mage_ai.data_preparation.models.block.utils import fetch_input_variables
|
|
16
|
+
from mage_ai.data_preparation.models.global_hooks.constants import (
|
|
17
|
+
RESOURCE_TYPES,
|
|
18
|
+
HookOutputKey,
|
|
19
|
+
)
|
|
20
|
+
from mage_ai.data_preparation.models.global_hooks.utils import extract_valid_data
|
|
21
|
+
from mage_ai.data_preparation.models.pipeline import Pipeline
|
|
22
|
+
from mage_ai.orchestration.db.models.schedules import PipelineRun
|
|
23
|
+
from mage_ai.orchestration.triggers.api import trigger_pipeline
|
|
24
|
+
from mage_ai.orchestration.triggers.constants import TRIGGER_NAME_FOR_GLOBAL_HOOK
|
|
25
|
+
from mage_ai.settings.repo import get_repo_path
|
|
26
|
+
from mage_ai.shared.array import find, find_index, flatten
|
|
27
|
+
from mage_ai.shared.hash import (
|
|
28
|
+
dig,
|
|
29
|
+
extract,
|
|
30
|
+
ignore_keys,
|
|
31
|
+
ignore_keys_with_blank_values,
|
|
32
|
+
merge_dict,
|
|
33
|
+
set_value,
|
|
34
|
+
)
|
|
35
|
+
from mage_ai.shared.io import safe_write
|
|
36
|
+
from mage_ai.shared.models import BaseDataClass
|
|
37
|
+
from mage_ai.shared.multi import run_parallel_multiple_args
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class HookOperation(str, Enum):
|
|
41
|
+
CREATE = OperationType.CREATE.value
|
|
42
|
+
DELETE = OperationType.DELETE.value
|
|
43
|
+
DETAIL = OperationType.DETAIL.value
|
|
44
|
+
EXECUTE = 'execute'
|
|
45
|
+
LIST = OperationType.LIST.value
|
|
46
|
+
UPDATE = OperationType.UPDATE.value
|
|
47
|
+
UPDATE_ANYWHERE = 'update_anywhere'
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class HookCondition(str, Enum):
|
|
51
|
+
FAILURE = 'failure'
|
|
52
|
+
SUCCESS = 'success'
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class HookStrategy(str, Enum):
|
|
56
|
+
BREAK = 'break'
|
|
57
|
+
CONTINUE = 'continue'
|
|
58
|
+
RAISE = 'raise'
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class HookStage(str, Enum):
|
|
62
|
+
AFTER = 'after'
|
|
63
|
+
BEFORE = 'before'
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@dataclass
|
|
67
|
+
class HookStrategies(BaseDataClass):
|
|
68
|
+
failure: List[HookStrategy] = field(default=None)
|
|
69
|
+
success: List[HookStrategy] = field(default=None)
|
|
70
|
+
|
|
71
|
+
def __post_init__(self):
|
|
72
|
+
self.serialize_attribute_enums('failure', HookStrategy)
|
|
73
|
+
self.serialize_attribute_enums('success', HookStrategy)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@dataclass
|
|
77
|
+
class HookRunSettings(BaseDataClass):
|
|
78
|
+
with_trigger: bool = False
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
@dataclass
|
|
82
|
+
class HookStatus(BaseDataClass):
|
|
83
|
+
error: str = None
|
|
84
|
+
strategy: HookStrategy = None
|
|
85
|
+
|
|
86
|
+
def __post_init__(self):
|
|
87
|
+
self.serialize_attribute_enum('strategy', HookStrategy)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
@dataclass
|
|
91
|
+
class HookOutputBlock(BaseDataClass):
|
|
92
|
+
uuid: str
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@dataclass
|
|
96
|
+
class HookOutputSettings(BaseDataClass):
|
|
97
|
+
block: HookOutputBlock
|
|
98
|
+
key: HookOutputKey = None
|
|
99
|
+
keys: List[str] = field(default=None)
|
|
100
|
+
|
|
101
|
+
def __post_init__(self):
|
|
102
|
+
self.serialize_attribute_class('block', HookOutputBlock)
|
|
103
|
+
self.serialize_attribute_enum('key', HookOutputKey)
|
|
104
|
+
|
|
105
|
+
def to_dict(self, **kwargs) -> Dict:
|
|
106
|
+
data = {}
|
|
107
|
+
if self.key and isinstance(self.key, HookOutputKey):
|
|
108
|
+
data['key'] = self.key.value
|
|
109
|
+
return merge_dict(ignore_keys_with_blank_values(super().to_dict(**kwargs)), data)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@dataclass
|
|
113
|
+
class HookPredicate(BaseDataClass):
|
|
114
|
+
resource: Dict = field(default_factory=dict)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
@dataclass
|
|
118
|
+
class MetadataUser(BaseDataClass):
|
|
119
|
+
id: int = None
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
@dataclass
|
|
123
|
+
class HookMetadata(BaseDataClass):
|
|
124
|
+
created_at: str = None
|
|
125
|
+
snapshot_hash: str = None
|
|
126
|
+
snapshotted_at: str = None
|
|
127
|
+
updated_at: str = None
|
|
128
|
+
user: MetadataUser = None
|
|
129
|
+
|
|
130
|
+
def __post_init__(self):
|
|
131
|
+
self.serialize_attribute_class('user', MetadataUser)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
@dataclass
|
|
135
|
+
class Hook(BaseDataClass):
|
|
136
|
+
attribute_aliases = dict(
|
|
137
|
+
outputs='output_settings',
|
|
138
|
+
pipeline='pipeline_settings',
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
conditions: List[HookCondition] = None
|
|
142
|
+
metadata: HookMetadata = None
|
|
143
|
+
operation_type: HookOperation = None
|
|
144
|
+
output: Dict = field(default=None)
|
|
145
|
+
output_settings: List[HookOutputSettings] = None
|
|
146
|
+
pipeline_settings: Dict = field(default=None)
|
|
147
|
+
predicates: List[List[HookPredicate]] = None
|
|
148
|
+
resource_type: EntityName = None
|
|
149
|
+
run_settings: HookRunSettings = None
|
|
150
|
+
stages: List[HookStage] = None
|
|
151
|
+
status: HookStatus = None
|
|
152
|
+
strategies: List[HookStrategy] = None
|
|
153
|
+
uuid: str = None
|
|
154
|
+
|
|
155
|
+
def __post_init__(self):
|
|
156
|
+
self._pipeline = None
|
|
157
|
+
|
|
158
|
+
self.serialize_attribute_class('metadata', HookMetadata)
|
|
159
|
+
self.serialize_attribute_class('run_settings', HookRunSettings)
|
|
160
|
+
self.serialize_attribute_class('status', HookStatus)
|
|
161
|
+
self.serialize_attribute_class('strategies', HookStrategies)
|
|
162
|
+
self.serialize_attribute_classes('output_settings', HookOutputSettings)
|
|
163
|
+
self.serialize_attribute_enum('operation_type', HookOperation)
|
|
164
|
+
self.serialize_attribute_enum('resource_type', EntityName)
|
|
165
|
+
self.serialize_attribute_enums('conditions', HookCondition)
|
|
166
|
+
self.serialize_attribute_enums('stages', HookStage)
|
|
167
|
+
|
|
168
|
+
if self.predicates and isinstance(self.predicates, list):
|
|
169
|
+
rows = []
|
|
170
|
+
for predicates in self.predicates:
|
|
171
|
+
row = []
|
|
172
|
+
if predicates and isinstance(predicates, list):
|
|
173
|
+
for predicate in predicates:
|
|
174
|
+
row.append(HookPredicate.load(**predicate))
|
|
175
|
+
rows.append(row)
|
|
176
|
+
self.predicates = rows
|
|
177
|
+
|
|
178
|
+
def to_dict(
|
|
179
|
+
self,
|
|
180
|
+
include_all: bool = False,
|
|
181
|
+
include_run_data: bool = False,
|
|
182
|
+
include_snapshot_validation: bool = False,
|
|
183
|
+
**kwargs,
|
|
184
|
+
):
|
|
185
|
+
arr = [
|
|
186
|
+
'conditions',
|
|
187
|
+
'metadata',
|
|
188
|
+
'run_settings',
|
|
189
|
+
'stages',
|
|
190
|
+
'strategies',
|
|
191
|
+
'uuid',
|
|
192
|
+
]
|
|
193
|
+
|
|
194
|
+
if include_all:
|
|
195
|
+
arr.extend([
|
|
196
|
+
'operation_type',
|
|
197
|
+
'resource_type',
|
|
198
|
+
])
|
|
199
|
+
|
|
200
|
+
if include_run_data:
|
|
201
|
+
arr.extend([
|
|
202
|
+
'output',
|
|
203
|
+
'status',
|
|
204
|
+
])
|
|
205
|
+
|
|
206
|
+
data = extract(super().to_dict(**kwargs), arr)
|
|
207
|
+
|
|
208
|
+
if self.output_settings:
|
|
209
|
+
data['outputs'] = [m.to_dict() for m in (self.output_settings or [])]
|
|
210
|
+
|
|
211
|
+
if self.pipeline_settings:
|
|
212
|
+
data['pipeline'] = self.pipeline_settings
|
|
213
|
+
|
|
214
|
+
if self.predicates:
|
|
215
|
+
rows = []
|
|
216
|
+
for predicates in self.predicates:
|
|
217
|
+
if predicates:
|
|
218
|
+
row = []
|
|
219
|
+
for predicate in predicates:
|
|
220
|
+
row.append(predicate.to_dict())
|
|
221
|
+
|
|
222
|
+
if len(row) >= 1:
|
|
223
|
+
rows.append(row)
|
|
224
|
+
|
|
225
|
+
if len(rows) >= 1:
|
|
226
|
+
data['predicates'] = rows
|
|
227
|
+
|
|
228
|
+
if include_snapshot_validation:
|
|
229
|
+
key = 'snapshot_valid'
|
|
230
|
+
if data.get('metadata'):
|
|
231
|
+
data['metadata'][key] = self.__validate_snapshot()
|
|
232
|
+
else:
|
|
233
|
+
data['metadata'] = {
|
|
234
|
+
key: False,
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return data
|
|
238
|
+
|
|
239
|
+
@property
|
|
240
|
+
def pipeline(self):
|
|
241
|
+
if self._pipeline:
|
|
242
|
+
return self._pipeline
|
|
243
|
+
|
|
244
|
+
if self.pipeline_settings:
|
|
245
|
+
try:
|
|
246
|
+
self._pipeline = Pipeline.get(self.pipeline_settings.get('uuid'))
|
|
247
|
+
self._pipeline.run_pipeline_in_one_process = True
|
|
248
|
+
except Exception as err:
|
|
249
|
+
print(f'[WARNING] Hook.pipeline {self.uuid}: {err}')
|
|
250
|
+
|
|
251
|
+
return self._pipeline
|
|
252
|
+
|
|
253
|
+
def get_and_set_output(self, pipeline_run: PipelineRun = None) -> Dict:
|
|
254
|
+
self.output = {}
|
|
255
|
+
|
|
256
|
+
if not self.pipeline or not self.output_settings:
|
|
257
|
+
return self.output
|
|
258
|
+
|
|
259
|
+
block_uuids = {}
|
|
260
|
+
for hook_output_setting in self.output_settings:
|
|
261
|
+
if not hook_output_setting.block or not hook_output_setting.block.uuid:
|
|
262
|
+
continue
|
|
263
|
+
|
|
264
|
+
block_uuids[hook_output_setting.block.uuid] = hook_output_setting
|
|
265
|
+
|
|
266
|
+
if len(block_uuids) == 0:
|
|
267
|
+
return self.output
|
|
268
|
+
|
|
269
|
+
outputs_mapping = {}
|
|
270
|
+
|
|
271
|
+
if pipeline_run:
|
|
272
|
+
for block_run in pipeline_run.block_runs:
|
|
273
|
+
block = self.pipeline.get_block(block_run.block_uuid)
|
|
274
|
+
block_uuid = block.uuid
|
|
275
|
+
if block_uuid not in block_uuids:
|
|
276
|
+
continue
|
|
277
|
+
|
|
278
|
+
if block_uuid not in outputs_mapping:
|
|
279
|
+
outputs_mapping[block_uuid] = []
|
|
280
|
+
|
|
281
|
+
outputs_mapping[block_uuid].append(block_run.get_outputs(sample=False))
|
|
282
|
+
else:
|
|
283
|
+
for block_uuid in block_uuids.keys():
|
|
284
|
+
input_vars, _kwargs_vars, _upstream_block_uuids_final = fetch_input_variables(
|
|
285
|
+
self.pipeline,
|
|
286
|
+
input_args=None,
|
|
287
|
+
global_vars=self.pipeline_settings.get('variables'),
|
|
288
|
+
upstream_block_uuids=[block_uuid],
|
|
289
|
+
)
|
|
290
|
+
output = input_vars
|
|
291
|
+
if isinstance(output, list) and len(output) >= 1:
|
|
292
|
+
output = output[0]
|
|
293
|
+
|
|
294
|
+
if block_uuid not in outputs_mapping:
|
|
295
|
+
outputs_mapping[block_uuid] = []
|
|
296
|
+
|
|
297
|
+
outputs_mapping[block_uuid].append(output)
|
|
298
|
+
|
|
299
|
+
for hook_output_setting in self.output_settings:
|
|
300
|
+
if not hook_output_setting.block or not hook_output_setting.block.uuid:
|
|
301
|
+
continue
|
|
302
|
+
|
|
303
|
+
block_uuid = hook_output_setting.block.uuid
|
|
304
|
+
output_arr = outputs_mapping.get(block_uuid)
|
|
305
|
+
if output_arr is None or len(output_arr) == 0:
|
|
306
|
+
continue
|
|
307
|
+
|
|
308
|
+
for output in output_arr:
|
|
309
|
+
if output is None:
|
|
310
|
+
continue
|
|
311
|
+
|
|
312
|
+
if HookOperation.EXECUTE == self.operation_type:
|
|
313
|
+
# TODO: implement
|
|
314
|
+
pass
|
|
315
|
+
elif hook_output_setting.key:
|
|
316
|
+
keys = [hook_output_setting.key.value]
|
|
317
|
+
if hook_output_setting.keys:
|
|
318
|
+
keys.extend(hook_output_setting.keys)
|
|
319
|
+
|
|
320
|
+
output_acc = dig(self.output, keys)
|
|
321
|
+
|
|
322
|
+
if isinstance(output, dict):
|
|
323
|
+
if output_acc is None or len(output_acc) == 0:
|
|
324
|
+
output_acc = {}
|
|
325
|
+
|
|
326
|
+
if output:
|
|
327
|
+
for key, value in output.items():
|
|
328
|
+
value_prev = output_acc.get(key)
|
|
329
|
+
if value_prev and \
|
|
330
|
+
isinstance(value_prev, list) and \
|
|
331
|
+
isinstance(value, list):
|
|
332
|
+
output_acc[key] = value_prev + value
|
|
333
|
+
elif value_prev and \
|
|
334
|
+
isinstance(value_prev, dict) and \
|
|
335
|
+
isinstance(value, dict):
|
|
336
|
+
output_acc[key] = merge_dict(value_prev, value)
|
|
337
|
+
else:
|
|
338
|
+
output_acc[key] = value
|
|
339
|
+
elif isinstance(output, list):
|
|
340
|
+
if output_acc is None or len(output_acc) == 0:
|
|
341
|
+
output_acc = []
|
|
342
|
+
|
|
343
|
+
output_acc = output_acc + output
|
|
344
|
+
elif str(output).isnumeric():
|
|
345
|
+
if output_acc is None:
|
|
346
|
+
output_acc = 0
|
|
347
|
+
|
|
348
|
+
output_acc = output_acc + output
|
|
349
|
+
else:
|
|
350
|
+
output_acc = output
|
|
351
|
+
|
|
352
|
+
self.output = set_value(self.output, keys, output_acc)
|
|
353
|
+
|
|
354
|
+
self.output = extract_valid_data(self.resource_type, self.output or {})
|
|
355
|
+
|
|
356
|
+
return self.output
|
|
357
|
+
|
|
358
|
+
def run(
|
|
359
|
+
self,
|
|
360
|
+
check_status: bool = True,
|
|
361
|
+
error_on_failure: bool = True,
|
|
362
|
+
poll_timeout: int = None,
|
|
363
|
+
should_schedule: bool = False,
|
|
364
|
+
with_trigger: bool = False,
|
|
365
|
+
**kwargs,
|
|
366
|
+
) -> None:
|
|
367
|
+
if not self.pipeline:
|
|
368
|
+
return
|
|
369
|
+
|
|
370
|
+
try:
|
|
371
|
+
variables_from_operation = extract_valid_data(self.resource_type, dict(
|
|
372
|
+
error=kwargs.get('error'),
|
|
373
|
+
meta=kwargs.get('meta'),
|
|
374
|
+
metadata=kwargs.get('metadata'),
|
|
375
|
+
payload=kwargs.get('payload'),
|
|
376
|
+
query=kwargs.get('query'),
|
|
377
|
+
resource=kwargs.get('resource'),
|
|
378
|
+
resources=kwargs.get('resources'),
|
|
379
|
+
))
|
|
380
|
+
variables = merge_dict(
|
|
381
|
+
self.pipeline_settings.get('variables') or {},
|
|
382
|
+
merge_dict(
|
|
383
|
+
variables_from_operation,
|
|
384
|
+
dict(
|
|
385
|
+
hook=self.to_dict(include_all=True),
|
|
386
|
+
),
|
|
387
|
+
),
|
|
388
|
+
)
|
|
389
|
+
|
|
390
|
+
pipeline_run = None
|
|
391
|
+
if with_trigger or (self.run_settings and self.run_settings.with_trigger):
|
|
392
|
+
pipeline_run = trigger_pipeline(
|
|
393
|
+
self.pipeline.uuid,
|
|
394
|
+
variables=variables,
|
|
395
|
+
check_status=check_status,
|
|
396
|
+
error_on_failure=error_on_failure,
|
|
397
|
+
poll_interval=1,
|
|
398
|
+
poll_timeout=poll_timeout,
|
|
399
|
+
schedule_name=TRIGGER_NAME_FOR_GLOBAL_HOOK,
|
|
400
|
+
verbose=True,
|
|
401
|
+
_should_schedule=should_schedule,
|
|
402
|
+
)
|
|
403
|
+
else:
|
|
404
|
+
self.pipeline.execute_sync(global_vars=variables, update_status=False)
|
|
405
|
+
|
|
406
|
+
return pipeline_run
|
|
407
|
+
except Exception as err:
|
|
408
|
+
self.status = HookStatus.load(error=err)
|
|
409
|
+
|
|
410
|
+
if self.strategies:
|
|
411
|
+
if HookStrategy.RAISE in self.strategies:
|
|
412
|
+
self.status.strategy = HookStrategy.RAISE
|
|
413
|
+
elif HookStrategy.BREAK in self.strategies and \
|
|
414
|
+
HookOperation.EXECUTE == self.operation_type:
|
|
415
|
+
|
|
416
|
+
self.status.strategy = HookStrategy.BREAK
|
|
417
|
+
elif HookStrategy.CONTINUE in self.strategies:
|
|
418
|
+
self.status.strategy = HookStrategy.CONTINUE
|
|
419
|
+
|
|
420
|
+
def should_run(
|
|
421
|
+
self,
|
|
422
|
+
operation_types: List[HookOperation],
|
|
423
|
+
resource_type: EntityName,
|
|
424
|
+
stage: HookStage,
|
|
425
|
+
conditions: List[HookCondition] = None,
|
|
426
|
+
operation_resource: Union[BaseResource, Block, Dict, List[BaseResource], Pipeline] = None,
|
|
427
|
+
) -> bool:
|
|
428
|
+
if self.operation_type not in operation_types:
|
|
429
|
+
return False
|
|
430
|
+
|
|
431
|
+
if self.resource_type != resource_type:
|
|
432
|
+
return False
|
|
433
|
+
|
|
434
|
+
if self.stages and stage not in (self.stages or []):
|
|
435
|
+
return False
|
|
436
|
+
|
|
437
|
+
if not self.__matches_any_condition(conditions):
|
|
438
|
+
return False
|
|
439
|
+
|
|
440
|
+
if not self.__validate_snapshot():
|
|
441
|
+
return False
|
|
442
|
+
|
|
443
|
+
if not self.__matches_any_predicate(operation_resource):
|
|
444
|
+
return False
|
|
445
|
+
|
|
446
|
+
return True
|
|
447
|
+
|
|
448
|
+
def snapshot(self) -> str:
|
|
449
|
+
if not self.pipeline:
|
|
450
|
+
return
|
|
451
|
+
|
|
452
|
+
if not self.metadata:
|
|
453
|
+
self.metadata = HookMetadata.load()
|
|
454
|
+
|
|
455
|
+
now = datetime.utcnow().isoformat(' ', 'seconds')
|
|
456
|
+
self.metadata.snapshot_hash = self.__generate_snapshot_hash(prefix=now)
|
|
457
|
+
self.metadata.snapshotted_at = now
|
|
458
|
+
|
|
459
|
+
return self.metadata.snapshot_hash
|
|
460
|
+
|
|
461
|
+
def __validate_snapshot(self) -> bool:
|
|
462
|
+
return self.metadata and \
|
|
463
|
+
self.metadata.snapshot_hash and \
|
|
464
|
+
self.metadata.snapshotted_at and \
|
|
465
|
+
self.metadata.snapshot_hash == self.__generate_snapshot_hash(
|
|
466
|
+
self.metadata.snapshotted_at,
|
|
467
|
+
)
|
|
468
|
+
|
|
469
|
+
def __generate_snapshot_hash(self, prefix: str = None) -> str:
|
|
470
|
+
if not self.pipeline:
|
|
471
|
+
return None
|
|
472
|
+
|
|
473
|
+
hashes = []
|
|
474
|
+
|
|
475
|
+
for block in self.pipeline.blocks_by_uuid.values():
|
|
476
|
+
content = block.content or ''
|
|
477
|
+
hashes.append(
|
|
478
|
+
hashlib.md5(f'{prefix or ""}{content}'.encode()).hexdigest()
|
|
479
|
+
)
|
|
480
|
+
|
|
481
|
+
hashes_combined = ''.join(hashes)
|
|
482
|
+
|
|
483
|
+
return hashlib.md5(
|
|
484
|
+
f'{prefix or ""}{hashes_combined}'.encode(),
|
|
485
|
+
).hexdigest()
|
|
486
|
+
|
|
487
|
+
def __matches_any_condition(self, conditions: List[HookCondition]) -> bool:
|
|
488
|
+
if not conditions or not self.conditions:
|
|
489
|
+
return True
|
|
490
|
+
|
|
491
|
+
return any([condition in (self.conditions or []) for condition in conditions])
|
|
492
|
+
|
|
493
|
+
def __matches_any_predicate(
|
|
494
|
+
self,
|
|
495
|
+
operation_resource: Union[BaseResource, Block, Dict, List[BaseResource], Pipeline],
|
|
496
|
+
) -> bool:
|
|
497
|
+
if not operation_resource or not self.predicates:
|
|
498
|
+
return True
|
|
499
|
+
|
|
500
|
+
return any([all([self.__validate_predicate(
|
|
501
|
+
predicate,
|
|
502
|
+
operation_resource,
|
|
503
|
+
) for predicate in predicates]) for predicates in self.predicates])
|
|
504
|
+
|
|
505
|
+
def __validate_predicate(
|
|
506
|
+
self,
|
|
507
|
+
predicate: HookPredicate,
|
|
508
|
+
operation_resource: Union[BaseResource, Block, Dict, List[BaseResource], Pipeline],
|
|
509
|
+
) -> bool:
|
|
510
|
+
if not predicate.resource or len(predicate.resource) == 0:
|
|
511
|
+
return True
|
|
512
|
+
|
|
513
|
+
def _validate_resource(
|
|
514
|
+
resource: Union[BaseResource, Block, Dict, Pipeline],
|
|
515
|
+
predicate=predicate,
|
|
516
|
+
) -> bool:
|
|
517
|
+
model = resource
|
|
518
|
+
if isinstance(resource, BaseResource):
|
|
519
|
+
model = resource.model
|
|
520
|
+
|
|
521
|
+
def _equals(
|
|
522
|
+
key: str,
|
|
523
|
+
value: Any,
|
|
524
|
+
model=model,
|
|
525
|
+
) -> bool:
|
|
526
|
+
if isinstance(model, dict):
|
|
527
|
+
return model.get(key) == value
|
|
528
|
+
|
|
529
|
+
return hasattr(model, key) and getattr(model, key) == value
|
|
530
|
+
|
|
531
|
+
check = all([_equals(key, value) for key, value in predicate.resource.items()])
|
|
532
|
+
|
|
533
|
+
return check
|
|
534
|
+
|
|
535
|
+
if isinstance(operation_resource, Iterable) and not isinstance(operation_resource, dict):
|
|
536
|
+
return all([_validate_resource(res) for res in operation_resource])
|
|
537
|
+
|
|
538
|
+
return _validate_resource(operation_resource)
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
def __build_global_hook_resource_fields() -> List[Tuple]:
|
|
542
|
+
arr = []
|
|
543
|
+
|
|
544
|
+
for operation in HookOperation:
|
|
545
|
+
arr.append((
|
|
546
|
+
operation.value,
|
|
547
|
+
List[Hook],
|
|
548
|
+
field(default=None),
|
|
549
|
+
))
|
|
550
|
+
|
|
551
|
+
return arr
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
GlobalHookResourceBase = make_dataclass(
|
|
555
|
+
'GlobalHookResourceBase',
|
|
556
|
+
bases=(BaseDataClass,),
|
|
557
|
+
fields=__build_global_hook_resource_fields(),
|
|
558
|
+
)
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
@dataclass
|
|
562
|
+
class GlobalHookResource(GlobalHookResourceBase):
|
|
563
|
+
resource_type: EntityName = None
|
|
564
|
+
|
|
565
|
+
def __post_init__(self):
|
|
566
|
+
self.serialize_attribute_enum('resource_type', EntityName)
|
|
567
|
+
|
|
568
|
+
for operation in HookOperation:
|
|
569
|
+
self.serialize_attribute_classes(
|
|
570
|
+
operation.value,
|
|
571
|
+
Hook,
|
|
572
|
+
operation_type=operation,
|
|
573
|
+
resource_type=self.resource_type,
|
|
574
|
+
)
|
|
575
|
+
|
|
576
|
+
if self.resource_type:
|
|
577
|
+
self.update_attributes(resource_type=self.resource_type)
|
|
578
|
+
|
|
579
|
+
def to_dict(
|
|
580
|
+
self,
|
|
581
|
+
include_all: bool = False,
|
|
582
|
+
**kwargs,
|
|
583
|
+
):
|
|
584
|
+
arr = []
|
|
585
|
+
|
|
586
|
+
if not include_all:
|
|
587
|
+
arr.extend([
|
|
588
|
+
'resource_type',
|
|
589
|
+
])
|
|
590
|
+
|
|
591
|
+
data = super().to_dict(**kwargs)
|
|
592
|
+
|
|
593
|
+
return ignore_keys(data, arr)
|
|
594
|
+
|
|
595
|
+
def update_attributes(self, **kwargs):
|
|
596
|
+
super().update_attributes(**kwargs)
|
|
597
|
+
|
|
598
|
+
if 'resource_type' in kwargs:
|
|
599
|
+
for operation in HookOperation:
|
|
600
|
+
hooks = getattr(self, operation.value)
|
|
601
|
+
if hooks:
|
|
602
|
+
for hook in hooks:
|
|
603
|
+
hook.update_attributes(
|
|
604
|
+
operation_type=operation,
|
|
605
|
+
resource_type=self.resource_type,
|
|
606
|
+
)
|
|
607
|
+
setattr(self, operation.value, hooks)
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
def __build_global_hook_resources_fields() -> List[Tuple]:
|
|
611
|
+
arr = []
|
|
612
|
+
|
|
613
|
+
for entity_name in RESOURCE_TYPES:
|
|
614
|
+
arr.append((
|
|
615
|
+
entity_name.value,
|
|
616
|
+
GlobalHookResource,
|
|
617
|
+
field(default=None),
|
|
618
|
+
))
|
|
619
|
+
|
|
620
|
+
return arr
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
GlobalHookResourcesBase = make_dataclass(
|
|
624
|
+
'GlobalHookResourcesBase',
|
|
625
|
+
bases=(BaseDataClass,),
|
|
626
|
+
fields=__build_global_hook_resources_fields(),
|
|
627
|
+
)
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
@dataclass
|
|
631
|
+
class GlobalHookResources(GlobalHookResourcesBase):
|
|
632
|
+
disable_attribute_snake_case = True
|
|
633
|
+
|
|
634
|
+
def __post_init__(self):
|
|
635
|
+
for entity_name in RESOURCE_TYPES:
|
|
636
|
+
self.serialize_attribute_class(
|
|
637
|
+
entity_name.value,
|
|
638
|
+
GlobalHookResource,
|
|
639
|
+
)
|
|
640
|
+
self.update_attributes()
|
|
641
|
+
|
|
642
|
+
def update_attributes(self, **kwargs):
|
|
643
|
+
super().update_attributes(**kwargs)
|
|
644
|
+
|
|
645
|
+
for entity_name in RESOURCE_TYPES:
|
|
646
|
+
resource = getattr(self, entity_name.value)
|
|
647
|
+
if resource:
|
|
648
|
+
resource.update_attributes(resource_type=entity_name)
|
|
649
|
+
setattr(self, entity_name.value, resource)
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
def run_hooks(args_arrays: List[List]) -> List[Dict]:
|
|
653
|
+
arr = []
|
|
654
|
+
|
|
655
|
+
for args_array in args_arrays:
|
|
656
|
+
hook_dict, kwargs = args_array
|
|
657
|
+
hook = Hook.load(**hook_dict)
|
|
658
|
+
pipeline_run = hook.run(**kwargs)
|
|
659
|
+
hook.get_and_set_output(pipeline_run=pipeline_run)
|
|
660
|
+
arr.append(hook.to_dict(include_run_data=True))
|
|
661
|
+
|
|
662
|
+
return arr
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
@dataclass
|
|
666
|
+
class GlobalHooks(BaseDataClass):
|
|
667
|
+
resources: GlobalHookResources = None
|
|
668
|
+
|
|
669
|
+
def __post_init__(self):
|
|
670
|
+
self.serialize_attribute_class('resources', GlobalHookResources)
|
|
671
|
+
if self.resources:
|
|
672
|
+
self.resources.update_attributes()
|
|
673
|
+
|
|
674
|
+
@classmethod
|
|
675
|
+
def file_path(self) -> str:
|
|
676
|
+
return os.path.join(get_repo_path(), 'global_hooks.yaml')
|
|
677
|
+
|
|
678
|
+
@classmethod
|
|
679
|
+
def load_from_file(self, file_path: str = None) -> 'GlobalHooks':
|
|
680
|
+
yaml_config = {}
|
|
681
|
+
|
|
682
|
+
file_path_to_use = file_path or self.file_path()
|
|
683
|
+
if os.path.exists(file_path_to_use):
|
|
684
|
+
with open(file_path_to_use, 'r') as fp:
|
|
685
|
+
content = fp.read()
|
|
686
|
+
if content:
|
|
687
|
+
yaml_config = yaml.safe_load(content) or {}
|
|
688
|
+
|
|
689
|
+
return self.load(**yaml_config)
|
|
690
|
+
|
|
691
|
+
def add_hook(
|
|
692
|
+
self,
|
|
693
|
+
hook: Hook,
|
|
694
|
+
payload: Dict = None,
|
|
695
|
+
snapshot: bool = False,
|
|
696
|
+
update: bool = False,
|
|
697
|
+
) -> Hook:
|
|
698
|
+
now = datetime.utcnow().isoformat(' ', 'seconds')
|
|
699
|
+
|
|
700
|
+
if not update and self.get_hook(
|
|
701
|
+
operation_type=hook.operation_type,
|
|
702
|
+
resource_type=hook.resource_type,
|
|
703
|
+
uuid=hook.uuid,
|
|
704
|
+
):
|
|
705
|
+
raise Exception(
|
|
706
|
+
f'Hook {hook.uuid} already exist for resource '
|
|
707
|
+
f'{hook.resource_type} and operation {hook.operation_type}.',
|
|
708
|
+
)
|
|
709
|
+
|
|
710
|
+
if not self.resources:
|
|
711
|
+
self.resources = GlobalHookResources.load()
|
|
712
|
+
|
|
713
|
+
resource = getattr(self.resources, hook.resource_type.value)
|
|
714
|
+
if not resource:
|
|
715
|
+
resource = GlobalHookResource.load()
|
|
716
|
+
|
|
717
|
+
hooks = getattr(resource, hook.operation_type)
|
|
718
|
+
if not hooks:
|
|
719
|
+
hooks = []
|
|
720
|
+
|
|
721
|
+
if update:
|
|
722
|
+
index = find_index(
|
|
723
|
+
lambda x: (
|
|
724
|
+
x.uuid == hook.uuid and
|
|
725
|
+
x.operation_type == hook.operation_type and
|
|
726
|
+
x.resource_type == hook.resource_type
|
|
727
|
+
),
|
|
728
|
+
hooks,
|
|
729
|
+
)
|
|
730
|
+
if index >= 0:
|
|
731
|
+
hook_updated = Hook.load(
|
|
732
|
+
**merge_dict(
|
|
733
|
+
hook.to_dict(include_all=True),
|
|
734
|
+
payload,
|
|
735
|
+
),
|
|
736
|
+
)
|
|
737
|
+
|
|
738
|
+
if not hook_updated.metadata:
|
|
739
|
+
hook_updated.metadata = HookMetadata.load()
|
|
740
|
+
hook_updated.metadata.updated_at = now
|
|
741
|
+
|
|
742
|
+
if hook.resource_type == hook_updated.resource_type and \
|
|
743
|
+
hook.operation_type == hook_updated.operation_type:
|
|
744
|
+
|
|
745
|
+
hooks[index] = hook_updated
|
|
746
|
+
else:
|
|
747
|
+
# Move the hook
|
|
748
|
+
self.add_hook(hook_updated)
|
|
749
|
+
self.remove_hook(hook)
|
|
750
|
+
|
|
751
|
+
if snapshot:
|
|
752
|
+
hook_updated.snapshot()
|
|
753
|
+
|
|
754
|
+
return hook_updated
|
|
755
|
+
else:
|
|
756
|
+
raise Exception(
|
|
757
|
+
f'Hook {hook.uuid} doesn’t exist for resource '
|
|
758
|
+
f'{hook.resource_type} and operation {hook.operation_type}.',
|
|
759
|
+
)
|
|
760
|
+
else:
|
|
761
|
+
if not hook.metadata:
|
|
762
|
+
hook.metadata = HookMetadata.load()
|
|
763
|
+
|
|
764
|
+
hook.metadata.created_at = now
|
|
765
|
+
hook.metadata.updated_at = now
|
|
766
|
+
|
|
767
|
+
if snapshot:
|
|
768
|
+
hook.snapshot()
|
|
769
|
+
|
|
770
|
+
hooks.append(hook)
|
|
771
|
+
setattr(resource, hook.operation_type.value, hooks)
|
|
772
|
+
setattr(self.resources, hook.resource_type.value, resource)
|
|
773
|
+
|
|
774
|
+
return hook
|
|
775
|
+
|
|
776
|
+
def remove_hook(self, hook: Hook) -> Hook:
|
|
777
|
+
if self.resources:
|
|
778
|
+
resource = getattr(self.resources, hook.resource_type.value)
|
|
779
|
+
if resource:
|
|
780
|
+
hooks = getattr(resource, hook.operation_type.value)
|
|
781
|
+
if hooks:
|
|
782
|
+
arr = []
|
|
783
|
+
for x in hooks:
|
|
784
|
+
val = x.uuid != hook.uuid or \
|
|
785
|
+
x.operation_type != hook.operation_type or \
|
|
786
|
+
x.resource_type != hook.resource_type
|
|
787
|
+
if val:
|
|
788
|
+
arr.append(x)
|
|
789
|
+
|
|
790
|
+
setattr(resource, hook.operation_type.value, arr)
|
|
791
|
+
setattr(self.resources, hook.resource_type.value, resource)
|
|
792
|
+
|
|
793
|
+
def hooks(
|
|
794
|
+
self,
|
|
795
|
+
operation_types: List[HookOperation] = None,
|
|
796
|
+
resource_types: List[EntityName] = None,
|
|
797
|
+
) -> List[Hook]:
|
|
798
|
+
arr = []
|
|
799
|
+
if self.resources:
|
|
800
|
+
for entity_name in RESOURCE_TYPES:
|
|
801
|
+
resource = getattr(self.resources, entity_name.value)
|
|
802
|
+
if not resource:
|
|
803
|
+
continue
|
|
804
|
+
|
|
805
|
+
resource.resource_type = resource.resource_type or entity_name
|
|
806
|
+
|
|
807
|
+
if resource_types and resource.resource_type not in resource_types:
|
|
808
|
+
continue
|
|
809
|
+
|
|
810
|
+
for operation in HookOperation:
|
|
811
|
+
if operation_types and operation not in operation_types:
|
|
812
|
+
continue
|
|
813
|
+
|
|
814
|
+
hooks = getattr(resource, operation.value)
|
|
815
|
+
if not hooks:
|
|
816
|
+
continue
|
|
817
|
+
|
|
818
|
+
for hook in hooks:
|
|
819
|
+
hook.operation_type = operation
|
|
820
|
+
hook.resource_type = resource.resource_type
|
|
821
|
+
arr.append(hook)
|
|
822
|
+
|
|
823
|
+
return arr
|
|
824
|
+
|
|
825
|
+
def get_hook(self, resource_type: EntityName, operation_type: HookOperation, uuid: str) -> Hook:
|
|
826
|
+
return find(
|
|
827
|
+
lambda x: (
|
|
828
|
+
x.uuid == uuid and
|
|
829
|
+
x.operation_type == operation_type and
|
|
830
|
+
x.resource_type == resource_type
|
|
831
|
+
),
|
|
832
|
+
self.hooks(),
|
|
833
|
+
)
|
|
834
|
+
|
|
835
|
+
def get_hooks(
|
|
836
|
+
self,
|
|
837
|
+
operation_types: List[HookOperation],
|
|
838
|
+
resource_type: EntityName,
|
|
839
|
+
stage: HookStage,
|
|
840
|
+
conditions: List[HookCondition] = None,
|
|
841
|
+
operation_resource: Union[BaseResource, Block, Dict, List[BaseResource], Pipeline] = None,
|
|
842
|
+
) -> List[Hook]:
|
|
843
|
+
def _filter(
|
|
844
|
+
hook: Hook,
|
|
845
|
+
conditions=conditions,
|
|
846
|
+
operation_resource=operation_resource,
|
|
847
|
+
operation_types=operation_types,
|
|
848
|
+
resource_type=resource_type,
|
|
849
|
+
stage=stage,
|
|
850
|
+
) -> bool:
|
|
851
|
+
return hook.should_run(
|
|
852
|
+
conditions=conditions,
|
|
853
|
+
operation_resource=operation_resource,
|
|
854
|
+
operation_types=operation_types,
|
|
855
|
+
resource_type=resource_type,
|
|
856
|
+
stage=stage,
|
|
857
|
+
)
|
|
858
|
+
|
|
859
|
+
return list(filter(
|
|
860
|
+
_filter,
|
|
861
|
+
self.hooks(),
|
|
862
|
+
))
|
|
863
|
+
|
|
864
|
+
def run_hooks(self, hooks: List[Hook], **kwargs) -> List[Hook]:
|
|
865
|
+
hooks_by_pipeline = {}
|
|
866
|
+
for hook in hooks:
|
|
867
|
+
if not hook.pipeline_settings or not hook.pipeline_settings.get('uuid'):
|
|
868
|
+
continue
|
|
869
|
+
|
|
870
|
+
pipeline_uuid = hook.pipeline_settings.get('uuid')
|
|
871
|
+
if pipeline_uuid not in hooks_by_pipeline:
|
|
872
|
+
hooks_by_pipeline[pipeline_uuid] = []
|
|
873
|
+
|
|
874
|
+
hooks_by_pipeline[pipeline_uuid].append((
|
|
875
|
+
hook.to_dict(
|
|
876
|
+
include_all=True,
|
|
877
|
+
include_output=True,
|
|
878
|
+
),
|
|
879
|
+
kwargs,
|
|
880
|
+
))
|
|
881
|
+
|
|
882
|
+
hook_dicts_arr = run_parallel_multiple_args(run_hooks, list(hooks_by_pipeline.values()))
|
|
883
|
+
|
|
884
|
+
return [Hook.load(**m) for m in flatten(hook_dicts_arr)]
|
|
885
|
+
|
|
886
|
+
def get_and_run_hooks(
|
|
887
|
+
self,
|
|
888
|
+
operation_types: List[HookOperation],
|
|
889
|
+
resource_type: EntityName,
|
|
890
|
+
stage: HookStage,
|
|
891
|
+
conditions: List[HookCondition] = None,
|
|
892
|
+
operation_resource: Union[BaseResource, Block, Dict, List[BaseResource], Pipeline] = None,
|
|
893
|
+
**kwargs,
|
|
894
|
+
) -> List[Hook]:
|
|
895
|
+
hooks = self.get_hooks(
|
|
896
|
+
operation_types=operation_types,
|
|
897
|
+
resource_type=resource_type,
|
|
898
|
+
stage=stage,
|
|
899
|
+
conditions=conditions,
|
|
900
|
+
operation_resource=operation_resource,
|
|
901
|
+
)
|
|
902
|
+
|
|
903
|
+
if not hooks:
|
|
904
|
+
return None
|
|
905
|
+
|
|
906
|
+
return self.run_hooks(hooks, **kwargs)
|
|
907
|
+
|
|
908
|
+
def save(self, file_path: str = None) -> None:
|
|
909
|
+
if not file_path:
|
|
910
|
+
file_path = self.file_path()
|
|
911
|
+
|
|
912
|
+
content_original = None
|
|
913
|
+
if os.path.exists(file_path):
|
|
914
|
+
with open(file_path) as f:
|
|
915
|
+
content_original = f.read()
|
|
916
|
+
|
|
917
|
+
with open(self.file_path(), 'w'):
|
|
918
|
+
try:
|
|
919
|
+
data = self.to_dict()
|
|
920
|
+
content = yaml.safe_dump(data)
|
|
921
|
+
safe_write(file_path, content)
|
|
922
|
+
except Exception as err:
|
|
923
|
+
if content_original:
|
|
924
|
+
safe_write(file_path, content_original)
|
|
925
|
+
raise err
|
|
926
|
+
|
|
927
|
+
def to_dict(self, **kwargs) -> Dict:
|
|
928
|
+
return super().to_dict(convert_enum=True, ignore_empty=True)
|