mage-ai 0.9.70__py3-none-any.whl → 0.9.71__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/ai/utils/xgboost.py +222 -0
- mage_ai/api/errors.py +37 -25
- mage_ai/api/operations/base.py +13 -1
- mage_ai/api/parsers/PipelineScheduleParser.py +1 -1
- mage_ai/api/policies/BlockOutputPolicy.py +40 -17
- mage_ai/api/policies/GlobalDataProductPolicy.py +91 -41
- mage_ai/api/policies/KernelPolicy.py +55 -32
- mage_ai/api/policies/KernelProcessPolicy.py +56 -0
- mage_ai/api/policies/OutputPolicy.py +73 -41
- mage_ai/api/policies/PipelinePolicy.py +206 -138
- mage_ai/api/presenters/BlockLayoutItemPresenter.py +9 -7
- mage_ai/api/presenters/BlockPresenter.py +1 -1
- mage_ai/api/presenters/GlobalDataProductPresenter.py +6 -1
- mage_ai/api/presenters/KernelPresenter.py +5 -26
- mage_ai/api/presenters/KernelProcessPresenter.py +28 -0
- mage_ai/api/presenters/PipelinePresenter.py +18 -5
- mage_ai/api/presenters/StatusPresenter.py +2 -0
- mage_ai/api/presenters/SyncPresenter.py +25 -0
- mage_ai/api/resources/AutocompleteItemResource.py +1 -1
- mage_ai/api/resources/BlockLayoutItemResource.py +90 -44
- mage_ai/api/resources/BlockOutputResource.py +42 -9
- mage_ai/api/resources/BlockResource.py +4 -3
- mage_ai/api/resources/BlockRunResource.py +27 -22
- mage_ai/api/resources/ClusterResource.py +4 -1
- mage_ai/api/resources/CustomTemplateResource.py +34 -14
- mage_ai/api/resources/DataProviderResource.py +1 -1
- mage_ai/api/resources/ExecutionStateResource.py +3 -1
- mage_ai/api/resources/FileContentResource.py +8 -2
- mage_ai/api/resources/FileResource.py +10 -4
- mage_ai/api/resources/FileVersionResource.py +3 -1
- mage_ai/api/resources/GitBranchResource.py +46 -9
- mage_ai/api/resources/GlobalDataProductResource.py +44 -7
- mage_ai/api/resources/GlobalHookResource.py +4 -1
- mage_ai/api/resources/IntegrationDestinationResource.py +6 -2
- mage_ai/api/resources/IntegrationSourceResource.py +8 -4
- mage_ai/api/resources/IntegrationSourceStreamResource.py +6 -2
- mage_ai/api/resources/KernelProcessResource.py +44 -0
- mage_ai/api/resources/KernelResource.py +25 -3
- mage_ai/api/resources/OutputResource.py +33 -11
- mage_ai/api/resources/PageBlockLayoutResource.py +34 -23
- mage_ai/api/resources/PipelineInteractionResource.py +31 -15
- mage_ai/api/resources/PipelineResource.py +250 -123
- mage_ai/api/resources/PipelineRunResource.py +11 -3
- mage_ai/api/resources/PipelineScheduleResource.py +7 -2
- mage_ai/api/resources/PipelineTriggerResource.py +6 -1
- mage_ai/api/resources/ProjectResource.py +18 -7
- mage_ai/api/resources/SecretResource.py +1 -1
- mage_ai/api/resources/SeedResource.py +8 -1
- mage_ai/api/resources/StatusResource.py +21 -6
- mage_ai/api/resources/SyncResource.py +6 -8
- mage_ai/api/resources/VariableResource.py +46 -26
- mage_ai/api/resources/VersionControlProjectResource.py +9 -2
- mage_ai/api/resources/WidgetResource.py +1 -1
- mage_ai/api/resources/WorkspaceResource.py +1 -1
- mage_ai/api/views.py +47 -40
- mage_ai/authentication/permissions/seed.py +16 -2
- mage_ai/authentication/providers/oidc.py +21 -1
- mage_ai/autocomplete/utils.py +13 -9
- mage_ai/cache/base.py +1 -1
- mage_ai/cache/block.py +18 -12
- mage_ai/cache/block_action_object/__init__.py +32 -4
- mage_ai/cache/file.py +22 -19
- mage_ai/cache/pipeline.py +18 -12
- mage_ai/cli/main.py +1 -0
- mage_ai/cluster_manager/aws/emr_cluster_manager.py +9 -5
- mage_ai/cluster_manager/config.py +2 -2
- mage_ai/cluster_manager/manage.py +1 -1
- mage_ai/cluster_manager/workspace/base.py +1 -1
- mage_ai/command_center/applications/factory.py +10 -7
- mage_ai/command_center/files/factory.py +17 -15
- mage_ai/command_center/utils.py +25 -13
- mage_ai/data/__init__.py +0 -0
- mage_ai/data/constants.py +45 -0
- mage_ai/data/models/__init__.py +0 -0
- mage_ai/data/models/base.py +119 -0
- mage_ai/data/models/constants.py +1 -0
- mage_ai/data/models/generator.py +115 -0
- mage_ai/data/models/manager.py +168 -0
- mage_ai/data/models/pyarrow/__init__.py +0 -0
- mage_ai/data/models/pyarrow/record_batch.py +55 -0
- mage_ai/data/models/pyarrow/shared.py +21 -0
- mage_ai/data/models/pyarrow/table.py +8 -0
- mage_ai/data/models/reader.py +103 -0
- mage_ai/data/models/utils.py +59 -0
- mage_ai/data/models/writer.py +91 -0
- mage_ai/data/tabular/__init__.py +0 -0
- mage_ai/data/tabular/constants.py +23 -0
- mage_ai/data/tabular/mocks.py +19 -0
- mage_ai/data/tabular/models.py +126 -0
- mage_ai/data/tabular/reader.py +602 -0
- mage_ai/data/tabular/utils.py +102 -0
- mage_ai/data/tabular/writer.py +266 -0
- mage_ai/data/variables/__init__.py +0 -0
- mage_ai/data/variables/wrapper.py +54 -0
- mage_ai/data_cleaner/analysis/charts.py +61 -39
- mage_ai/data_cleaner/column_types/column_type_detector.py +53 -31
- mage_ai/data_cleaner/estimators/encoders.py +5 -2
- mage_ai/data_integrations/utils/scheduler.py +16 -11
- mage_ai/data_preparation/decorators.py +1 -0
- mage_ai/data_preparation/executors/block_executor.py +237 -155
- mage_ai/data_preparation/executors/streaming_pipeline_executor.py +1 -1
- mage_ai/data_preparation/git/__init__.py +27 -7
- mage_ai/data_preparation/git/api.py +7 -1
- mage_ai/data_preparation/git/utils.py +22 -16
- mage_ai/data_preparation/logging/logger_manager.py +4 -3
- mage_ai/data_preparation/models/block/__init__.py +1542 -878
- mage_ai/data_preparation/models/block/data_integration/mixins.py +4 -3
- mage_ai/data_preparation/models/block/dynamic/__init__.py +17 -6
- mage_ai/data_preparation/models/block/dynamic/child.py +41 -102
- mage_ai/data_preparation/models/block/dynamic/constants.py +1 -0
- mage_ai/data_preparation/models/block/dynamic/counter.py +296 -0
- mage_ai/data_preparation/models/block/dynamic/data.py +16 -0
- mage_ai/data_preparation/models/block/dynamic/factory.py +163 -0
- mage_ai/data_preparation/models/block/dynamic/models.py +19 -0
- mage_ai/data_preparation/models/block/dynamic/shared.py +92 -0
- mage_ai/data_preparation/models/block/dynamic/utils.py +291 -168
- mage_ai/data_preparation/models/block/dynamic/variables.py +384 -144
- mage_ai/data_preparation/models/block/dynamic/wrappers.py +77 -0
- mage_ai/data_preparation/models/block/extension/utils.py +10 -1
- mage_ai/data_preparation/models/block/global_data_product/__init__.py +10 -1
- mage_ai/data_preparation/models/block/integration/__init__.py +6 -2
- mage_ai/data_preparation/models/block/outputs.py +722 -0
- mage_ai/data_preparation/models/block/platform/mixins.py +7 -8
- mage_ai/data_preparation/models/block/r/__init__.py +56 -38
- mage_ai/data_preparation/models/block/settings/__init__.py +0 -0
- mage_ai/data_preparation/models/block/settings/dynamic/__init__.py +0 -0
- mage_ai/data_preparation/models/block/settings/dynamic/constants.py +7 -0
- mage_ai/data_preparation/models/block/settings/dynamic/mixins.py +118 -0
- mage_ai/data_preparation/models/block/settings/dynamic/models.py +31 -0
- mage_ai/data_preparation/models/block/settings/global_data_products/__init__.py +0 -0
- mage_ai/data_preparation/models/block/settings/global_data_products/mixins.py +20 -0
- mage_ai/data_preparation/models/block/settings/global_data_products/models.py +46 -0
- mage_ai/data_preparation/models/block/settings/variables/__init__.py +0 -0
- mage_ai/data_preparation/models/block/settings/variables/mixins.py +74 -0
- mage_ai/data_preparation/models/block/settings/variables/models.py +49 -0
- mage_ai/data_preparation/models/block/spark/mixins.py +2 -1
- mage_ai/data_preparation/models/block/sql/__init__.py +30 -5
- mage_ai/data_preparation/models/block/sql/utils/shared.py +21 -3
- mage_ai/data_preparation/models/block/utils.py +127 -70
- mage_ai/data_preparation/models/constants.py +19 -14
- mage_ai/data_preparation/models/custom_templates/custom_block_template.py +18 -13
- mage_ai/data_preparation/models/custom_templates/custom_pipeline_template.py +33 -16
- mage_ai/data_preparation/models/custom_templates/utils.py +1 -1
- mage_ai/data_preparation/models/file.py +41 -28
- mage_ai/data_preparation/models/global_data_product/__init__.py +88 -58
- mage_ai/data_preparation/models/global_hooks/models.py +1 -0
- mage_ai/data_preparation/models/interfaces.py +29 -0
- mage_ai/data_preparation/models/pipeline.py +365 -180
- mage_ai/data_preparation/models/pipelines/integration_pipeline.py +1 -2
- mage_ai/data_preparation/models/pipelines/seed.py +1 -1
- mage_ai/data_preparation/models/project/__init__.py +66 -18
- mage_ai/data_preparation/models/project/constants.py +2 -0
- mage_ai/data_preparation/models/triggers/__init__.py +120 -24
- mage_ai/data_preparation/models/utils.py +467 -17
- mage_ai/data_preparation/models/variable.py +1028 -137
- mage_ai/data_preparation/models/variables/__init__.py +0 -0
- mage_ai/data_preparation/models/variables/cache.py +149 -0
- mage_ai/data_preparation/models/variables/constants.py +72 -0
- mage_ai/data_preparation/models/variables/summarizer.py +336 -0
- mage_ai/data_preparation/models/variables/utils.py +77 -0
- mage_ai/data_preparation/models/widget/__init__.py +63 -41
- mage_ai/data_preparation/models/widget/charts.py +40 -27
- mage_ai/data_preparation/models/widget/constants.py +2 -0
- mage_ai/data_preparation/models/widget/utils.py +3 -3
- mage_ai/data_preparation/preferences.py +3 -3
- mage_ai/data_preparation/repo_manager.py +55 -21
- mage_ai/data_preparation/storage/base_storage.py +2 -2
- mage_ai/data_preparation/storage/gcs_storage.py +7 -4
- mage_ai/data_preparation/storage/local_storage.py +6 -3
- mage_ai/data_preparation/storage/s3_storage.py +5 -2
- mage_ai/data_preparation/templates/data_exporters/streaming/oracledb.yaml +8 -0
- mage_ai/data_preparation/variable_manager.py +281 -76
- mage_ai/io/base.py +3 -2
- mage_ai/io/bigquery.py +1 -0
- mage_ai/io/redshift.py +7 -5
- mage_ai/kernels/__init__.py +0 -0
- mage_ai/kernels/models.py +188 -0
- mage_ai/kernels/utils.py +169 -0
- mage_ai/orchestration/concurrency.py +6 -2
- mage_ai/orchestration/db/__init__.py +1 -0
- mage_ai/orchestration/db/migrations/versions/0227396a216c_add_userproject_table.py +38 -0
- mage_ai/orchestration/db/models/dynamic/__init__.py +0 -0
- mage_ai/orchestration/db/models/dynamic/controller.py +67 -0
- mage_ai/orchestration/db/models/oauth.py +2 -9
- mage_ai/orchestration/db/models/projects.py +10 -0
- mage_ai/orchestration/db/models/schedules.py +204 -187
- mage_ai/orchestration/db/models/schedules_project_platform.py +18 -12
- mage_ai/orchestration/db/models/utils.py +46 -5
- mage_ai/orchestration/metrics/pipeline_run.py +8 -9
- mage_ai/orchestration/notification/sender.py +1 -0
- mage_ai/orchestration/pipeline_scheduler_original.py +32 -8
- mage_ai/orchestration/pipeline_scheduler_project_platform.py +1 -1
- mage_ai/orchestration/run_status_checker.py +11 -4
- mage_ai/orchestration/triggers/api.py +12 -1
- mage_ai/presenters/charts/data_sources/base.py +4 -2
- mage_ai/presenters/charts/data_sources/block.py +15 -9
- mage_ai/presenters/charts/data_sources/chart_code.py +8 -5
- mage_ai/presenters/charts/data_sources/constants.py +1 -0
- mage_ai/presenters/charts/data_sources/system_metrics.py +22 -0
- mage_ai/presenters/interactions/models.py +11 -7
- mage_ai/presenters/pages/loaders/pipelines.py +5 -3
- mage_ai/presenters/pages/models/page_components/pipeline_schedules.py +3 -1
- mage_ai/presenters/utils.py +2 -0
- mage_ai/server/api/blocks.py +2 -1
- mage_ai/server/api/downloads.py +5 -1
- mage_ai/server/api/triggers.py +3 -1
- mage_ai/server/constants.py +1 -1
- mage_ai/server/frontend_dist/404.html +5 -5
- mage_ai/server/frontend_dist/_next/static/UZLabyPgcxtZvp0O0EUUS/_buildManifest.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/1376-22de38b4ad008d8a.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{1557-b3502f3f1aa92ac7.js → 1557-25a7d985d5564fd3.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/1668-30b4619b9534519b.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/1799-c42db95a015689ee.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/2996-2108b53b9d371d8d.js +1 -0
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/3763-61b542dafdbf5754.js → frontend_dist/_next/static/chunks/3763-40780c6d1e4b261d.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3782-129dd2a2448a2e36.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/3958-bcdfa414ccfa1eb2.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/4168-97fd1578d1a38315.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/4982-fa5a238b139fbdd2.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/5699-176f445e1313f001.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/7162-7dd03f0f605de721.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/7779-68d2b72a90c5f925.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/7966-5446a8e43711e2f9.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/8023-6c2f172f48dcb99b.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/8095-c351b8a735d73e0c.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{main-77fe248a6fbd12d8.js → main-b99d4e30a88d9dc7.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/_app-9fe2d9d07c94e968.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{block-layout-14f952f66964022f.js → block-layout-7f4b735c67115df5.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/global-data-products/[...slug]-e7d48e6b0c3068ac.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/global-data-products-b943f31f050fc3a4.js +1 -0
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/pages/overview-597b74828bf105db.js → frontend_dist/_next/static/chunks/pages/overview-9f1ac4ec003884f3.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills/{[...slug]-7181b086c93784d2.js → [...slug]-7e737f6fc7e83e9b.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/dashboard-d94488e3f2eeef36.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-cc641a7fa8473796.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors/{block-runs-a5c0362763a21fa8.js → block-runs-284309877f3c5a5a.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors/block-runtime-26250e5335194ade.js +1 -0
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/monitors-7acc7afc00df17c2.js → frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors-5f4c8128b2413fd8.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/runs/[run]-4ebfc8e400315dda.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/settings-e5e0150a256aadb3.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/account/{profile-3f0df3decc856ee9.js → profile-3ae43c932537b254.js} +1 -1
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/pages/settings/platform/preferences-32985f3f7c7dd3ab.js → frontend_dist/_next/static/chunks/pages/settings/platform/preferences-b603d7fe4b175256.js} +1 -1
- mage_ai/server/{frontend_dist_base_path_template/_next/static/chunks/pages/settings/platform/settings-c2e9ef989c8bfa73.js → frontend_dist/_next/static/chunks/pages/settings/platform/settings-319ddbabc239e91b.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/permissions/{[...slug]-47b64ced27c24985.js → [...slug]-5c360f72e4498855.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/{permissions-e5a4d3d815cec25d.js → permissions-fb29fa6c2bd90bb0.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/preferences-3b76fa959ffa09d3.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/roles/{[...slug]-379e1ee292504842.js → [...slug]-3b787b42f1093b1f.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/roles-0b83fbdd39e85f5b.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/sync-data-a1e6950974d643a8.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/users/{[...slug]-2af9afbe727d88aa.js → [...slug]-0aa019d87db8b0b8.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/{users-a4db8710f703c729.js → users-88c694d19207f2ec.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/version-control-31d0d50f7f30462b.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{webpack-d079359c241db804.js → webpack-ac7fdc472bedf682.js} +1 -1
- mage_ai/server/frontend_dist/block-layout.html +3 -3
- mage_ai/server/frontend_dist/compute.html +6 -6
- mage_ai/server/frontend_dist/files.html +6 -6
- mage_ai/server/frontend_dist/global-data-products/[...slug].html +6 -6
- mage_ai/server/frontend_dist/global-data-products.html +6 -6
- mage_ai/server/frontend_dist/global-hooks/[...slug].html +6 -6
- mage_ai/server/frontend_dist/global-hooks.html +6 -6
- mage_ai/server/frontend_dist/index.html +3 -3
- mage_ai/server/frontend_dist/manage/files.html +6 -6
- mage_ai/server/frontend_dist/manage/settings.html +6 -6
- mage_ai/server/frontend_dist/manage/users/[user].html +6 -6
- mage_ai/server/frontend_dist/manage/users/new.html +6 -6
- mage_ai/server/frontend_dist/manage/users.html +6 -6
- mage_ai/server/frontend_dist/manage.html +6 -6
- mage_ai/server/frontend_dist/oauth.html +5 -5
- mage_ai/server/frontend_dist/overview.html +6 -6
- mage_ai/server/frontend_dist/pipeline-runs.html +6 -6
- mage_ai/server/frontend_dist/pipelines/[pipeline]/backfills/[...slug].html +6 -6
- mage_ai/server/frontend_dist/pipelines/[pipeline]/backfills.html +6 -6
- mage_ai/server/frontend_dist/pipelines/[pipeline]/dashboard.html +6 -6
- mage_ai/server/frontend_dist/pipelines/[pipeline]/edit.html +3 -3
- mage_ai/server/frontend_dist/pipelines/[pipeline]/logs.html +6 -6
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors/block-runs.html +6 -6
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors/block-runtime.html +6 -6
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors.html +6 -6
- mage_ai/server/frontend_dist/pipelines/[pipeline]/runs/[run].html +6 -6
- mage_ai/server/frontend_dist/pipelines/[pipeline]/runs.html +6 -6
- mage_ai/server/frontend_dist/pipelines/[pipeline]/settings.html +6 -6
- mage_ai/server/frontend_dist/pipelines/[pipeline]/syncs.html +6 -6
- mage_ai/server/frontend_dist/pipelines/[pipeline]/triggers/[...slug].html +6 -6
- mage_ai/server/frontend_dist/pipelines/[pipeline]/triggers.html +6 -6
- mage_ai/server/frontend_dist/pipelines/[pipeline].html +3 -3
- mage_ai/server/frontend_dist/pipelines.html +6 -6
- mage_ai/server/frontend_dist/platform/global-hooks/[...slug].html +6 -6
- mage_ai/server/frontend_dist/platform/global-hooks.html +6 -6
- mage_ai/server/frontend_dist/settings/account/profile.html +6 -6
- mage_ai/server/frontend_dist/settings/platform/preferences.html +6 -6
- mage_ai/server/frontend_dist/settings/platform/settings.html +6 -6
- mage_ai/server/frontend_dist/settings/workspace/permissions/[...slug].html +6 -6
- mage_ai/server/frontend_dist/settings/workspace/permissions.html +6 -6
- mage_ai/server/frontend_dist/settings/workspace/preferences.html +6 -6
- mage_ai/server/frontend_dist/settings/workspace/roles/[...slug].html +6 -6
- mage_ai/server/frontend_dist/settings/workspace/roles.html +6 -6
- mage_ai/server/frontend_dist/settings/workspace/sync-data.html +6 -6
- mage_ai/server/frontend_dist/settings/workspace/users/[...slug].html +6 -6
- mage_ai/server/frontend_dist/settings/workspace/users.html +6 -6
- mage_ai/server/frontend_dist/settings.html +3 -3
- mage_ai/server/frontend_dist/sign-in.html +12 -12
- mage_ai/server/frontend_dist/templates/[...slug].html +6 -6
- mage_ai/server/frontend_dist/templates.html +6 -6
- mage_ai/server/frontend_dist/terminal.html +6 -6
- mage_ai/server/frontend_dist/test.html +3 -3
- mage_ai/server/frontend_dist/triggers.html +6 -6
- mage_ai/server/frontend_dist/version-control.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/404.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/1376-22de38b4ad008d8a.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/{1557-b3502f3f1aa92ac7.js → 1557-25a7d985d5564fd3.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/1668-30b4619b9534519b.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/1799-c42db95a015689ee.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/2996-2108b53b9d371d8d.js +1 -0
- mage_ai/server/{frontend_dist/_next/static/chunks/3763-61b542dafdbf5754.js → frontend_dist_base_path_template/_next/static/chunks/3763-40780c6d1e4b261d.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/3782-129dd2a2448a2e36.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/3958-bcdfa414ccfa1eb2.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/4168-97fd1578d1a38315.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/4982-fa5a238b139fbdd2.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/5699-176f445e1313f001.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/7162-7dd03f0f605de721.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/7779-68d2b72a90c5f925.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/7966-5446a8e43711e2f9.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/8023-6c2f172f48dcb99b.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/8095-c351b8a735d73e0c.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/{main-70b78159c2bb3fe1.js → main-384298e9133cec76.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/_app-13a578bce3b7f30c.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/{block-layout-14f952f66964022f.js → block-layout-7f4b735c67115df5.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/global-data-products/[...slug]-e7d48e6b0c3068ac.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/global-data-products-b943f31f050fc3a4.js +1 -0
- mage_ai/server/{frontend_dist/_next/static/chunks/pages/overview-597b74828bf105db.js → frontend_dist_base_path_template/_next/static/chunks/pages/overview-9f1ac4ec003884f3.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/backfills/{[...slug]-7181b086c93784d2.js → [...slug]-7e737f6fc7e83e9b.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/dashboard-d94488e3f2eeef36.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/edit-cc641a7fa8473796.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/monitors/{block-runs-a5c0362763a21fa8.js → block-runs-284309877f3c5a5a.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/monitors/block-runtime-26250e5335194ade.js +1 -0
- mage_ai/server/{frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors-7acc7afc00df17c2.js → frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/monitors-5f4c8128b2413fd8.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/runs/[run]-4ebfc8e400315dda.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/settings-e5e0150a256aadb3.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/account/{profile-3f0df3decc856ee9.js → profile-3ae43c932537b254.js} +1 -1
- mage_ai/server/{frontend_dist/_next/static/chunks/pages/settings/platform/preferences-32985f3f7c7dd3ab.js → frontend_dist_base_path_template/_next/static/chunks/pages/settings/platform/preferences-b603d7fe4b175256.js} +1 -1
- mage_ai/server/{frontend_dist/_next/static/chunks/pages/settings/platform/settings-c2e9ef989c8bfa73.js → frontend_dist_base_path_template/_next/static/chunks/pages/settings/platform/settings-319ddbabc239e91b.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/permissions/{[...slug]-47b64ced27c24985.js → [...slug]-5c360f72e4498855.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/{permissions-e5a4d3d815cec25d.js → permissions-fb29fa6c2bd90bb0.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/preferences-3b76fa959ffa09d3.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/roles/{[...slug]-379e1ee292504842.js → [...slug]-3b787b42f1093b1f.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/roles-0b83fbdd39e85f5b.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/sync-data-a1e6950974d643a8.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/users/{[...slug]-2af9afbe727d88aa.js → [...slug]-0aa019d87db8b0b8.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/{users-a4db8710f703c729.js → users-88c694d19207f2ec.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/version-control-31d0d50f7f30462b.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/{webpack-68c003fb6a175cd7.js → webpack-481689d9989710cd.js} +1 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/kcptwoOU-JJJg6Vwpkfmx/_buildManifest.js +1 -0
- mage_ai/server/frontend_dist_base_path_template/block-layout.html +3 -3
- mage_ai/server/frontend_dist_base_path_template/compute.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/files.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/global-data-products/[...slug].html +6 -6
- mage_ai/server/frontend_dist_base_path_template/global-data-products.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/global-hooks/[...slug].html +6 -6
- mage_ai/server/frontend_dist_base_path_template/global-hooks.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/index.html +3 -3
- mage_ai/server/frontend_dist_base_path_template/manage/files.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/manage/settings.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/manage/users/[user].html +6 -6
- mage_ai/server/frontend_dist_base_path_template/manage/users/new.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/manage/users.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/manage.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/oauth.html +5 -5
- mage_ai/server/frontend_dist_base_path_template/overview.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/pipeline-runs.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/backfills/[...slug].html +6 -6
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/backfills.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/dashboard.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/edit.html +3 -3
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/logs.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/monitors/block-runs.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/monitors/block-runtime.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/monitors.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/runs/[run].html +6 -6
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/runs.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/settings.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/syncs.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/triggers/[...slug].html +6 -6
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline]/triggers.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/pipelines/[pipeline].html +3 -3
- mage_ai/server/frontend_dist_base_path_template/pipelines.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/platform/global-hooks/[...slug].html +6 -6
- mage_ai/server/frontend_dist_base_path_template/platform/global-hooks.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/settings/account/profile.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/settings/platform/preferences.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/settings/platform/settings.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/permissions/[...slug].html +6 -6
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/permissions.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/preferences.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/roles/[...slug].html +6 -6
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/roles.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/sync-data.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/users/[...slug].html +6 -6
- mage_ai/server/frontend_dist_base_path_template/settings/workspace/users.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/settings.html +3 -3
- mage_ai/server/frontend_dist_base_path_template/sign-in.html +12 -12
- mage_ai/server/frontend_dist_base_path_template/templates/[...slug].html +6 -6
- mage_ai/server/frontend_dist_base_path_template/templates.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/terminal.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/test.html +3 -3
- mage_ai/server/frontend_dist_base_path_template/triggers.html +6 -6
- mage_ai/server/frontend_dist_base_path_template/version-control.html +6 -6
- mage_ai/server/kernel_output_parser.py +4 -1
- mage_ai/server/scheduler_manager.py +9 -0
- mage_ai/server/server.py +35 -31
- mage_ai/server/utils/custom_output.py +284 -0
- mage_ai/server/utils/execute_custom_code.py +245 -0
- mage_ai/server/utils/output_display.py +123 -289
- mage_ai/server/websocket_server.py +116 -69
- mage_ai/services/k8s/config.py +23 -0
- mage_ai/services/k8s/job_manager.py +6 -1
- mage_ai/services/ssh/aws/emr/utils.py +8 -8
- mage_ai/settings/keys/auth.py +1 -0
- mage_ai/settings/platform/__init__.py +159 -38
- mage_ai/settings/platform/constants.py +5 -0
- mage_ai/settings/platform/utils.py +53 -10
- mage_ai/settings/repo.py +26 -12
- mage_ai/settings/server.py +128 -37
- mage_ai/shared/array.py +24 -1
- mage_ai/shared/complex.py +45 -0
- mage_ai/shared/config.py +2 -1
- mage_ai/shared/custom_logger.py +11 -0
- mage_ai/shared/dates.py +10 -6
- mage_ai/shared/files.py +63 -8
- mage_ai/shared/hash.py +33 -9
- mage_ai/shared/io.py +9 -5
- mage_ai/shared/models.py +82 -24
- mage_ai/shared/outputs.py +87 -0
- mage_ai/shared/parsers.py +141 -15
- mage_ai/shared/path_fixer.py +11 -7
- mage_ai/shared/singletons/__init__.py +0 -0
- mage_ai/shared/singletons/base.py +47 -0
- mage_ai/shared/singletons/memory.py +38 -0
- mage_ai/shared/strings.py +34 -1
- mage_ai/shared/yaml.py +24 -0
- mage_ai/streaming/sinks/oracledb.py +57 -0
- mage_ai/streaming/sinks/sink_factory.py +4 -0
- mage_ai/system/__init__.py +0 -0
- mage_ai/system/constants.py +14 -0
- mage_ai/system/memory/__init__.py +0 -0
- mage_ai/system/memory/constants.py +1 -0
- mage_ai/system/memory/manager.py +174 -0
- mage_ai/system/memory/presenters.py +158 -0
- mage_ai/system/memory/process.py +216 -0
- mage_ai/system/memory/samples.py +13 -0
- mage_ai/system/memory/utils.py +656 -0
- mage_ai/system/memory/wrappers.py +177 -0
- mage_ai/system/models.py +58 -0
- mage_ai/system/storage/__init__.py +0 -0
- mage_ai/system/storage/utils.py +29 -0
- mage_ai/tests/api/endpoints/mixins.py +2 -2
- mage_ai/tests/api/endpoints/test_blocks.py +2 -1
- mage_ai/tests/api/endpoints/test_custom_designs.py +4 -4
- mage_ai/tests/api/endpoints/test_pipeline_runs.py +2 -2
- mage_ai/tests/api/endpoints/test_projects.py +2 -1
- mage_ai/tests/api/operations/base/test_base.py +27 -27
- mage_ai/tests/api/operations/base/test_base_with_user_authentication.py +27 -27
- mage_ai/tests/api/operations/base/test_base_with_user_permissions.py +23 -23
- mage_ai/tests/api/operations/test_syncs.py +6 -4
- mage_ai/tests/api/resources/test_pipeline_resource.py +9 -2
- mage_ai/tests/authentication/providers/test_oidc.py +59 -0
- mage_ai/tests/base_test.py +2 -2
- mage_ai/tests/data/__init__.py +0 -0
- mage_ai/tests/data/models/__init__.py +0 -0
- mage_ai/tests/data_preparation/executors/test_block_executor.py +23 -16
- mage_ai/tests/data_preparation/git/test_git.py +4 -1
- mage_ai/tests/data_preparation/models/block/dynamic/test_combos.py +305 -0
- mage_ai/tests/data_preparation/models/block/dynamic/test_counter.py +212 -0
- mage_ai/tests/data_preparation/models/block/dynamic/test_factory.py +360 -0
- mage_ai/tests/data_preparation/models/block/dynamic/test_variables.py +332 -0
- mage_ai/tests/data_preparation/models/block/hook/test_hook_block.py +2 -2
- mage_ai/tests/data_preparation/models/block/platform/test_mixins.py +1 -1
- mage_ai/tests/data_preparation/models/block/sql/utils/test_shared.py +26 -1
- mage_ai/tests/data_preparation/models/block/test_global_data_product.py +3 -2
- mage_ai/tests/data_preparation/models/custom_templates/test_utils.py +5 -4
- mage_ai/tests/data_preparation/models/global_hooks/test_hook.py +3 -0
- mage_ai/tests/data_preparation/models/global_hooks/test_predicates.py +9 -3
- mage_ai/tests/data_preparation/models/test_block.py +115 -120
- mage_ai/tests/data_preparation/models/test_blocks_helper.py +114 -0
- mage_ai/tests/data_preparation/models/test_global_data_product.py +41 -24
- mage_ai/tests/data_preparation/models/test_pipeline.py +9 -6
- mage_ai/tests/data_preparation/models/test_project.py +4 -1
- mage_ai/tests/data_preparation/models/test_utils.py +80 -0
- mage_ai/tests/data_preparation/models/test_variable.py +242 -69
- mage_ai/tests/data_preparation/models/variables/__init__.py +0 -0
- mage_ai/tests/data_preparation/models/variables/test_summarizer.py +481 -0
- mage_ai/tests/data_preparation/storage/shared/__init__.py +0 -0
- mage_ai/tests/data_preparation/test_repo_manager.py +6 -7
- mage_ai/tests/data_preparation/test_variable_manager.py +57 -48
- mage_ai/tests/factory.py +64 -43
- mage_ai/tests/orchestration/db/models/test_schedules.py +3 -3
- mage_ai/tests/orchestration/db/models/test_schedules_dynamic_blocks.py +279 -0
- mage_ai/tests/orchestration/test_pipeline_scheduler.py +1 -0
- mage_ai/tests/orchestration/triggers/test_global_data_product.py +3 -2
- mage_ai/tests/orchestration/triggers/test_utils.py +3 -2
- mage_ai/tests/services/k8s/test_job_manager.py +18 -0
- mage_ai/tests/streaming/sinks/test_oracledb.py +38 -0
- mage_ai/tests/test_shared.py +61 -0
- mage_ai/usage_statistics/logger.py +7 -2
- mage_ai/utils/code.py +33 -19
- {mage_ai-0.9.70.dist-info → mage_ai-0.9.71.dist-info}/METADATA +5 -2
- {mage_ai-0.9.70.dist-info → mage_ai-0.9.71.dist-info}/RECORD +513 -417
- mage_ai/data_preparation/models/global_data_product/constants.py +0 -6
- mage_ai/server/frontend_dist/_next/static/RhDiJSkcjCsh4xxX4BFBk/_buildManifest.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/2631-b9f9bea3f1cf906d.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3782-ef4cd4f0b52072d0.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/4783-422429203610c318.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/5699-6d708c6b2153ea08.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/635-0d6b7c8804bcd2dc.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/7022-0d52dd8868621fb0.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/7361-8a23dd8360593e7a.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/7966-b9b85ba10667e654.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/8095-bdce03896ef9639a.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/8146-6bed4e7401e067e6.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/9265-d2a1aaec75ec69b8.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/9440-4069842b90d4b801.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/9832-67896490f6e8a014.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/_app-2a69553d8c6eeb53.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/global-data-products/[...slug]-591abd392dc50ed4.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/global-data-products-78e8e88f2a757a18.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/dashboard-95ffcd3e2b27e567.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-b645a6d13ab9fe3a.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/monitors/block-runtime-1ed9045b2f1dfd65.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/runs/[run]-1417ad1c821d720a.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/settings-59aca25a5b1d3998.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/preferences-349af617d05f001b.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/roles-36fa165a48af586b.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/sync-data-60d01d3887e31136.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/version-control-3433c8b22e8342aa.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/TdpLLFome13qvM0gXvpHs/_buildManifest.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/2631-b9f9bea3f1cf906d.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/3782-ef4cd4f0b52072d0.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/4783-422429203610c318.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/5699-6d708c6b2153ea08.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/635-0d6b7c8804bcd2dc.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/7022-0d52dd8868621fb0.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/7361-8a23dd8360593e7a.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/7966-b9b85ba10667e654.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/8095-bdce03896ef9639a.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/8146-6bed4e7401e067e6.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/9265-d2a1aaec75ec69b8.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/9440-4069842b90d4b801.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/9832-67896490f6e8a014.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/_app-2a69553d8c6eeb53.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/global-data-products/[...slug]-591abd392dc50ed4.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/global-data-products-78e8e88f2a757a18.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/dashboard-95ffcd3e2b27e567.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/edit-b645a6d13ab9fe3a.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/monitors/block-runtime-1ed9045b2f1dfd65.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/runs/[run]-1417ad1c821d720a.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/pipelines/[pipeline]/settings-59aca25a5b1d3998.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/preferences-349af617d05f001b.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/roles-36fa165a48af586b.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/settings/workspace/sync-data-60d01d3887e31136.js +0 -1
- mage_ai/server/frontend_dist_base_path_template/_next/static/chunks/pages/version-control-3433c8b22e8342aa.js +0 -1
- mage_ai/shared/memory.py +0 -90
- mage_ai/tests/data_preparation/models/block/dynamic/test_dynamic_helpers.py +0 -48
- /mage_ai/{tests/data_preparation/shared → ai/utils}/__init__.py +0 -0
- /mage_ai/server/frontend_dist/_next/static/{RhDiJSkcjCsh4xxX4BFBk → UZLabyPgcxtZvp0O0EUUS}/_ssgManifest.js +0 -0
- /mage_ai/server/frontend_dist_base_path_template/_next/static/{TdpLLFome13qvM0gXvpHs → kcptwoOU-JJJg6Vwpkfmx}/_ssgManifest.js +0 -0
- /mage_ai/tests/data_preparation/{shared → storage/shared}/test_secrets.py +0 -0
- {mage_ai-0.9.70.dist-info → mage_ai-0.9.71.dist-info}/LICENSE +0 -0
- {mage_ai-0.9.70.dist-info → mage_ai-0.9.71.dist-info}/WHEEL +0 -0
- {mage_ai-0.9.70.dist-info → mage_ai-0.9.71.dist-info}/entry_points.txt +0 -0
- {mage_ai-0.9.70.dist-info → mage_ai-0.9.71.dist-info}/top_level.txt +0 -0
mage_ai/shared/models.py
CHANGED
|
@@ -3,10 +3,11 @@ import typing
|
|
|
3
3
|
from dataclasses import dataclass, make_dataclass
|
|
4
4
|
from enum import Enum
|
|
5
5
|
from functools import reduce
|
|
6
|
-
from typing import Dict, List
|
|
6
|
+
from typing import Any, Dict, List, Optional, Union
|
|
7
7
|
|
|
8
8
|
import inflection
|
|
9
9
|
|
|
10
|
+
from mage_ai.shared.environments import is_debug
|
|
10
11
|
from mage_ai.shared.hash import merge_dict
|
|
11
12
|
from mage_ai.shared.parsers import encode_complex
|
|
12
13
|
|
|
@@ -34,33 +35,41 @@ class BaseClass:
|
|
|
34
35
|
return annotations
|
|
35
36
|
|
|
36
37
|
@classmethod
|
|
37
|
-
def load(
|
|
38
|
-
annotations =
|
|
38
|
+
def load(cls, *args, **kwargs):
|
|
39
|
+
annotations = cls.all_annotations()
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
if args is not None and len(args) >= 1:
|
|
42
|
+
kwargs = kwargs or {}
|
|
43
|
+
if isinstance(args[0], dict):
|
|
44
|
+
kwargs.update(args[0])
|
|
45
|
+
elif isinstance(args[0], cls):
|
|
46
|
+
kwargs.update(args[0].to_dict())
|
|
47
|
+
|
|
48
|
+
props_init = cls.load_to_dict(**kwargs)
|
|
41
49
|
|
|
42
50
|
props = {}
|
|
43
51
|
props_not_set = {}
|
|
44
52
|
if props_init:
|
|
45
53
|
for key, value in props_init.items():
|
|
46
|
-
if
|
|
47
|
-
key =
|
|
54
|
+
if cls.attribute_aliases and key in cls.attribute_aliases:
|
|
55
|
+
key = cls.attribute_aliases[key]
|
|
48
56
|
|
|
49
57
|
annotation = annotations.get(key)
|
|
50
58
|
if annotation:
|
|
51
|
-
props[key] =
|
|
59
|
+
props[key] = cls.convert_value(value, annotation)
|
|
52
60
|
else:
|
|
53
61
|
props_not_set[key] = value
|
|
54
62
|
|
|
55
|
-
model =
|
|
63
|
+
model = cls(**props)
|
|
56
64
|
|
|
57
65
|
for key, value in props_not_set.items():
|
|
58
66
|
try:
|
|
59
67
|
if not callable(getattr(model, key)):
|
|
60
68
|
model.set_value(key, value)
|
|
61
69
|
except AttributeError as err:
|
|
62
|
-
print(f'[WARNING] {
|
|
63
|
-
|
|
70
|
+
print(f'[WARNING] {cls.__name__}.load: {err}')
|
|
71
|
+
if is_debug():
|
|
72
|
+
raise err
|
|
64
73
|
|
|
65
74
|
return model
|
|
66
75
|
|
|
@@ -85,11 +94,14 @@ class BaseClass:
|
|
|
85
94
|
if ignore_empty and len(value) == 0:
|
|
86
95
|
return None
|
|
87
96
|
|
|
88
|
-
return [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
97
|
+
return [
|
|
98
|
+
self.convert_value(
|
|
99
|
+
v,
|
|
100
|
+
convert_enum=convert_enum,
|
|
101
|
+
ignore_empty=ignore_empty,
|
|
102
|
+
)
|
|
103
|
+
for v in value
|
|
104
|
+
]
|
|
93
105
|
|
|
94
106
|
if not annotation:
|
|
95
107
|
annotation = type(value)
|
|
@@ -133,9 +145,13 @@ class BaseClass:
|
|
|
133
145
|
ignore_empty=ignore_empty,
|
|
134
146
|
)
|
|
135
147
|
|
|
136
|
-
is_enum_class =
|
|
137
|
-
|
|
138
|
-
|
|
148
|
+
is_enum_class = (
|
|
149
|
+
value is not None
|
|
150
|
+
and inspect.isclass(
|
|
151
|
+
annotation,
|
|
152
|
+
)
|
|
153
|
+
and issubclass(annotation, Enum)
|
|
154
|
+
)
|
|
139
155
|
is_enum = isinstance(value, Enum)
|
|
140
156
|
if is_enum_class and not is_enum:
|
|
141
157
|
try:
|
|
@@ -183,7 +199,13 @@ class BaseClass:
|
|
|
183
199
|
try:
|
|
184
200
|
value = getattr(self, attribute_name)
|
|
185
201
|
if value and isinstance(value, str):
|
|
186
|
-
setattr(
|
|
202
|
+
setattr(
|
|
203
|
+
self,
|
|
204
|
+
attribute_name,
|
|
205
|
+
enum_class.from_value(value)
|
|
206
|
+
if issubclass(enum_class, BaseEnum)
|
|
207
|
+
else enum_class(value),
|
|
208
|
+
)
|
|
187
209
|
except AttributeError as err:
|
|
188
210
|
print(f'[WARNING] {self.__class__.__name__}.serialize_attribute_enum: {err}')
|
|
189
211
|
|
|
@@ -194,7 +216,11 @@ class BaseClass:
|
|
|
194
216
|
arr = []
|
|
195
217
|
for value in values:
|
|
196
218
|
if isinstance(value, str):
|
|
197
|
-
arr.append(
|
|
219
|
+
arr.append(
|
|
220
|
+
enum_class.from_value(value)
|
|
221
|
+
if issubclass(enum_class, BaseEnum)
|
|
222
|
+
else enum_class(value)
|
|
223
|
+
)
|
|
198
224
|
else:
|
|
199
225
|
arr.append(value)
|
|
200
226
|
setattr(self, attribute_name, arr)
|
|
@@ -230,10 +256,11 @@ class BaseClass:
|
|
|
230
256
|
if self.attribute_aliases and key in self.attribute_aliases:
|
|
231
257
|
key = self.attribute_aliases[key]
|
|
232
258
|
|
|
233
|
-
if
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
259
|
+
if (
|
|
260
|
+
ignore_empty
|
|
261
|
+
and (isinstance(value, list) or isinstance(value, dict))
|
|
262
|
+
and len(value) == 0
|
|
263
|
+
):
|
|
237
264
|
continue
|
|
238
265
|
|
|
239
266
|
data[key] = encode_complex(value)
|
|
@@ -264,3 +291,34 @@ class BaseDataClass(BaseClass):
|
|
|
264
291
|
BaseClass.__init__(obj, *args, **kwargs)
|
|
265
292
|
|
|
266
293
|
return obj
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
class DelegatorTarget:
|
|
297
|
+
def __init__(self, target):
|
|
298
|
+
self._target = target
|
|
299
|
+
|
|
300
|
+
def __getattr__(self, item):
|
|
301
|
+
return getattr(self._target, item)
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
class Delegator:
|
|
305
|
+
def __init__(self, target: Any):
|
|
306
|
+
self.target = target
|
|
307
|
+
self.delegate = DelegatorTarget(self.target)
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
class BaseEnum(str, Enum):
|
|
311
|
+
@classmethod
|
|
312
|
+
def has_value(cls, value: Union[Any, str]) -> bool:
|
|
313
|
+
if isinstance(value, cls):
|
|
314
|
+
return True
|
|
315
|
+
return isinstance(value, str) and value.upper() in (name for name in cls.__members__)
|
|
316
|
+
|
|
317
|
+
@classmethod
|
|
318
|
+
def from_value(cls, value: Union[Any, str]) -> Optional[Any]:
|
|
319
|
+
if not cls.has_value(value):
|
|
320
|
+
return None
|
|
321
|
+
if isinstance(value, cls):
|
|
322
|
+
return value
|
|
323
|
+
if isinstance(value, str):
|
|
324
|
+
return cls[value.upper()]
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from typing import Any, Dict, Optional, Tuple
|
|
3
|
+
|
|
4
|
+
import joblib
|
|
5
|
+
|
|
6
|
+
from mage_ai.ai.utils.xgboost import load_model as load_model_xgboost
|
|
7
|
+
from mage_ai.ai.utils.xgboost import save_model as save_model_xgboost
|
|
8
|
+
|
|
9
|
+
# MATRIX_NPZ_FILE, MATRIX_SAMPLE_NPZ_FILE
|
|
10
|
+
from mage_ai.data_preparation.models.variables.constants import (
|
|
11
|
+
CONFIG_JSON_FILE,
|
|
12
|
+
JOBLIB_FILE,
|
|
13
|
+
JOBLIB_OBJECT_FILE,
|
|
14
|
+
MEDIA_IMAGE_VISUALIZATION_FILE,
|
|
15
|
+
UBJSON_MODEL_FILENAME,
|
|
16
|
+
VariableType,
|
|
17
|
+
)
|
|
18
|
+
from mage_ai.shared.array import is_iterable
|
|
19
|
+
from mage_ai.shared.parsers import object_to_dict
|
|
20
|
+
|
|
21
|
+
# from scipy.sparse import load_npz, save_npz
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def save_custom_object(
|
|
25
|
+
data: Any,
|
|
26
|
+
variable_path: str,
|
|
27
|
+
variable_type: Optional[VariableType] = None,
|
|
28
|
+
) -> Tuple[Dict, Optional[str]]:
|
|
29
|
+
is_object = False
|
|
30
|
+
full_path = None
|
|
31
|
+
|
|
32
|
+
if VariableType.MODEL_SKLEARN == variable_type:
|
|
33
|
+
is_object = True
|
|
34
|
+
os.makedirs(variable_path, exist_ok=True)
|
|
35
|
+
full_path = os.path.join(variable_path, JOBLIB_FILE)
|
|
36
|
+
joblib.dump(data, full_path)
|
|
37
|
+
elif VariableType.MODEL_XGBOOST == variable_type:
|
|
38
|
+
is_object = True
|
|
39
|
+
|
|
40
|
+
save_model_xgboost(
|
|
41
|
+
data,
|
|
42
|
+
model_dir=variable_path,
|
|
43
|
+
model_filename=UBJSON_MODEL_FILENAME,
|
|
44
|
+
config_filename=CONFIG_JSON_FILE,
|
|
45
|
+
image_filename=MEDIA_IMAGE_VISUALIZATION_FILE,
|
|
46
|
+
)
|
|
47
|
+
# elif VariableType.MATRIX_SPARSE == variable_type:
|
|
48
|
+
# save_npz(os.path.join(variable_path, MATRIX_NPZ_FILE), data)
|
|
49
|
+
elif VariableType.CUSTOM_OBJECT == variable_type:
|
|
50
|
+
is_object = True
|
|
51
|
+
os.makedirs(variable_path, exist_ok=True)
|
|
52
|
+
|
|
53
|
+
if not is_iterable(data):
|
|
54
|
+
full_path = os.path.join(variable_path, JOBLIB_OBJECT_FILE)
|
|
55
|
+
joblib.dump(data, full_path)
|
|
56
|
+
elif VariableType.DICTIONARY_COMPLEX == variable_type:
|
|
57
|
+
is_object = True
|
|
58
|
+
pass
|
|
59
|
+
|
|
60
|
+
if is_object:
|
|
61
|
+
data = object_to_dict(data, variable_type=variable_type)
|
|
62
|
+
|
|
63
|
+
return data, full_path
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def load_custom_object(
|
|
67
|
+
variable_path: str,
|
|
68
|
+
variable_type: Optional[VariableType] = None,
|
|
69
|
+
) -> Optional[Any]:
|
|
70
|
+
try:
|
|
71
|
+
if VariableType.MODEL_SKLEARN == variable_type:
|
|
72
|
+
return joblib.load(os.path.join(variable_path, JOBLIB_FILE))
|
|
73
|
+
elif VariableType.MODEL_XGBOOST == variable_type:
|
|
74
|
+
return load_model_xgboost(
|
|
75
|
+
model_dir=variable_path,
|
|
76
|
+
model_filename=UBJSON_MODEL_FILENAME,
|
|
77
|
+
config_filename=CONFIG_JSON_FILE,
|
|
78
|
+
raise_exception=False,
|
|
79
|
+
)
|
|
80
|
+
# elif VariableType.MATRIX_SPARSE == variable_type:
|
|
81
|
+
# return load_npz(os.path.join(variable_path, MATRIX_NPZ_FILE))
|
|
82
|
+
elif VariableType.CUSTOM_OBJECT == variable_type:
|
|
83
|
+
return joblib.load(os.path.join(variable_path, JOBLIB_OBJECT_FILE))
|
|
84
|
+
elif VariableType.DICTIONARY_COMPLEX == variable_type:
|
|
85
|
+
pass
|
|
86
|
+
except Exception as e:
|
|
87
|
+
print(f'Error loading custom object: {e}')
|
mage_ai/shared/parsers.py
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
|
+
import base64
|
|
2
|
+
import inspect
|
|
3
|
+
import io
|
|
4
|
+
import traceback
|
|
5
|
+
from collections.abc import Generator
|
|
1
6
|
from datetime import datetime
|
|
2
7
|
from enum import Enum
|
|
3
8
|
from json import JSONDecoder
|
|
9
|
+
from typing import Any, Dict, List, Optional, Union
|
|
4
10
|
|
|
5
11
|
import numpy as np
|
|
6
12
|
import pandas as pd
|
|
13
|
+
import polars as pl
|
|
14
|
+
import scipy
|
|
7
15
|
|
|
16
|
+
from mage_ai.data_preparation.models.variables.constants import VariableType
|
|
8
17
|
from mage_ai.orchestration.db.models.base import BaseModel
|
|
18
|
+
from mage_ai.shared.complex import is_model_sklearn, is_model_xgboost
|
|
9
19
|
|
|
10
20
|
INTS = (
|
|
11
21
|
np.int16,
|
|
@@ -14,6 +24,7 @@ INTS = (
|
|
|
14
24
|
np.int8,
|
|
15
25
|
np.int_,
|
|
16
26
|
np.intc,
|
|
27
|
+
np.integer,
|
|
17
28
|
np.intp,
|
|
18
29
|
np.uint16,
|
|
19
30
|
np.uint32,
|
|
@@ -24,6 +35,10 @@ INTS = (
|
|
|
24
35
|
MAX_ITEMS_IN_SAMPLE_OUTPUT = 20
|
|
25
36
|
|
|
26
37
|
|
|
38
|
+
def has_to_dict(obj) -> bool:
|
|
39
|
+
return hasattr(obj, 'to_dict')
|
|
40
|
+
|
|
41
|
+
|
|
27
42
|
def encode_complex(obj):
|
|
28
43
|
from mage_ai.shared.models import BaseDataClass
|
|
29
44
|
|
|
@@ -35,35 +50,47 @@ def encode_complex(obj):
|
|
|
35
50
|
return obj.to_dict()
|
|
36
51
|
elif isinstance(obj, Enum):
|
|
37
52
|
return obj.value
|
|
38
|
-
elif
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return float(obj)
|
|
44
|
-
elif isinstance(obj, np.ndarray):
|
|
45
|
-
return obj.tolist()
|
|
46
|
-
elif isinstance(obj, datetime):
|
|
53
|
+
elif (
|
|
54
|
+
isinstance(obj, datetime)
|
|
55
|
+
or hasattr(obj, 'isoformat')
|
|
56
|
+
and 'method' in type(obj.isoformat).__name__
|
|
57
|
+
):
|
|
47
58
|
return obj.isoformat()
|
|
48
59
|
elif isinstance(obj, INTS):
|
|
49
60
|
return int(obj)
|
|
50
|
-
elif isinstance(obj, (np.float_, np.float16, np.float32, np.float64)):
|
|
61
|
+
elif isinstance(obj, (np.float_, np.float16, np.float32, np.float64, np.floating)):
|
|
51
62
|
return float(obj)
|
|
52
63
|
elif isinstance(obj, (np.complex_, np.complex64, np.complex128)):
|
|
53
64
|
return {'real': obj.real, 'imag': obj.imag}
|
|
54
65
|
elif isinstance(obj, (np.ndarray,)):
|
|
66
|
+
# np.array is a function
|
|
55
67
|
return obj.tolist()
|
|
56
68
|
elif isinstance(obj, (np.bool_)):
|
|
57
69
|
return bool(obj)
|
|
58
|
-
elif isinstance(obj, (np.void)):
|
|
70
|
+
elif isinstance(obj, (np.void, pd._libs.missing.NAType)):
|
|
71
|
+
# Convert pandas._libs.missing.NAType to None
|
|
59
72
|
return None
|
|
60
73
|
elif isinstance(obj, pd.DataFrame):
|
|
61
74
|
return obj.to_dict(orient='records')
|
|
62
|
-
elif isinstance(obj,
|
|
75
|
+
elif isinstance(obj, pl.DataFrame):
|
|
76
|
+
return obj.to_dicts()
|
|
77
|
+
elif isinstance(obj, (pd.Index, pd.Series, pl.Series)):
|
|
63
78
|
return obj.to_list()
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
79
|
+
elif isinstance(obj, scipy.sparse.csr_matrix):
|
|
80
|
+
return serialize_matrix(obj)
|
|
81
|
+
elif is_model_sklearn(obj) or is_model_xgboost(obj) or inspect.isclass(obj):
|
|
82
|
+
return object_to_uuid(obj)
|
|
83
|
+
elif has_to_dict(obj):
|
|
84
|
+
return obj.to_dict()
|
|
85
|
+
elif isinstance(obj, Generator):
|
|
86
|
+
return object_to_uuid(obj)
|
|
87
|
+
elif isinstance(obj, Exception):
|
|
88
|
+
# Serialize the exception
|
|
89
|
+
return {
|
|
90
|
+
'type': type(obj).__name__,
|
|
91
|
+
'message': str(obj),
|
|
92
|
+
'traceback': traceback.format_tb(obj.__traceback__),
|
|
93
|
+
}
|
|
67
94
|
|
|
68
95
|
return obj
|
|
69
96
|
|
|
@@ -110,3 +137,102 @@ def sample_output(obj):
|
|
|
110
137
|
output[k] = v
|
|
111
138
|
return output, sampled
|
|
112
139
|
return obj, False
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def serialize_matrix(csr_matrix: scipy.sparse._csr.csr_matrix) -> Dict:
|
|
143
|
+
with io.BytesIO() as buffer:
|
|
144
|
+
scipy.sparse.save_npz(buffer, csr_matrix)
|
|
145
|
+
buffer.seek(0)
|
|
146
|
+
data = base64.b64encode(buffer.read()).decode('ascii')
|
|
147
|
+
|
|
148
|
+
return {'__type__': 'scipy.sparse.csr_matrix', '__data__': data}
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def deserialize_matrix(json_dict: Dict) -> scipy.sparse._csr.csr_matrix:
|
|
152
|
+
data = json_dict['__data__']
|
|
153
|
+
data = base64.b64decode(data.encode('ascii'))
|
|
154
|
+
|
|
155
|
+
with io.BytesIO(data) as buffer:
|
|
156
|
+
buffer.seek(0)
|
|
157
|
+
csr_matrix = scipy.sparse.load_npz(buffer)
|
|
158
|
+
|
|
159
|
+
return csr_matrix
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def convert_matrix_to_dataframe(csr_matrix: scipy.sparse.csr_matrix) -> pd.DataFrame:
|
|
163
|
+
if isinstance(csr_matrix, scipy.sparse.csr_matrix):
|
|
164
|
+
n_columns = csr_matrix.shape[1]
|
|
165
|
+
return pd.DataFrame(csr_matrix.toarray(), columns=[str(i) for i in range(n_columns)])
|
|
166
|
+
return csr_matrix
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def polars_to_dict_split(df: pl.DataFrame) -> Dict:
|
|
170
|
+
# Extract column names
|
|
171
|
+
columns = df.columns
|
|
172
|
+
|
|
173
|
+
# Extract rows as list of lists
|
|
174
|
+
data = df.to_numpy().tolist()
|
|
175
|
+
|
|
176
|
+
# Construct and return the dictionary
|
|
177
|
+
return dict(columns=columns, data=data)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def object_to_hash(obj: Any) -> str:
|
|
181
|
+
return hex(id(obj))
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def object_uuid_parts(obj: Any) -> Dict[str, Union[bool, str, List[str]]]:
|
|
185
|
+
if inspect.isclass(obj):
|
|
186
|
+
obj_cls = obj
|
|
187
|
+
else:
|
|
188
|
+
obj_cls = obj.__class__
|
|
189
|
+
|
|
190
|
+
return dict(
|
|
191
|
+
module=obj_cls.__module__,
|
|
192
|
+
name=obj_cls.__name__,
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def object_to_uuid(obj: Any, include_hash: bool = False) -> str:
|
|
197
|
+
hash_uuid = None
|
|
198
|
+
if include_hash:
|
|
199
|
+
hash_uuid = object_to_hash(obj)
|
|
200
|
+
|
|
201
|
+
parts = object_uuid_parts(obj)
|
|
202
|
+
uuid = '.'.join([
|
|
203
|
+
t
|
|
204
|
+
for t in [
|
|
205
|
+
str(parts['module']),
|
|
206
|
+
str(parts['name']),
|
|
207
|
+
]
|
|
208
|
+
if t
|
|
209
|
+
])
|
|
210
|
+
|
|
211
|
+
if hash_uuid:
|
|
212
|
+
return f'{uuid} {hash_uuid}'
|
|
213
|
+
|
|
214
|
+
return uuid
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def object_to_dict(
|
|
218
|
+
obj: Any,
|
|
219
|
+
include_hash: bool = True,
|
|
220
|
+
include_uuid: bool = True,
|
|
221
|
+
variable_type: Optional[VariableType] = None,
|
|
222
|
+
) -> Dict[str, Union[bool, str, List[str]]]:
|
|
223
|
+
is_class = inspect.isclass(obj)
|
|
224
|
+
|
|
225
|
+
data_dict = object_uuid_parts(obj)
|
|
226
|
+
data_dict['type'] = 'class' if is_class else 'instance'
|
|
227
|
+
data_dict['uuid'] = object_to_uuid(obj, include_hash=False)
|
|
228
|
+
|
|
229
|
+
if include_uuid:
|
|
230
|
+
data_dict['uuid'] = object_to_uuid(obj, include_hash=False)
|
|
231
|
+
|
|
232
|
+
if include_hash and not is_class:
|
|
233
|
+
data_dict['hash'] = object_to_hash(obj)
|
|
234
|
+
|
|
235
|
+
if variable_type:
|
|
236
|
+
data_dict['variable_type'] = variable_type.value
|
|
237
|
+
|
|
238
|
+
return data_dict
|
mage_ai/shared/path_fixer.py
CHANGED
|
@@ -33,7 +33,9 @@ def add_absolute_path(file_path: str, add_base_repo_path: bool = True) -> str:
|
|
|
33
33
|
# DBT v1 paths
|
|
34
34
|
full_path = os.path.join(repo_path, 'dbt', file_path)
|
|
35
35
|
else:
|
|
36
|
-
full_path = find_directory(
|
|
36
|
+
full_path = find_directory(
|
|
37
|
+
repo_path, lambda x: x.endswith(file_path)
|
|
38
|
+
)
|
|
37
39
|
|
|
38
40
|
if full_path:
|
|
39
41
|
# Remove the repo path
|
|
@@ -93,7 +95,7 @@ def remove_base_repo_name(file_path: str) -> str:
|
|
|
93
95
|
|
|
94
96
|
def remove_base_repo_path_or_name(file_path: str) -> str:
|
|
95
97
|
if not file_path:
|
|
96
|
-
return
|
|
98
|
+
return file_path
|
|
97
99
|
|
|
98
100
|
if os.path.isabs(file_path):
|
|
99
101
|
value = str(remove_base_repo_path(file_path))
|
|
@@ -121,11 +123,13 @@ def remove_base_repo_directory_name(file_path: str) -> str:
|
|
|
121
123
|
|
|
122
124
|
def remove_repo_names(file_path: str) -> str:
|
|
123
125
|
try:
|
|
124
|
-
path = Path(file_path).relative_to(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
path = Path(file_path).relative_to(
|
|
127
|
+
get_repo_path(
|
|
128
|
+
absolute_path=False,
|
|
129
|
+
file_path=file_path,
|
|
130
|
+
root_project=False,
|
|
131
|
+
)
|
|
132
|
+
)
|
|
129
133
|
return str(path)
|
|
130
134
|
except ValueError:
|
|
131
135
|
return file_path
|
|
File without changes
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import threading
|
|
3
|
+
from functools import wraps
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class SingletonBase:
|
|
7
|
+
def __init__(self):
|
|
8
|
+
self.value = None
|
|
9
|
+
self._lock = asyncio.Lock()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class SingletonMeta(type):
|
|
13
|
+
_instances = {}
|
|
14
|
+
_lock: threading.Lock = threading.Lock()
|
|
15
|
+
|
|
16
|
+
def __call__(cls, *args, **kwargs):
|
|
17
|
+
with cls._lock:
|
|
18
|
+
if cls not in cls._instances:
|
|
19
|
+
instance = super().__call__(*args, **kwargs)
|
|
20
|
+
cls._instances[cls] = instance
|
|
21
|
+
return cls._instances[cls]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def singleton(cls):
|
|
25
|
+
class Wrapper(cls, metaclass=SingletonMeta):
|
|
26
|
+
__doc__ = cls.__doc__
|
|
27
|
+
|
|
28
|
+
Wrapper.__name__ = cls.__name__
|
|
29
|
+
return Wrapper
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def synchronized_method(method):
|
|
33
|
+
@wraps(method)
|
|
34
|
+
def wrapper(self, *args, **kwargs):
|
|
35
|
+
with self._lock:
|
|
36
|
+
return method(self, *args, **kwargs)
|
|
37
|
+
|
|
38
|
+
return wrapper
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def asynchronized_method(method):
|
|
42
|
+
@wraps(method)
|
|
43
|
+
async def wrapper(self, *args, **kwargs):
|
|
44
|
+
async with self._lock:
|
|
45
|
+
return method(self, *args, **kwargs)
|
|
46
|
+
|
|
47
|
+
return wrapper
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from typing import Any, Optional
|
|
2
|
+
|
|
3
|
+
from mage_ai.shared.singletons.base import SingletonBase, singleton
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@singleton
|
|
7
|
+
class MemoryManagerController(SingletonBase):
|
|
8
|
+
def __init__(self):
|
|
9
|
+
super().__init__() # Ensures self._lock is initialized
|
|
10
|
+
self.events = {}
|
|
11
|
+
|
|
12
|
+
def add_event_monitor(self, key: str, stop_event, monitor_thread):
|
|
13
|
+
self.stop_event(key)
|
|
14
|
+
self.events[key] = (stop_event, monitor_thread)
|
|
15
|
+
|
|
16
|
+
def stop_event(
|
|
17
|
+
self, key, stop_event: Optional[Any] = None, monitor_thread: Optional[Any] = None
|
|
18
|
+
):
|
|
19
|
+
if self.events.get(key):
|
|
20
|
+
if not stop_event and not monitor_thread:
|
|
21
|
+
stop_event, monitor_thread = self.events[key]
|
|
22
|
+
|
|
23
|
+
if stop_event:
|
|
24
|
+
stop_event.set()
|
|
25
|
+
stop_event = None
|
|
26
|
+
if monitor_thread:
|
|
27
|
+
monitor_thread.join()
|
|
28
|
+
monitor_thread = None
|
|
29
|
+
del self.events[key]
|
|
30
|
+
|
|
31
|
+
def stop_all_events(self):
|
|
32
|
+
for key, pair in self.events.items():
|
|
33
|
+
self.stop_event(key, *pair)
|
|
34
|
+
print(f'Event stopped: {key}')
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def get_memory_manager_controller():
|
|
38
|
+
return MemoryManagerController()
|
mage_ai/shared/strings.py
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
import json
|
|
1
2
|
import re
|
|
2
3
|
from typing import List
|
|
3
4
|
|
|
4
5
|
import inflection
|
|
5
6
|
|
|
6
7
|
|
|
8
|
+
def is_json(myjson):
|
|
9
|
+
try:
|
|
10
|
+
json_object = json.loads(str(myjson))
|
|
11
|
+
if isinstance(json_object, dict):
|
|
12
|
+
return json_object
|
|
13
|
+
return False
|
|
14
|
+
except Exception:
|
|
15
|
+
return False
|
|
16
|
+
|
|
17
|
+
|
|
7
18
|
def camel_to_snake_case(name):
|
|
8
19
|
name = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
|
|
9
20
|
name = re.sub('__([A-Z])', r'_\1', name)
|
|
@@ -30,6 +41,28 @@ def is_number(s) -> bool:
|
|
|
30
41
|
return False
|
|
31
42
|
|
|
32
43
|
|
|
44
|
+
def string_to_number(value: str):
|
|
45
|
+
"""
|
|
46
|
+
Attempts to convert a string to an integer or float.
|
|
47
|
+
|
|
48
|
+
Parameters:
|
|
49
|
+
- value: The string to convert.
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
- int, float, or original str depending on its content.
|
|
53
|
+
"""
|
|
54
|
+
try:
|
|
55
|
+
# First, try to convert it to an integer.
|
|
56
|
+
return int(value)
|
|
57
|
+
except ValueError:
|
|
58
|
+
# If it fails, try to convert it to a float.
|
|
59
|
+
try:
|
|
60
|
+
return float(value)
|
|
61
|
+
except ValueError:
|
|
62
|
+
# If it also fails, return the original string.
|
|
63
|
+
return value
|
|
64
|
+
|
|
65
|
+
|
|
33
66
|
def replacer(s, newstring, index, nofail=False):
|
|
34
67
|
# raise an error if index is outside of the string
|
|
35
68
|
if not nofail and index not in range(len(s)):
|
|
@@ -42,7 +75,7 @@ def replacer(s, newstring, index, nofail=False):
|
|
|
42
75
|
return s + newstring
|
|
43
76
|
|
|
44
77
|
# insert the new string between 'slices' of the original
|
|
45
|
-
return s[:index] + newstring + s[index + 1:]
|
|
78
|
+
return s[:index] + newstring + s[index + 1 :]
|
|
46
79
|
|
|
47
80
|
|
|
48
81
|
def remove_extension_from_filename(filename: str) -> str:
|
mage_ai/shared/yaml.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from typing import Dict, List, Union
|
|
2
|
+
|
|
3
|
+
import yaml
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
# Speed up yaml load performance with CLoader
|
|
7
|
+
from yaml import CLoader as Loader
|
|
8
|
+
except Exception:
|
|
9
|
+
from yaml import FullLoader as Loader
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def trim_strings(data: Union[Dict, List, str]) -> Union[Dict, List, str]:
|
|
13
|
+
if isinstance(data, dict):
|
|
14
|
+
return {k: trim_strings(v) for k, v in data.items()}
|
|
15
|
+
elif isinstance(data, list):
|
|
16
|
+
return [trim_strings(item) for item in data]
|
|
17
|
+
elif isinstance(data, str):
|
|
18
|
+
return data.rstrip() # Remove trailing whitespace and newlines
|
|
19
|
+
else:
|
|
20
|
+
return data
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def load_yaml(data):
|
|
24
|
+
return yaml.load(data, Loader=Loader)
|