mage-ai 0.9.46__py3-none-any.whl → 0.9.47__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.
- mage_ai/api/operations/base.py +27 -5
- mage_ai/api/policies/GlobalHookPolicy.py +1 -1
- mage_ai/api/policies/IntegrationSourcePolicy.py +62 -0
- mage_ai/api/policies/OauthPolicy.py +6 -6
- mage_ai/api/presenters/GlobalHookPresenter.py +1 -1
- mage_ai/api/presenters/IntegrationSourcePresenter.py +9 -2
- mage_ai/api/presenters/PipelinePresenter.py +2 -0
- mage_ai/api/presenters/PipelineRunPresenter.py +8 -3
- mage_ai/api/presenters/PipelineSchedulePresenter.py +22 -1
- mage_ai/api/resources/BlockResource.py +5 -0
- mage_ai/api/resources/DataProviderResource.py +2 -0
- mage_ai/api/resources/IntegrationSourceResource.py +149 -2
- mage_ai/data_integrations/sources/constants.py +5 -0
- mage_ai/data_integrations/utils/scheduler.py +57 -2
- mage_ai/data_preparation/executors/block_executor.py +9 -1
- mage_ai/data_preparation/models/block/__init__.py +25 -12
- mage_ai/data_preparation/models/block/data_integration/constants.py +3 -0
- mage_ai/data_preparation/models/block/data_integration/utils.py +196 -37
- mage_ai/data_preparation/models/block/sql/utils/shared.py +18 -1
- mage_ai/data_preparation/models/block/utils.py +28 -13
- mage_ai/data_preparation/models/global_hooks/constants.py +50 -1
- mage_ai/data_preparation/models/global_hooks/models.py +148 -84
- mage_ai/data_preparation/models/global_hooks/predicates.py +316 -0
- mage_ai/data_preparation/models/pipeline.py +2 -0
- mage_ai/data_preparation/models/pipelines/integration_pipeline.py +0 -1
- mage_ai/data_preparation/preferences.py +29 -18
- mage_ai/data_preparation/repo_manager.py +12 -2
- mage_ai/data_preparation/sync/__init__.py +2 -0
- mage_ai/data_preparation/templates/constants.py +14 -0
- mage_ai/data_preparation/templates/data_exporters/chroma.py +24 -0
- mage_ai/data_preparation/templates/data_exporters/streaming/rabbitmq.yaml +7 -0
- mage_ai/data_preparation/templates/data_loaders/chroma.py +27 -0
- mage_ai/data_preparation/templates/repo/io_config.yaml +3 -0
- mage_ai/io/base.py +1 -0
- mage_ai/io/chroma.py +153 -0
- mage_ai/io/config.py +8 -0
- mage_ai/orchestration/db/models/schedules.py +98 -34
- mage_ai/orchestration/pipeline_scheduler.py +58 -19
- mage_ai/server/constants.py +1 -1
- mage_ai/server/frontend_dist/404.html +2 -2
- mage_ai/server/frontend_dist/_next/static/N3FS4bHv0jpYeeg672uYK/_buildManifest.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{1749-9a6276b2918fdae1.js → 1749-bf512b4dabbab7fa.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{1952-ac7722e8b1ab88fe.js → 1952-57858e7445d24413.js} +1 -1
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/2714-1e79e9f2e998b544.js → frontend_dist/_next/static/chunks/2714-68fef54789d7eaeb.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/2717-92cdffd87b6f6e05.js +1 -0
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/3419-f8d518d024e7b5c8.js → frontend_dist/_next/static/chunks/3419-715ca383fa15a5ef.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3437-b4d6a037cf5781f8.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/3943-c9fb980f03df6450.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/4267-cb102e060a43d9bd.js +1 -0
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/4366-93e09e5a4a7e182c.js → frontend_dist/_next/static/chunks/4366-3e52497942acbafe.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{4783-1a21d9be47574bba.js → 4783-422429203610c318.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/5810-e26a0768db1cfdba.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{5896-14e5a23b1c6a0769.js → 5896-7b8e36634d7d94eb.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{6285-e9b45335bfb9ccaf.js → 6285-648f9a732e100b2f.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/6798-b904395b0c18647b.js +1 -0
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/7022-070ec0144a4d029c.js → frontend_dist/_next/static/chunks/7022-e76cae3ba5ee5312.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/722-900f786d24f91b2e.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{7361-694e1e4fb9c97d68.js → 7361-6c5c9063b9f91700.js} +1 -1
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/8146-92e7ccfed169ee9c.js → frontend_dist/_next/static/chunks/8146-27f0e31f309897a5.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/845-9a73c65fe3fdc328.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/8487-8e1c09546dff4dbf.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/9264-cc44b07f248707b0.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/9618-4eb49cdbd1ba11d7.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{976-18c98af60b76f1a7.js → 976-0a8c2c4d7acd957b.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/_app-78c4a077a2f279c2.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/files-b37d221eb5ddc248.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/global-hooks/[...slug]-7adc543fc490367a.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/global-hooks-51d366993f6dd449.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/{files-449a022f2f0f2d94.js → files-fe6e73463a20d67c.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{manage-f83deb790548693b.js → manage-d8a38b5d1f50e798.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills/[...slug]-9adc2974aada27ba.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills-51b1311dff2a974e.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-2333e524d34b474a.js +1 -0
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/monitors-e051057d9fe94f23.js → frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors-6d1afeb4a84f50f7.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/runs/[run]-1ff9bb8e22ca1e75.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/settings-11363aa58d51f4e1.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers/[...slug]-779c3ef0676a12ac.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers-bbea9a088657404a.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines-3737f2b0afc2ede3.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/account/profile-3c8f062913c66f3e.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/preferences-c1f4ed17d501ccca.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/triggers-8bdd858240d5dbf6.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/version-control-dd4fb405695f74bf.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 +5 -5
- mage_ai/server/frontend_dist/global-hooks.html +5 -5
- 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 +20 -20
- 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 +5 -5
- 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/aoO6jYZLVlUGCCdY-wmy8/_buildManifest.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/{1749-9a6276b2918fdae1.js → 1749-bf512b4dabbab7fa.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/{1952-ac7722e8b1ab88fe.js → 1952-57858e7445d24413.js} +1 -1
- mage_ai/server/{frontend_dist/_next/static/chunks/2714-1e79e9f2e998b544.js → frontend_dist_base_path_template/_next/static/chunks/2714-68fef54789d7eaeb.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/2717-92cdffd87b6f6e05.js +1 -0
- mage_ai/server/{frontend_dist/_next/static/chunks/3419-f8d518d024e7b5c8.js → frontend_dist_base_path_template/_next/static/chunks/3419-715ca383fa15a5ef.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/3437-b4d6a037cf5781f8.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/3943-c9fb980f03df6450.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/4267-cb102e060a43d9bd.js +1 -0
- mage_ai/server/{frontend_dist/_next/static/chunks/4366-93e09e5a4a7e182c.js → frontend_dist_base_path_template/_next/static/chunks/4366-3e52497942acbafe.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/{4783-1a21d9be47574bba.js → 4783-422429203610c318.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/5810-e26a0768db1cfdba.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/{5896-14e5a23b1c6a0769.js → 5896-7b8e36634d7d94eb.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/{6285-e9b45335bfb9ccaf.js → 6285-648f9a732e100b2f.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/6798-b904395b0c18647b.js +1 -0
- mage_ai/server/{frontend_dist/_next/static/chunks/7022-070ec0144a4d029c.js → frontend_dist_base_path_template/_next/static/chunks/7022-e76cae3ba5ee5312.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/722-900f786d24f91b2e.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/{7361-694e1e4fb9c97d68.js → 7361-6c5c9063b9f91700.js} +1 -1
- mage_ai/server/{frontend_dist/_next/static/chunks/8146-92e7ccfed169ee9c.js → frontend_dist_base_path_template/_next/static/chunks/8146-27f0e31f309897a5.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/845-9a73c65fe3fdc328.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/8487-8e1c09546dff4dbf.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/9264-cc44b07f248707b0.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/9618-4eb49cdbd1ba11d7.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/{976-18c98af60b76f1a7.js → 976-0a8c2c4d7acd957b.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/_app-78c4a077a2f279c2.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/files-b37d221eb5ddc248.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/global-hooks/[...slug]-7adc543fc490367a.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/global-hooks-51d366993f6dd449.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/manage/{files-449a022f2f0f2d94.js → files-fe6e73463a20d67c.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/{manage-f83deb790548693b.js → manage-d8a38b5d1f50e798.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/backfills/[...slug]-9adc2974aada27ba.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/backfills-51b1311dff2a974e.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/edit-2333e524d34b474a.js +1 -0
- mage_ai/server/{frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors-e051057d9fe94f23.js → frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/monitors-6d1afeb4a84f50f7.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/runs/[run]-1ff9bb8e22ca1e75.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/settings-11363aa58d51f4e1.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/triggers/[...slug]-779c3ef0676a12ac.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/triggers-bbea9a088657404a.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines-3737f2b0afc2ede3.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/account/profile-3c8f062913c66f3e.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/preferences-c1f4ed17d501ccca.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/triggers-8bdd858240d5dbf6.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/version-control-dd4fb405695f74bf.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 +5 -5
- mage_ai/server/frontend_dist_base_path_template/files.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/global-data-products/[...slug].html +5 -5
- mage_ai/server/frontend_dist_base_path_template/global-data-products.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/global-hooks/[...slug].html +5 -5
- mage_ai/server/frontend_dist_base_path_template/global-hooks.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/index.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/manage/files.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/manage/settings.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/manage/users/[user].html +5 -5
- mage_ai/server/frontend_dist_base_path_template/manage/users/new.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/manage/users.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/manage.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/oauth.html +4 -4
- mage_ai/server/frontend_dist_base_path_template/overview.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/pipeline-runs.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/backfills/[...slug].html +5 -5
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/backfills.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/dashboard.html +5 -5
- 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 +5 -5
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/monitors/block-runs.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/monitors/block-runtime.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/monitors.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/runs/[run].html +5 -5
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/runs.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/settings.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/syncs.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/triggers/[...slug].html +5 -5
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/triggers.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline].html +2 -2
- mage_ai/server/frontend_dist_base_path_template/pipelines.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/settings/account/profile.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/permissions/[...slug].html +5 -5
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/permissions.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/preferences.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/roles/[...slug].html +5 -5
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/roles.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/sync-data.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/users/[...slug].html +5 -5
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/users.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/settings.html +2 -2
- mage_ai/server/frontend_dist_base_path_template/sign-in.html +23 -23
- mage_ai/server/frontend_dist_base_path_template/templates/[...slug].html +5 -5
- mage_ai/server/frontend_dist_base_path_template/templates.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/terminal.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/test.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/triggers.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/version-control.html +5 -5
- mage_ai/server/server.py +9 -3
- mage_ai/services/k8s/job_manager.py +1 -0
- mage_ai/settings/repo.py +3 -0
- mage_ai/shared/files.py +47 -0
- mage_ai/shared/models.py +1 -0
- mage_ai/streaming/constants.py +1 -0
- mage_ai/streaming/sinks/postgres.py +2 -0
- mage_ai/streaming/sinks/rabbitmq.py +76 -0
- mage_ai/streaming/sinks/sink_factory.py +4 -0
- mage_ai/tests/api/operations/test_operations_with_hooks.py +136 -91
- mage_ai/tests/api/policies/test_oauth_policy.py +38 -0
- mage_ai/tests/data_preparation/models/global_hooks/test_global_hooks.py +33 -8
- mage_ai/tests/data_preparation/models/global_hooks/test_hook.py +82 -38
- mage_ai/tests/data_preparation/models/global_hooks/test_predicates.py +803 -0
- mage_ai/tests/data_preparation/models/global_hooks/test_utils.py +6 -1
- mage_ai/tests/data_preparation/models/test_block.py +26 -0
- mage_ai/tests/data_preparation/models/test_pipeline.py +10 -0
- mage_ai/tests/factory.py +40 -2
- mage_ai/tests/orchestration/test_pipeline_scheduler.py +82 -1
- mage_ai/tests/services/k8s/test_job_manager.py +16 -0
- mage_ai/tests/shared/mixins.py +60 -23
- mage_ai/tests/streaming/sinks/test_rabbitmq.py +36 -0
- {mage_ai-0.9.46.dist-info → mage_ai-0.9.47.dist-info}/METADATA +7 -4
- {mage_ai-0.9.46.dist-info → mage_ai-0.9.47.dist-info}/RECORD +257 -243
- {mage_ai-0.9.46.dist-info → mage_ai-0.9.47.dist-info}/WHEEL +1 -1
- mage_ai/server/frontend_dist/_next/static/9jB4XPuz6BzxBcG9VNao5/_buildManifest.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3943-9e1105393a3be0de.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/4267-fd4d8049e83178de.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/5810-12eadc488265d55b.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/595-0d174b1f9fbfce4f.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/6333-bc1b433b428a9095.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/722-a1584445357a276c.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/8487-032ef9b17d20aad9.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/9264-1d4f0327d42fed91.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/9618-2c5045255ac5a6e7.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/_app-ebef928183f9a3bb.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/files-0f2d4be6fdca86ca.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/global-hooks/[...slug]-77edfa32d000e88b.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/global-hooks-e561ae38cf5592e8.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills/[...slug]-10e9a2d19541caa2.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills-c8d3a5289ab93f88.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-ff7e9108502f5716.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/runs/[run]-0691711636fa95c7.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/settings-2914e326a5f1ffe0.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers/[...slug]-3a7500e6e53084d3.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers-c0e551d265a8d467.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines-e47db5c3eaf683af.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/account/profile-55ac955dfa9a5a8d.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/preferences-29c92a9bc54ae5cd.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/triggers-572d82d6eb7a5d43.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/version-control-2d26d80370a2e481.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/3943-9e1105393a3be0de.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/4267-fd4d8049e83178de.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/5810-12eadc488265d55b.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/595-0d174b1f9fbfce4f.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/6333-bc1b433b428a9095.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/722-a1584445357a276c.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/8487-032ef9b17d20aad9.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/9264-1d4f0327d42fed91.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/9618-2c5045255ac5a6e7.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/_app-ebef928183f9a3bb.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/files-0f2d4be6fdca86ca.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/global-hooks/[...slug]-77edfa32d000e88b.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/global-hooks-e561ae38cf5592e8.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/backfills/[...slug]-10e9a2d19541caa2.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/backfills-c8d3a5289ab93f88.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/edit-ff7e9108502f5716.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/runs/[run]-0691711636fa95c7.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/settings-2914e326a5f1ffe0.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/triggers/[...slug]-3a7500e6e53084d3.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/triggers-c0e551d265a8d467.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines-e47db5c3eaf683af.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/account/profile-55ac955dfa9a5a8d.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/preferences-29c92a9bc54ae5cd.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/triggers-572d82d6eb7a5d43.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/version-control-2d26d80370a2e481.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/uPDjJYpJMst1q6psbRyte/_buildManifest.js +0 -1
- /mage_ai/server/frontend_dist/_next/static/{9jB4XPuz6BzxBcG9VNao5 → N3FS4bHv0jpYeeg672uYK}/_ssgManifest.js +0 -0
- /mage_ai/server/frontend_dist_base_path_template/_next/static/{uPDjJYpJMst1q6psbRyte → aoO6jYZLVlUGCCdY-wmy8}/_ssgManifest.js +0 -0
- {mage_ai-0.9.46.dist-info → mage_ai-0.9.47.dist-info}/LICENSE +0 -0
- {mage_ai-0.9.46.dist-info → mage_ai-0.9.47.dist-info}/entry_points.txt +0 -0
- {mage_ai-0.9.46.dist-info → mage_ai-0.9.47.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,803 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import random
|
|
3
|
+
import uuid
|
|
4
|
+
from typing import Any, Dict, List, Tuple, Union
|
|
5
|
+
|
|
6
|
+
from mage_ai.api.resources.BaseResource import BaseResource
|
|
7
|
+
from mage_ai.api.resources.GenericResource import GenericResource
|
|
8
|
+
from mage_ai.data_preparation.models.block import Block
|
|
9
|
+
from mage_ai.data_preparation.models.constants import BlockType
|
|
10
|
+
from mage_ai.data_preparation.models.global_hooks.constants import (
|
|
11
|
+
PredicateAndOrOperator,
|
|
12
|
+
PredicateObjectType,
|
|
13
|
+
PredicateOperator,
|
|
14
|
+
PredicateValueDataType,
|
|
15
|
+
)
|
|
16
|
+
from mage_ai.data_preparation.models.global_hooks.predicates import (
|
|
17
|
+
HookPredicate,
|
|
18
|
+
PredicateValueType,
|
|
19
|
+
)
|
|
20
|
+
from mage_ai.data_preparation.models.pipeline import Pipeline
|
|
21
|
+
from mage_ai.shared.array import find
|
|
22
|
+
from mage_ai.shared.hash import dig, ignore_keys, merge_dict, set_value
|
|
23
|
+
from mage_ai.tests.base_test import AsyncDBTestCase
|
|
24
|
+
|
|
25
|
+
first_object_key = 'first_object_key'
|
|
26
|
+
model = dict(power=100)
|
|
27
|
+
data_type_to_value_mapping = {
|
|
28
|
+
PredicateValueDataType.BOOLEAN: True,
|
|
29
|
+
PredicateValueDataType.DICTIONARY: model,
|
|
30
|
+
PredicateValueDataType.FLOAT: 1.0,
|
|
31
|
+
PredicateValueDataType.INTEGER: 3,
|
|
32
|
+
PredicateValueDataType.LIST: [model],
|
|
33
|
+
PredicateValueDataType.STRING: json.dumps(model),
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def build_operation_resource_settings(
|
|
38
|
+
right_value: Union[bool, Dict, float, int, List, str],
|
|
39
|
+
first_object_key=first_object_key,
|
|
40
|
+
repo_path: str = None,
|
|
41
|
+
) -> Dict:
|
|
42
|
+
settings = {
|
|
43
|
+
BaseResource.__name__: dict(
|
|
44
|
+
right_object_keys=[first_object_key],
|
|
45
|
+
operation_resource=GenericResource({
|
|
46
|
+
first_object_key: right_value,
|
|
47
|
+
}, None),
|
|
48
|
+
),
|
|
49
|
+
dict.__name__: dict(
|
|
50
|
+
right_object_keys=[first_object_key],
|
|
51
|
+
operation_resource={
|
|
52
|
+
first_object_key: right_value,
|
|
53
|
+
},
|
|
54
|
+
),
|
|
55
|
+
list.__name__: dict(
|
|
56
|
+
right_object_keys=[0, first_object_key],
|
|
57
|
+
operation_resource=[
|
|
58
|
+
GenericResource({
|
|
59
|
+
first_object_key: right_value,
|
|
60
|
+
}, None),
|
|
61
|
+
],
|
|
62
|
+
),
|
|
63
|
+
Pipeline.__name__: dict(
|
|
64
|
+
right_object_keys=['variables', first_object_key],
|
|
65
|
+
operation_resource=Pipeline(uuid.uuid4().hex, config=dict(variables={
|
|
66
|
+
first_object_key: right_value,
|
|
67
|
+
})),
|
|
68
|
+
),
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if repo_path:
|
|
72
|
+
settings[Block.__name__] = dict(
|
|
73
|
+
right_object_keys=['configuration', first_object_key],
|
|
74
|
+
operation_resource=Block.create(
|
|
75
|
+
uuid.uuid4().hex,
|
|
76
|
+
BlockType.DATA_LOADER,
|
|
77
|
+
repo_path,
|
|
78
|
+
configuration={
|
|
79
|
+
first_object_key: right_value,
|
|
80
|
+
},
|
|
81
|
+
),
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
return settings
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class PredicatesTest(AsyncDBTestCase):
|
|
88
|
+
def test_validate_operator_includes(self):
|
|
89
|
+
value = uuid.uuid4().hex
|
|
90
|
+
|
|
91
|
+
for left_value_data_type, left_value, left_value_not_included in [
|
|
92
|
+
(
|
|
93
|
+
PredicateValueDataType.BOOLEAN,
|
|
94
|
+
True,
|
|
95
|
+
False,
|
|
96
|
+
),
|
|
97
|
+
(
|
|
98
|
+
PredicateValueDataType.DICTIONARY,
|
|
99
|
+
dict(mage=value),
|
|
100
|
+
dict(mage=value, more=value),
|
|
101
|
+
),
|
|
102
|
+
(
|
|
103
|
+
PredicateValueDataType.FLOAT,
|
|
104
|
+
1.0,
|
|
105
|
+
3.0,
|
|
106
|
+
),
|
|
107
|
+
(
|
|
108
|
+
PredicateValueDataType.INTEGER,
|
|
109
|
+
3,
|
|
110
|
+
7,
|
|
111
|
+
),
|
|
112
|
+
(
|
|
113
|
+
PredicateValueDataType.LIST,
|
|
114
|
+
[value],
|
|
115
|
+
[value, value],
|
|
116
|
+
),
|
|
117
|
+
(
|
|
118
|
+
PredicateValueDataType.STRING,
|
|
119
|
+
value,
|
|
120
|
+
value + value,
|
|
121
|
+
),
|
|
122
|
+
]:
|
|
123
|
+
for left_value_use, assertion_func in [
|
|
124
|
+
(left_value, self.assertTrue),
|
|
125
|
+
(left_value_not_included, self.assertFalse),
|
|
126
|
+
]:
|
|
127
|
+
predicate = HookPredicate.load(
|
|
128
|
+
right_value=[left_value],
|
|
129
|
+
right_value_type=PredicateValueType.load(
|
|
130
|
+
value_data_type=PredicateValueDataType.LIST,
|
|
131
|
+
value_type=PredicateValueType.load(
|
|
132
|
+
value_data_type=left_value_data_type,
|
|
133
|
+
),
|
|
134
|
+
),
|
|
135
|
+
operator=PredicateOperator.INCLUDES,
|
|
136
|
+
left_value=left_value_use,
|
|
137
|
+
left_value_type=PredicateValueType.load(
|
|
138
|
+
value_data_type=left_value_data_type,
|
|
139
|
+
),
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
assertion_func(predicate.validate(None))
|
|
143
|
+
|
|
144
|
+
def test_validate_using_object_types(self):
|
|
145
|
+
value = uuid.uuid4().hex
|
|
146
|
+
|
|
147
|
+
right_object_keys = ['fire']
|
|
148
|
+
right_value_type = PredicateValueType.load(
|
|
149
|
+
value_data_type=PredicateValueDataType.STRING,
|
|
150
|
+
)
|
|
151
|
+
right_object = set_value({}, right_object_keys, value)
|
|
152
|
+
|
|
153
|
+
operator = PredicateOperator.EQUALS
|
|
154
|
+
left_object_keys = ['wind', 'level']
|
|
155
|
+
left_value_type = right_value_type
|
|
156
|
+
left_object = set_value({}, left_object_keys, value)
|
|
157
|
+
|
|
158
|
+
object_types = [
|
|
159
|
+
PredicateObjectType.ERROR,
|
|
160
|
+
PredicateObjectType.HOOK,
|
|
161
|
+
PredicateObjectType.META,
|
|
162
|
+
PredicateObjectType.METADATA,
|
|
163
|
+
PredicateObjectType.PAYLOAD,
|
|
164
|
+
PredicateObjectType.QUERY,
|
|
165
|
+
PredicateObjectType.RESOURCE,
|
|
166
|
+
PredicateObjectType.RESOURCE_ID,
|
|
167
|
+
PredicateObjectType.RESOURCE_PARENT_ID,
|
|
168
|
+
PredicateObjectType.USER,
|
|
169
|
+
]
|
|
170
|
+
for right_object_type in object_types:
|
|
171
|
+
left_object_type = find(
|
|
172
|
+
lambda x, right_object_type=right_object_type: x != right_object_type,
|
|
173
|
+
object_types,
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
for left_value_use, assertion_func in [
|
|
177
|
+
(value, self.assertTrue),
|
|
178
|
+
(value + value, self.assertFalse),
|
|
179
|
+
]:
|
|
180
|
+
left_object_use = set_value(
|
|
181
|
+
left_object,
|
|
182
|
+
left_object_keys,
|
|
183
|
+
left_value_use,
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
right_object_keys_use = right_object_keys
|
|
187
|
+
right_object_use = right_object
|
|
188
|
+
left_object_keys_use = left_object_keys
|
|
189
|
+
left_object_use = left_object
|
|
190
|
+
|
|
191
|
+
if right_object_type in [
|
|
192
|
+
PredicateObjectType.RESOURCE_ID,
|
|
193
|
+
PredicateObjectType.RESOURCE_PARENT_ID,
|
|
194
|
+
]:
|
|
195
|
+
right_object_use = dig(right_object_use, right_object_keys)
|
|
196
|
+
right_object_keys_use = None
|
|
197
|
+
|
|
198
|
+
if left_object_type in [
|
|
199
|
+
PredicateObjectType.RESOURCE_ID,
|
|
200
|
+
PredicateObjectType.RESOURCE_PARENT_ID,
|
|
201
|
+
]:
|
|
202
|
+
left_object_use = dig(left_object_use, left_object_keys)
|
|
203
|
+
left_object_keys_use = None
|
|
204
|
+
|
|
205
|
+
predicate = HookPredicate.load(
|
|
206
|
+
right_object_keys=right_object_keys_use,
|
|
207
|
+
right_object_type=right_object_type,
|
|
208
|
+
right_value_type=right_value_type,
|
|
209
|
+
operator=operator,
|
|
210
|
+
left_object_keys=left_object_keys_use,
|
|
211
|
+
left_object_type=left_object_type,
|
|
212
|
+
left_value_type=left_value_type,
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
settings = {
|
|
216
|
+
right_object_type.value: right_object_use,
|
|
217
|
+
left_object_type.value: left_object_use,
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
assertion_func(predicate.validate(None, **settings))
|
|
221
|
+
|
|
222
|
+
def test_validate_using_operation_resource(self):
|
|
223
|
+
right_value = uuid.uuid4().hex
|
|
224
|
+
|
|
225
|
+
for operation_resource_class_name, settings in build_operation_resource_settings(
|
|
226
|
+
right_value,
|
|
227
|
+
repo_path=self.repo_path,
|
|
228
|
+
).items():
|
|
229
|
+
right_object_keys = settings['right_object_keys']
|
|
230
|
+
operation_resource = settings['operation_resource']
|
|
231
|
+
|
|
232
|
+
for left_value_use, assertion_func in [
|
|
233
|
+
(right_value, self.assertTrue),
|
|
234
|
+
(right_value + right_value, self.assertFalse),
|
|
235
|
+
]:
|
|
236
|
+
right_object_keys_use = right_object_keys
|
|
237
|
+
if list.__name__ == operation_resource_class_name:
|
|
238
|
+
right_object_keys_use = right_object_keys[1:]
|
|
239
|
+
|
|
240
|
+
predicate = HookPredicate.load(
|
|
241
|
+
right_object_keys=right_object_keys_use,
|
|
242
|
+
right_object_type=PredicateObjectType.OPERATION_RESOURCE,
|
|
243
|
+
right_value_type=PredicateValueType.load(
|
|
244
|
+
value_data_type=PredicateValueDataType.STRING,
|
|
245
|
+
),
|
|
246
|
+
operator=PredicateOperator.EQUALS,
|
|
247
|
+
left_value=left_value_use,
|
|
248
|
+
left_value_type=PredicateValueType.load(
|
|
249
|
+
value_data_type=PredicateValueDataType.STRING,
|
|
250
|
+
),
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
assertion_func(predicate.validate(operation_resource))
|
|
254
|
+
|
|
255
|
+
def test_validate_multiple_operation_resources(self):
|
|
256
|
+
value = uuid.uuid4().hex
|
|
257
|
+
resource = dict(fire=value)
|
|
258
|
+
|
|
259
|
+
operation_resources_groups = [
|
|
260
|
+
(
|
|
261
|
+
self.assertTrue,
|
|
262
|
+
[resource, resource],
|
|
263
|
+
),
|
|
264
|
+
(
|
|
265
|
+
self.assertFalse,
|
|
266
|
+
[resource, dict(fire=value + value)],
|
|
267
|
+
),
|
|
268
|
+
]
|
|
269
|
+
|
|
270
|
+
for assertion_func, operation_resources in operation_resources_groups:
|
|
271
|
+
predicate = HookPredicate.load(
|
|
272
|
+
right_object_keys=['fire'],
|
|
273
|
+
right_object_type=PredicateObjectType.OPERATION_RESOURCE,
|
|
274
|
+
right_value_type=PredicateValueType.load(
|
|
275
|
+
value_data_type=PredicateValueDataType.STRING,
|
|
276
|
+
),
|
|
277
|
+
operator=PredicateOperator.EQUALS,
|
|
278
|
+
left_value=value,
|
|
279
|
+
left_value_type=PredicateValueType.load(
|
|
280
|
+
value_data_type=PredicateValueDataType.STRING,
|
|
281
|
+
),
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
assertion_func(predicate.validate(operation_resources))
|
|
285
|
+
|
|
286
|
+
def test_validate_with_nested_predicates(self):
|
|
287
|
+
(
|
|
288
|
+
operation_resource,
|
|
289
|
+
predicate,
|
|
290
|
+
predicates_level_1,
|
|
291
|
+
predicates_level_2,
|
|
292
|
+
predicates_level_3,
|
|
293
|
+
) = build_nested_predicates()
|
|
294
|
+
|
|
295
|
+
for pred_dicts in [
|
|
296
|
+
predicates_level_1,
|
|
297
|
+
predicates_level_2,
|
|
298
|
+
predicates_level_3,
|
|
299
|
+
]:
|
|
300
|
+
for key, arr in pred_dicts.items():
|
|
301
|
+
for predicate_inner in arr:
|
|
302
|
+
assertion_func = self.assertTrue if 'succeed' == key else self.assertFalse
|
|
303
|
+
|
|
304
|
+
for predicate_inner in arr:
|
|
305
|
+
assertion_func(predicate_inner.validate(operation_resource))
|
|
306
|
+
|
|
307
|
+
self.assertTrue(predicate.validate(operation_resource))
|
|
308
|
+
|
|
309
|
+
def test_validate_with_nested_predicates_other_combinations(self):
|
|
310
|
+
(
|
|
311
|
+
operation_resource,
|
|
312
|
+
predicate,
|
|
313
|
+
predicates_level_1,
|
|
314
|
+
predicates_level_2,
|
|
315
|
+
predicates_level_3,
|
|
316
|
+
) = build_nested_predicates()
|
|
317
|
+
|
|
318
|
+
predicates_failed = []
|
|
319
|
+
predicates_succeed = [predicate]
|
|
320
|
+
|
|
321
|
+
for pred_dict in [
|
|
322
|
+
predicates_level_1,
|
|
323
|
+
predicates_level_2,
|
|
324
|
+
predicates_level_3,
|
|
325
|
+
]:
|
|
326
|
+
predicates_failed.extend(pred_dict['failed'])
|
|
327
|
+
predicates_succeed.extend(pred_dict['succeed'])
|
|
328
|
+
|
|
329
|
+
predicates_failed_count = len(predicates_failed)
|
|
330
|
+
predicates_succeed_count = len(predicates_succeed)
|
|
331
|
+
predicates_count = predicates_failed_count + predicates_succeed_count
|
|
332
|
+
|
|
333
|
+
def _get_and_or_operator() -> PredicateAndOrOperator:
|
|
334
|
+
return random.choice([v for v in PredicateAndOrOperator])
|
|
335
|
+
|
|
336
|
+
def _get_predicates(
|
|
337
|
+
operator: PredicateAndOrOperator,
|
|
338
|
+
force_failure: bool = False,
|
|
339
|
+
predicates_failed=predicates_failed,
|
|
340
|
+
predicates_succeed=predicates_succeed,
|
|
341
|
+
predicates_succeed_count=predicates_succeed_count,
|
|
342
|
+
) -> List[HookPredicate]:
|
|
343
|
+
failed_sample = 0
|
|
344
|
+
succeed_sample = random.randint(1, predicates_succeed_count)
|
|
345
|
+
|
|
346
|
+
if PredicateAndOrOperator.OR == operator or force_failure:
|
|
347
|
+
failed_sample = random.randint(1, predicates_failed_count)
|
|
348
|
+
|
|
349
|
+
arr_failed = random.sample(predicates_failed, failed_sample)
|
|
350
|
+
arr_succeed = random.sample(predicates_succeed, succeed_sample)
|
|
351
|
+
|
|
352
|
+
if force_failure:
|
|
353
|
+
return arr_failed
|
|
354
|
+
|
|
355
|
+
return arr_failed + arr_succeed
|
|
356
|
+
|
|
357
|
+
levels = 10
|
|
358
|
+
|
|
359
|
+
def _build_all(
|
|
360
|
+
# force_failure_at_level: int = None,
|
|
361
|
+
levels=levels,
|
|
362
|
+
predicates_count=predicates_count,
|
|
363
|
+
get_and_or_operator=_get_and_or_operator,
|
|
364
|
+
get_predicates=_get_predicates,
|
|
365
|
+
) -> List[List[HookPredicate]]:
|
|
366
|
+
predicates_in_reverse_level_order = []
|
|
367
|
+
for i1 in range(levels):
|
|
368
|
+
row = []
|
|
369
|
+
predicates_to_create_at_this_level = random.randint(
|
|
370
|
+
predicates_count - i1, predicates_count,
|
|
371
|
+
)
|
|
372
|
+
for _i2 in range(predicates_to_create_at_this_level):
|
|
373
|
+
operator = get_and_or_operator()
|
|
374
|
+
predicates = get_predicates(
|
|
375
|
+
operator,
|
|
376
|
+
# force_failure=(
|
|
377
|
+
# force_failure_at_level is not None and
|
|
378
|
+
# force_failure_at_level == levels - i1
|
|
379
|
+
# ),
|
|
380
|
+
)
|
|
381
|
+
|
|
382
|
+
pred = HookPredicate.load(
|
|
383
|
+
and_or_operator=operator,
|
|
384
|
+
predicates=predicates,
|
|
385
|
+
)
|
|
386
|
+
row.append(pred)
|
|
387
|
+
|
|
388
|
+
if i1 >= 1:
|
|
389
|
+
previous_row = predicates_in_reverse_level_order[i1 - 1]
|
|
390
|
+
batch_count = round(len(previous_row) / len(row))
|
|
391
|
+
|
|
392
|
+
for idx, pred in enumerate(row):
|
|
393
|
+
start_index = idx * batch_count
|
|
394
|
+
end_index = (idx + 1) * batch_count
|
|
395
|
+
pred.predicates += previous_row[start_index:end_index]
|
|
396
|
+
|
|
397
|
+
predicates_in_reverse_level_order.append(row)
|
|
398
|
+
|
|
399
|
+
return predicates_in_reverse_level_order
|
|
400
|
+
|
|
401
|
+
all_succeed = _build_all()
|
|
402
|
+
|
|
403
|
+
for i in range(levels):
|
|
404
|
+
level_to_run = levels - (i + 1)
|
|
405
|
+
for predicate0 in all_succeed[level_to_run]:
|
|
406
|
+
self.assertTrue(predicate0.validate(operation_resource))
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
class CustomTestError(Exception):
|
|
410
|
+
pass
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
def get_right_left_value(
|
|
414
|
+
right_value: Union[bool, Dict, float, int, List, str],
|
|
415
|
+
data_type: PredicateValueDataType,
|
|
416
|
+
object_type: PredicateObjectType,
|
|
417
|
+
operator: PredicateOperator,
|
|
418
|
+
) -> Tuple[Union[bool, Dict, float, int, List, str], Union[bool, Dict, float, int, List, str]]:
|
|
419
|
+
if PredicateValueDataType.BOOLEAN == data_type:
|
|
420
|
+
if PredicateOperator.EQUALS == operator:
|
|
421
|
+
return (True, True)
|
|
422
|
+
elif PredicateOperator.GREATER_THAN == operator:
|
|
423
|
+
return (False, True)
|
|
424
|
+
elif PredicateOperator.INCLUDES == operator:
|
|
425
|
+
raise CustomTestError
|
|
426
|
+
elif PredicateOperator.LESS_THAN == operator:
|
|
427
|
+
return (True, False)
|
|
428
|
+
elif PredicateOperator.NOT_EQUALS == operator:
|
|
429
|
+
return (right_value, not right_value)
|
|
430
|
+
elif PredicateOperator.NOT_INCLUDES == operator:
|
|
431
|
+
raise CustomTestError
|
|
432
|
+
elif PredicateOperator.NOT_PRESENT == operator:
|
|
433
|
+
return (right_value, '')
|
|
434
|
+
|
|
435
|
+
if PredicateValueDataType.DICTIONARY == data_type:
|
|
436
|
+
if operator in [
|
|
437
|
+
PredicateOperator.INCLUDES,
|
|
438
|
+
PredicateOperator.NOT_INCLUDES,
|
|
439
|
+
]:
|
|
440
|
+
raise CustomTestError
|
|
441
|
+
|
|
442
|
+
if PredicateOperator.NOT_EQUALS == operator:
|
|
443
|
+
return [right_value, merge_dict(right_value, dict(
|
|
444
|
+
random=uuid.uuid4().hex,
|
|
445
|
+
))]
|
|
446
|
+
|
|
447
|
+
if PredicateOperator.GREATER_THAN == operator:
|
|
448
|
+
return (right_value, merge_dict(right_value, dict(
|
|
449
|
+
random=uuid.uuid4().hex,
|
|
450
|
+
)))
|
|
451
|
+
|
|
452
|
+
if PredicateOperator.LESS_THAN == operator:
|
|
453
|
+
return (merge_dict(right_value, dict(
|
|
454
|
+
random=uuid.uuid4().hex,
|
|
455
|
+
)), right_value)
|
|
456
|
+
|
|
457
|
+
if PredicateOperator.NOT_PRESENT == operator:
|
|
458
|
+
return (right_value, None)
|
|
459
|
+
|
|
460
|
+
if data_type in [PredicateValueDataType.FLOAT, PredicateValueDataType.INTEGER]:
|
|
461
|
+
if PredicateOperator.GREATER_THAN == operator:
|
|
462
|
+
return (right_value, right_value + 1)
|
|
463
|
+
elif PredicateOperator.INCLUDES == operator:
|
|
464
|
+
raise CustomTestError
|
|
465
|
+
elif PredicateOperator.LESS_THAN == operator:
|
|
466
|
+
return (right_value + 1, right_value)
|
|
467
|
+
elif PredicateOperator.NOT_EQUALS == operator:
|
|
468
|
+
return (right_value, right_value - right_value)
|
|
469
|
+
elif PredicateOperator.NOT_INCLUDES == operator:
|
|
470
|
+
raise CustomTestError
|
|
471
|
+
elif PredicateOperator.NOT_PRESENT == operator:
|
|
472
|
+
return (right_value, None)
|
|
473
|
+
|
|
474
|
+
if PredicateValueDataType.LIST == data_type:
|
|
475
|
+
if operator in [
|
|
476
|
+
PredicateOperator.INCLUDES,
|
|
477
|
+
PredicateOperator.NOT_INCLUDES,
|
|
478
|
+
]:
|
|
479
|
+
raise CustomTestError
|
|
480
|
+
|
|
481
|
+
if PredicateOperator.NOT_EQUALS == operator:
|
|
482
|
+
return (right_value, right_value + right_value)
|
|
483
|
+
|
|
484
|
+
if PredicateOperator.GREATER_THAN == operator:
|
|
485
|
+
return (right_value, right_value + right_value)
|
|
486
|
+
|
|
487
|
+
if PredicateOperator.LESS_THAN == operator:
|
|
488
|
+
return (right_value + right_value, right_value)
|
|
489
|
+
|
|
490
|
+
if PredicateOperator.NOT_PRESENT == operator:
|
|
491
|
+
return (right_value, None)
|
|
492
|
+
|
|
493
|
+
if PredicateValueDataType.STRING == data_type:
|
|
494
|
+
if PredicateOperator.NOT_EQUALS == operator:
|
|
495
|
+
return (right_value, right_value + right_value)
|
|
496
|
+
|
|
497
|
+
if PredicateOperator.GREATER_THAN == operator:
|
|
498
|
+
return ('A', 'a')
|
|
499
|
+
|
|
500
|
+
if PredicateOperator.LESS_THAN == operator:
|
|
501
|
+
return ('a', 'A')
|
|
502
|
+
|
|
503
|
+
if PredicateOperator.NOT_INCLUDES == operator:
|
|
504
|
+
return (right_value, right_value + right_value)
|
|
505
|
+
|
|
506
|
+
if PredicateOperator.NOT_PRESENT == operator:
|
|
507
|
+
return (right_value, None)
|
|
508
|
+
|
|
509
|
+
return (right_value, right_value)
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
def build_test_validate(
|
|
513
|
+
data_type: PredicateValueDataType,
|
|
514
|
+
right_value: Any,
|
|
515
|
+
object_type: PredicateObjectType,
|
|
516
|
+
operator: PredicateOperator,
|
|
517
|
+
left_value: Any,
|
|
518
|
+
settings: Dict,
|
|
519
|
+
):
|
|
520
|
+
async def _test_validate(
|
|
521
|
+
self,
|
|
522
|
+
data_type=data_type,
|
|
523
|
+
right_value=right_value,
|
|
524
|
+
object_type=object_type,
|
|
525
|
+
operator=operator,
|
|
526
|
+
left_value=left_value,
|
|
527
|
+
settings=settings,
|
|
528
|
+
):
|
|
529
|
+
predicate = HookPredicate.load(
|
|
530
|
+
right_object_keys=settings.get('right_object_keys'),
|
|
531
|
+
right_object_type=object_type,
|
|
532
|
+
right_value=right_value,
|
|
533
|
+
right_value_type=PredicateValueType.load(
|
|
534
|
+
value_data_type=data_type,
|
|
535
|
+
),
|
|
536
|
+
operator=operator,
|
|
537
|
+
left_value=left_value,
|
|
538
|
+
)
|
|
539
|
+
|
|
540
|
+
options = ignore_keys(settings, [
|
|
541
|
+
'right_object_keys',
|
|
542
|
+
'operation_resource',
|
|
543
|
+
])
|
|
544
|
+
|
|
545
|
+
self.assertTrue(predicate.validate(
|
|
546
|
+
settings['operation_resource'],
|
|
547
|
+
**options,
|
|
548
|
+
))
|
|
549
|
+
|
|
550
|
+
return _test_validate
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
for object_type in PredicateObjectType:
|
|
554
|
+
for data_type in PredicateValueDataType:
|
|
555
|
+
for operator in PredicateOperator:
|
|
556
|
+
right_value = data_type_to_value_mapping[data_type]
|
|
557
|
+
left_value = None
|
|
558
|
+
|
|
559
|
+
try:
|
|
560
|
+
right_value, left_value = get_right_left_value(
|
|
561
|
+
right_value,
|
|
562
|
+
data_type=data_type,
|
|
563
|
+
object_type=object_type,
|
|
564
|
+
operator=operator,
|
|
565
|
+
)
|
|
566
|
+
except CustomTestError:
|
|
567
|
+
continue
|
|
568
|
+
|
|
569
|
+
operation_resource_settings = {}
|
|
570
|
+
for tup in build_operation_resource_settings(right_value).items():
|
|
571
|
+
operation_resource_class_name, settings_init = tup
|
|
572
|
+
settings = settings_init.copy()
|
|
573
|
+
|
|
574
|
+
if object_type in [
|
|
575
|
+
PredicateObjectType.RESOURCE_ID,
|
|
576
|
+
PredicateObjectType.RESOURCE_PARENT_ID,
|
|
577
|
+
]:
|
|
578
|
+
settings.update({
|
|
579
|
+
'right_object_keys': None,
|
|
580
|
+
object_type.value: right_value,
|
|
581
|
+
})
|
|
582
|
+
elif PredicateObjectType.OPERATION_RESOURCE != object_type:
|
|
583
|
+
settings.update({
|
|
584
|
+
'right_object_keys': [first_object_key],
|
|
585
|
+
object_type.value: {
|
|
586
|
+
first_object_key: right_value,
|
|
587
|
+
},
|
|
588
|
+
})
|
|
589
|
+
elif list.__name__ == operation_resource_class_name and \
|
|
590
|
+
PredicateObjectType.OPERATION_RESOURCE == object_type:
|
|
591
|
+
|
|
592
|
+
settings.update(dict(right_object_keys=[first_object_key]))
|
|
593
|
+
|
|
594
|
+
operation_resource_settings[operation_resource_class_name] = settings
|
|
595
|
+
|
|
596
|
+
for operation_resource_class_name, settings in operation_resource_settings.items():
|
|
597
|
+
method_name = '_'.join([
|
|
598
|
+
'test_validate',
|
|
599
|
+
'object_type',
|
|
600
|
+
object_type.value,
|
|
601
|
+
'data_type',
|
|
602
|
+
data_type.value,
|
|
603
|
+
'operator',
|
|
604
|
+
operator.value,
|
|
605
|
+
'operation_resource',
|
|
606
|
+
operation_resource_class_name,
|
|
607
|
+
])
|
|
608
|
+
setattr(
|
|
609
|
+
PredicatesTest,
|
|
610
|
+
method_name,
|
|
611
|
+
build_test_validate(
|
|
612
|
+
data_type=data_type,
|
|
613
|
+
right_value=right_value,
|
|
614
|
+
object_type=object_type,
|
|
615
|
+
operator=operator,
|
|
616
|
+
left_value=left_value,
|
|
617
|
+
settings=settings,
|
|
618
|
+
),
|
|
619
|
+
)
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
def build_nested_predicates() -> Tuple[Dict, HookPredicate, Dict, Dict, Dict]:
|
|
623
|
+
operation_resource = dict(
|
|
624
|
+
earth=1,
|
|
625
|
+
fire=2,
|
|
626
|
+
ice=[3],
|
|
627
|
+
laser=4,
|
|
628
|
+
lightning=5,
|
|
629
|
+
power=6,
|
|
630
|
+
water=7,
|
|
631
|
+
wind=8,
|
|
632
|
+
)
|
|
633
|
+
|
|
634
|
+
def _build_settings(**kwargs) -> Dict:
|
|
635
|
+
right_value_type = PredicateValueType.load(
|
|
636
|
+
value_data_type=PredicateValueDataType.INTEGER,
|
|
637
|
+
)
|
|
638
|
+
|
|
639
|
+
return merge_dict(dict(
|
|
640
|
+
right_object_type=PredicateObjectType.OPERATION_RESOURCE,
|
|
641
|
+
right_value_type=right_value_type,
|
|
642
|
+
operator=PredicateOperator.EQUALS,
|
|
643
|
+
left_value_type=right_value_type,
|
|
644
|
+
), kwargs)
|
|
645
|
+
|
|
646
|
+
predicate2_3_or_or_terminal_failed = HookPredicate.load(**_build_settings(
|
|
647
|
+
right_object_type=None,
|
|
648
|
+
right_value_type=None,
|
|
649
|
+
operator=PredicateOperator.PRESENT,
|
|
650
|
+
left_value=None,
|
|
651
|
+
left_value_type=None,
|
|
652
|
+
))
|
|
653
|
+
|
|
654
|
+
predicate2_3_and_and_and_terminal_failed = HookPredicate.load(**_build_settings(
|
|
655
|
+
and_or_operator=PredicateAndOrOperator.AND,
|
|
656
|
+
right_object_keys=['ice'],
|
|
657
|
+
right_value_type=PredicateValueType.load(
|
|
658
|
+
value_data_type=PredicateValueDataType.LIST,
|
|
659
|
+
value_type=PredicateValueType.load(
|
|
660
|
+
value_data_type=PredicateValueDataType.INTEGER,
|
|
661
|
+
),
|
|
662
|
+
),
|
|
663
|
+
operator=PredicateOperator.NOT_INCLUDES,
|
|
664
|
+
left_value=3,
|
|
665
|
+
))
|
|
666
|
+
|
|
667
|
+
predicate2_3_or_or_terminal_succeed = HookPredicate.load(**_build_settings(
|
|
668
|
+
right_object_keys=['power'],
|
|
669
|
+
operator=PredicateOperator.GREATER_THAN_OR_EQUALS,
|
|
670
|
+
left_value=6
|
|
671
|
+
))
|
|
672
|
+
|
|
673
|
+
predicate2_3_and_and_or_terminal_succeed = HookPredicate.load(**_build_settings(
|
|
674
|
+
right_object_keys=['water'],
|
|
675
|
+
operator=PredicateOperator.LESS_THAN_OR_EQUALS,
|
|
676
|
+
left_value=6,
|
|
677
|
+
))
|
|
678
|
+
|
|
679
|
+
predicate2_and_and_succeed = HookPredicate.load(**_build_settings(
|
|
680
|
+
and_or_operator=PredicateAndOrOperator.AND,
|
|
681
|
+
right_object_keys=['wind'],
|
|
682
|
+
operator=PredicateOperator.LESS_THAN_OR_EQUALS,
|
|
683
|
+
predicates=[
|
|
684
|
+
predicate2_3_and_and_or_terminal_succeed,
|
|
685
|
+
predicate2_3_or_or_terminal_succeed,
|
|
686
|
+
],
|
|
687
|
+
left_value=8,
|
|
688
|
+
))
|
|
689
|
+
|
|
690
|
+
predicate2_and_or_succeed = HookPredicate.load(**_build_settings(
|
|
691
|
+
and_or_operator=PredicateAndOrOperator.OR,
|
|
692
|
+
right_object_keys=['water'],
|
|
693
|
+
operator=PredicateOperator.NOT_EQUALS,
|
|
694
|
+
predicates=[
|
|
695
|
+
predicate2_3_and_and_or_terminal_succeed,
|
|
696
|
+
],
|
|
697
|
+
left_value=8,
|
|
698
|
+
))
|
|
699
|
+
|
|
700
|
+
predicate2_or_and_failed = HookPredicate.load(**_build_settings(
|
|
701
|
+
and_or_operator=PredicateAndOrOperator.AND,
|
|
702
|
+
right_object_keys=['ice'],
|
|
703
|
+
right_value_type=PredicateValueType.load(
|
|
704
|
+
value_data_type=PredicateValueDataType.LIST,
|
|
705
|
+
value_type=PredicateValueType.load(
|
|
706
|
+
value_data_type=PredicateValueDataType.INTEGER,
|
|
707
|
+
),
|
|
708
|
+
),
|
|
709
|
+
operator=PredicateOperator.INCLUDES,
|
|
710
|
+
predicates=[
|
|
711
|
+
predicate2_3_and_and_and_terminal_failed,
|
|
712
|
+
predicate2_3_and_and_or_terminal_succeed,
|
|
713
|
+
],
|
|
714
|
+
left_value=3,
|
|
715
|
+
))
|
|
716
|
+
|
|
717
|
+
predicate2_or_or_succeed = HookPredicate.load(**_build_settings(
|
|
718
|
+
and_or_operator=PredicateAndOrOperator.OR,
|
|
719
|
+
right_value_type=None,
|
|
720
|
+
operator=PredicateOperator.NOT_PRESENT,
|
|
721
|
+
predicates=[
|
|
722
|
+
predicate2_3_or_or_terminal_failed,
|
|
723
|
+
predicate2_3_or_or_terminal_succeed,
|
|
724
|
+
],
|
|
725
|
+
left_value=None,
|
|
726
|
+
left_value_type=None,
|
|
727
|
+
))
|
|
728
|
+
|
|
729
|
+
predicate1_and_succeed = HookPredicate.load(**_build_settings(
|
|
730
|
+
and_or_operator=PredicateAndOrOperator.AND,
|
|
731
|
+
right_object_keys=['ice'],
|
|
732
|
+
right_value_type=PredicateValueType.load(
|
|
733
|
+
value_data_type=PredicateValueDataType.LIST,
|
|
734
|
+
value_type=PredicateValueType.load(
|
|
735
|
+
value_data_type=PredicateValueDataType.INTEGER,
|
|
736
|
+
),
|
|
737
|
+
),
|
|
738
|
+
operator=PredicateOperator.INCLUDES,
|
|
739
|
+
predicates=[
|
|
740
|
+
predicate2_and_and_succeed,
|
|
741
|
+
predicate2_and_or_succeed,
|
|
742
|
+
],
|
|
743
|
+
left_value=3,
|
|
744
|
+
))
|
|
745
|
+
|
|
746
|
+
predicate1_or_succeed = HookPredicate.load(**_build_settings(
|
|
747
|
+
and_or_operator=PredicateAndOrOperator.OR,
|
|
748
|
+
right_object_keys=['fire'],
|
|
749
|
+
operator=PredicateOperator.GREATER_THAN,
|
|
750
|
+
predicates=[
|
|
751
|
+
predicate2_or_and_failed,
|
|
752
|
+
predicate2_or_or_succeed,
|
|
753
|
+
],
|
|
754
|
+
left_value=3,
|
|
755
|
+
))
|
|
756
|
+
|
|
757
|
+
predicates_level_3 = dict(
|
|
758
|
+
failed=[
|
|
759
|
+
predicate2_3_and_and_and_terminal_failed,
|
|
760
|
+
predicate2_3_or_or_terminal_failed,
|
|
761
|
+
],
|
|
762
|
+
succeed=[
|
|
763
|
+
predicate2_3_and_and_or_terminal_succeed,
|
|
764
|
+
predicate2_3_or_or_terminal_succeed,
|
|
765
|
+
],
|
|
766
|
+
)
|
|
767
|
+
|
|
768
|
+
predicates_level_2 = dict(
|
|
769
|
+
failed=[
|
|
770
|
+
predicate2_or_and_failed,
|
|
771
|
+
],
|
|
772
|
+
succeed=[
|
|
773
|
+
predicate2_and_and_succeed,
|
|
774
|
+
predicate2_and_or_succeed,
|
|
775
|
+
predicate2_or_or_succeed,
|
|
776
|
+
],
|
|
777
|
+
)
|
|
778
|
+
|
|
779
|
+
predicates_level_1 = dict(
|
|
780
|
+
failed=[],
|
|
781
|
+
succeed=[
|
|
782
|
+
predicate1_and_succeed,
|
|
783
|
+
predicate1_or_succeed,
|
|
784
|
+
],
|
|
785
|
+
)
|
|
786
|
+
|
|
787
|
+
predicate = HookPredicate.load(**_build_settings(
|
|
788
|
+
and_or_operator=PredicateAndOrOperator.AND,
|
|
789
|
+
right_object_keys=['earth'],
|
|
790
|
+
predicates=[
|
|
791
|
+
predicate1_and_succeed,
|
|
792
|
+
predicate1_or_succeed,
|
|
793
|
+
],
|
|
794
|
+
left_value=1,
|
|
795
|
+
))
|
|
796
|
+
|
|
797
|
+
return (
|
|
798
|
+
operation_resource,
|
|
799
|
+
predicate,
|
|
800
|
+
predicates_level_1,
|
|
801
|
+
predicates_level_2,
|
|
802
|
+
predicates_level_3,
|
|
803
|
+
)
|