mage-ai 0.9.8__py3-none-any.whl → 0.9.9__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/constants.py +1 -0
- mage_ai/ai/generator.py +6 -0
- mage_ai/ai/{gen_doc_for_pipeline.py → generator_cmds.py} +5 -0
- mage_ai/ai/llm_pipeline_wizard.py +108 -3
- mage_ai/api/policies/BlockPolicy.py +1 -0
- mage_ai/api/policies/BlockTemplatePolicy.py +9 -0
- mage_ai/api/policies/LlmPolicy.py +3 -2
- mage_ai/api/policies/OauthAccessTokenPolicy.py +31 -0
- mage_ai/api/policies/PipelinePolicy.py +1 -0
- mage_ai/api/policies/ProjectPolicy.py +9 -0
- mage_ai/api/policies/SearchResultPolicy.py +32 -0
- mage_ai/api/policies/VariablePolicy.py +8 -0
- mage_ai/api/presenters/BlockTemplatePresenter.py +1 -0
- mage_ai/api/presenters/OauthAccessTokenPresenter.py +9 -0
- mage_ai/api/presenters/ProjectPresenter.py +2 -0
- mage_ai/api/presenters/SearchResultPresenter.py +73 -0
- mage_ai/api/resources/BlockResource.py +43 -4
- mage_ai/api/resources/BlockTemplateResource.py +15 -2
- mage_ai/api/resources/CustomTemplateResource.py +15 -3
- mage_ai/api/resources/FileContentResource.py +8 -1
- mage_ai/api/resources/FileResource.py +22 -2
- mage_ai/api/resources/OauthAccessTokenResource.py +24 -0
- mage_ai/api/resources/PipelineResource.py +70 -2
- mage_ai/api/resources/ProjectResource.py +15 -1
- mage_ai/api/resources/SearchResultResource.py +68 -0
- mage_ai/api/resources/VariableResource.py +25 -14
- mage_ai/cache/base.py +3 -0
- mage_ai/cache/block_action_object/__init__.py +282 -0
- mage_ai/cache/block_action_object/constants.py +4 -0
- mage_ai/cache/constants.py +1 -0
- mage_ai/data_integrations/destinations/constants.py +2 -0
- mage_ai/data_preparation/executors/k8s_pipeline_executor.py +1 -1
- mage_ai/data_preparation/models/block/__init__.py +20 -1
- mage_ai/data_preparation/models/block/dbt/utils/__init__.py +1 -0
- mage_ai/data_preparation/models/custom_templates/custom_block_template.py +8 -3
- mage_ai/data_preparation/models/custom_templates/utils.py +6 -3
- mage_ai/data_preparation/models/file.py +3 -0
- mage_ai/data_preparation/models/pipeline.py +10 -1
- mage_ai/data_preparation/models/{project.py → project/__init__.py} +17 -0
- mage_ai/data_preparation/models/project/constants.py +5 -0
- mage_ai/data_preparation/repo_manager.py +9 -6
- mage_ai/data_preparation/templates/constants.py +478 -1
- mage_ai/data_preparation/templates/template.py +9 -1
- mage_ai/orchestration/db/__init__.py +25 -0
- mage_ai/orchestration/pipeline_scheduler.py +23 -0
- mage_ai/server/constants.py +1 -1
- mage_ai/server/frontend_dist/404.html +2 -2
- mage_ai/server/frontend_dist/404.html.html +2 -2
- mage_ai/server/frontend_dist/_next/static/OwvTROmputQCA1Z9HEGDv/_buildManifest.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{1005-ce36fe7ed460d006.js → 1005-16c1a6678de5311e.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/1424-e22139f33196c5c1.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/1484-a76b2c31e4808379.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/2485-b569baad92049d6b.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{2786-d8b593e5d7c42665.js → 2786-acce6ea0d9b4898e.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3654-573457b62efff6e2.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/3881-0eb04f7f7a244347.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{4317-b112fe7bb532b998.js → 4317-3fe63fc9401685d6.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{4822-52d9d661b6bd1ae9.js → 4822-045cc7cdd7c95163.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{547-14029bdacc0ed267.js → 547-4ad2cdae967055b6.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/6299-cf188c1b7a1bc33c.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/{7815-6dc55b5fd5d1f48a.js → 7815-fbd99c8f259d9e8b.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{8312-cdc4d6c3b9f53099.js → 8312-c88a3b1012e5448b.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/{8952-492bf0e29d215ddd.js → 8952-e94a7334fcd5c68b.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/9055-d0d25298cb5f4e45.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{_app-c7557dc9e725825e.js → _app-fa38a24707c76411.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/files-b9dac983c75798f2.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/{settings-17bb362b9683079c.js → settings-453aaa7bf78f8101.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users/{[user]-bfa53c0ee79920a0.js → [user]-3b502aa6d1a04cad.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users/{new-2f7e6bf8e2a37380.js → new-dd41d718cbb5990c.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users-ec748f838b7b8fad.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage-bcc24120f5911f76.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{overview-8ffbc4b0e8a43266.js → overview-6f20b9e9cbec91d6.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/backfills/{[...slug]-373f6b8c9161e819.js → [...slug]-55212dfc15881ef2.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{backfills-226bf0c5c1bfe004.js → backfills-6b4a82cd0516e121.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-0705c99df236ec8a.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{logs-4ade07836fd577c9.js → logs-c294f5d74bd2d50f.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{monitors-fd9eb711e89425e9.js → monitors-1b9e4abc54842cdf.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{runs-027666ed18d3151e.js → runs-17ebe87e94242ae5.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/settings-48b60ca236a26818.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{syncs-de58e6b91e5e4552.js → syncs-5153f4665aaf8b17.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/triggers/{[...slug]-432843576e1ed09e.js → [...slug]-1306e85191f6b47c.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/{triggers-ae31b1d0d8a4634d.js → triggers-2e731d343a26d46a.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines-0fab737dbc9074fc.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/preferences-b2354688508b0755.js +1 -0
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/{users-a4f01b5c429757cc.js → users-6522c963087f18e8.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{sign-in-1140f8ee7e89381a.js → sign-in-7dcd1257ca9660bb.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/templates/{[...slug]-f59b3f04c5a49351.js → [...slug]-78a07e7fe8973811.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/{templates-dbb209ce131390a9.js → templates-19df643f52679d5a.js} +1 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/version-control-a1cf445565b68809.js +1 -0
- mage_ai/server/frontend_dist/files.html +2 -2
- mage_ai/server/frontend_dist/index.html +2 -2
- mage_ai/server/frontend_dist/manage/settings.html +2 -2
- mage_ai/server/frontend_dist/manage/users/[user].html +2 -2
- mage_ai/server/frontend_dist/manage/users/new.html +2 -2
- mage_ai/server/frontend_dist/manage/users.html +2 -2
- mage_ai/server/frontend_dist/manage.html +2 -2
- mage_ai/server/frontend_dist/overview.html +2 -2
- mage_ai/server/frontend_dist/pipeline-runs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/backfills/[...slug].html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/backfills.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/edit.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/logs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors/block-runs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors/block-runtime.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/monitors.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/runs/[run].html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/runs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/settings.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/syncs.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/triggers/[...slug].html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline]/triggers.html +2 -2
- mage_ai/server/frontend_dist/pipelines/[pipeline].html +2 -2
- mage_ai/server/frontend_dist/pipelines.html +2 -2
- mage_ai/server/frontend_dist/settings/account/profile.html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/preferences.html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/sync-data.html +2 -2
- mage_ai/server/frontend_dist/settings/workspace/users.html +2 -2
- mage_ai/server/frontend_dist/settings.html +2 -2
- mage_ai/server/frontend_dist/sign-in.html +16 -16
- mage_ai/server/frontend_dist/templates/[...slug].html +2 -2
- mage_ai/server/frontend_dist/templates.html +2 -2
- mage_ai/server/frontend_dist/terminal.html +2 -2
- mage_ai/server/frontend_dist/test.html +2 -2
- mage_ai/server/frontend_dist/triggers.html +2 -2
- mage_ai/server/frontend_dist/version-control.html +2 -2
- mage_ai/server/server.py +5 -0
- mage_ai/services/search/__init__.py +0 -0
- mage_ai/services/search/block_action_objects.py +33 -0
- mage_ai/services/search/constants.py +1 -0
- mage_ai/shared/array.py +7 -0
- mage_ai/shared/parsers.py +11 -2
- mage_ai/tests/shared/test_parsers.py +73 -0
- mage_ai/usage_statistics/constants.py +1 -0
- mage_ai/usage_statistics/logger.py +19 -1
- {mage_ai-0.9.8.dist-info → mage_ai-0.9.9.dist-info}/METADATA +9 -7
- {mage_ai-0.9.8.dist-info → mage_ai-0.9.9.dist-info}/RECORD +142 -129
- mage_ai/server/frontend_dist/_next/static/RcIgkp9pBXE1Rb4tOGR1L/_buildManifest.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/1424-de97c5aa0477894b.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/1484-c9d6bc33227070dd.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/2485-86c97f516c1abb9f.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3215-c2f5f19b650f9a50.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3654-bff4740b63cf280c.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/3881-7f121dbbe6e273cd.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/6299-97f283be01adf6a8.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/files-0df5a20d6f1aa606.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage/users-1f6cb7656299cbd1.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/manage-4894eabb442a039c.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/edit-a9bd86bee73b5762.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines/[pipeline]/settings-cf51793c2112915c.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/pipelines-f1131ffe0d2a4a06.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/settings/workspace/preferences-170943ca00445486.js +0 -1
- mage_ai/server/frontend_dist/_next/static/chunks/pages/version-control-2ecda1f1437013f2.js +0 -1
- /mage_ai/server/frontend_dist/_next/static/{RcIgkp9pBXE1Rb4tOGR1L → OwvTROmputQCA1Z9HEGDv}/_middlewareManifest.js +0 -0
- /mage_ai/server/frontend_dist/_next/static/{RcIgkp9pBXE1Rb4tOGR1L → OwvTROmputQCA1Z9HEGDv}/_ssgManifest.js +0 -0
- {mage_ai-0.9.8.dist-info → mage_ai-0.9.9.dist-info}/LICENSE +0 -0
- {mage_ai-0.9.8.dist-info → mage_ai-0.9.9.dist-info}/WHEEL +0 -0
- {mage_ai-0.9.8.dist-info → mage_ai-0.9.9.dist-info}/entry_points.txt +0 -0
- {mage_ai-0.9.8.dist-info → mage_ai-0.9.9.dist-info}/top_level.txt +0 -0
|
@@ -515,7 +515,7 @@ class Block:
|
|
|
515
515
|
if not replicated_block and \
|
|
516
516
|
(BlockType.DBT != block_type or BlockLanguage.YAML == language):
|
|
517
517
|
|
|
518
|
-
block_directory =
|
|
518
|
+
block_directory = self.file_directory_name(block_type)
|
|
519
519
|
block_dir_path = os.path.join(repo_path, block_directory)
|
|
520
520
|
if not os.path.exists(block_dir_path):
|
|
521
521
|
os.mkdir(block_dir_path)
|
|
@@ -567,6 +567,25 @@ class Block:
|
|
|
567
567
|
)
|
|
568
568
|
return block
|
|
569
569
|
|
|
570
|
+
@classmethod
|
|
571
|
+
def file_directory_name(self, block_type: BlockType) -> str:
|
|
572
|
+
return f'{block_type}s' if block_type != BlockType.CUSTOM else block_type
|
|
573
|
+
|
|
574
|
+
@classmethod
|
|
575
|
+
def block_type_from_path(self, block_file_absolute_path: str) -> BlockType:
|
|
576
|
+
file_path = str(block_file_absolute_path).replace(get_repo_path(), '')
|
|
577
|
+
if file_path.startswith(os.sep):
|
|
578
|
+
file_path = file_path[1:]
|
|
579
|
+
|
|
580
|
+
file_path_parts = file_path.split(os.path.sep)
|
|
581
|
+
dir_name = file_path_parts[0]
|
|
582
|
+
|
|
583
|
+
for block_type in BlockType:
|
|
584
|
+
if BlockType.CUSTOM == block_type and dir_name == block_type:
|
|
585
|
+
return BlockType.CUSTOM
|
|
586
|
+
elif dir_name == f'{block_type}s':
|
|
587
|
+
return block_type
|
|
588
|
+
|
|
570
589
|
@classmethod
|
|
571
590
|
def get_all_blocks(self, repo_path) -> Dict:
|
|
572
591
|
block_uuids = dict()
|
|
@@ -568,6 +568,7 @@ def config_file_loader_and_configuration(block, profile_target: str) -> Dict:
|
|
|
568
568
|
SNOWFLAKE_DEFAULT_SCHEMA=profile.get('schema'),
|
|
569
569
|
SNOWFLAKE_DEFAULT_WH=profile.get('warehouse'),
|
|
570
570
|
SNOWFLAKE_USER=profile.get('user'),
|
|
571
|
+
SNOWFLAKE_ROLE=profile.get('role'),
|
|
571
572
|
)
|
|
572
573
|
|
|
573
574
|
if 'password' in profile:
|
|
@@ -112,7 +112,7 @@ class CustomBlockTemplate(BaseConfig):
|
|
|
112
112
|
language_to_use = language or self.language
|
|
113
113
|
filename = '.'.join([
|
|
114
114
|
self.template_uuid,
|
|
115
|
-
BLOCK_LANGUAGE_TO_FILE_EXTENSION
|
|
115
|
+
BLOCK_LANGUAGE_TO_FILE_EXTENSION.get(language_to_use, ''),
|
|
116
116
|
])
|
|
117
117
|
|
|
118
118
|
return File(
|
|
@@ -130,12 +130,17 @@ class CustomBlockTemplate(BaseConfig):
|
|
|
130
130
|
if content:
|
|
131
131
|
return Template(content).render(**(variables or {}))
|
|
132
132
|
|
|
133
|
-
def to_dict(self) -> Dict:
|
|
134
|
-
|
|
133
|
+
def to_dict(self, include_content: bool = False) -> Dict:
|
|
134
|
+
data = merge_dict(self.to_dict_base(), dict(
|
|
135
135
|
template_uuid=self.template_uuid,
|
|
136
136
|
uuid=self.uuid,
|
|
137
137
|
))
|
|
138
138
|
|
|
139
|
+
if include_content:
|
|
140
|
+
data['content'] = self.load_template_content()
|
|
141
|
+
|
|
142
|
+
return data
|
|
143
|
+
|
|
139
144
|
def to_dict_base(self) -> Dict:
|
|
140
145
|
return dict(
|
|
141
146
|
block_type=self.block_type,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import os
|
|
2
|
-
from
|
|
2
|
+
from typing import Dict, List
|
|
3
|
+
|
|
3
4
|
from mage_ai.data_preparation.models.custom_templates.constants import (
|
|
4
5
|
CUSTOM_TEMPLATES_DIRECTORY,
|
|
5
6
|
CUSTOM_TEMPLATES_DIRECTORY_ENVIRONMENT_VARIABLE,
|
|
6
7
|
)
|
|
8
|
+
from mage_ai.data_preparation.models.file import File
|
|
7
9
|
from mage_ai.settings.repo import get_repo_path
|
|
8
10
|
from mage_ai.shared.hash import group_by
|
|
9
|
-
from typing import Dict, List
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
def custom_templates_directory() -> str:
|
|
@@ -32,6 +33,8 @@ def flatten_files(
|
|
|
32
33
|
children: List[Dict],
|
|
33
34
|
parent_names: List[str] = None,
|
|
34
35
|
) -> List[Dict]:
|
|
36
|
+
if not children:
|
|
37
|
+
return []
|
|
35
38
|
arr = []
|
|
36
39
|
|
|
37
40
|
for child1 in children:
|
|
@@ -57,7 +60,7 @@ def group_and_hydrate_files(
|
|
|
57
60
|
|
|
58
61
|
arr = []
|
|
59
62
|
|
|
60
|
-
for template_uuid,
|
|
63
|
+
for template_uuid, _ in groups.items():
|
|
61
64
|
custom_template = custom_template_class.load(template_uuid=template_uuid)
|
|
62
65
|
if custom_template:
|
|
63
66
|
arr.append(custom_template)
|
|
@@ -334,6 +334,9 @@ class File:
|
|
|
334
334
|
new_path,
|
|
335
335
|
)
|
|
336
336
|
|
|
337
|
+
self.dir_path = dir_path
|
|
338
|
+
self.filename = filename
|
|
339
|
+
|
|
337
340
|
def to_dict(self, include_content=False):
|
|
338
341
|
data = dict(name=self.filename, path=os.path.join(self.dir_path, self.filename))
|
|
339
342
|
if include_content:
|
|
@@ -882,7 +882,11 @@ class Pipeline:
|
|
|
882
882
|
if block is None:
|
|
883
883
|
continue
|
|
884
884
|
if 'content' in block_data:
|
|
885
|
+
from mage_ai.cache.block_action_object import BlockActionObjectCache
|
|
886
|
+
|
|
887
|
+
cache_block_action_object = await BlockActionObjectCache.initialize_cache()
|
|
885
888
|
await block.update_content_async(block_data['content'], widget=widget)
|
|
889
|
+
cache_block_action_object.update_block(block)
|
|
886
890
|
if 'callback_content' in block_data \
|
|
887
891
|
and block.callback_block:
|
|
888
892
|
await block.callback_block.update_content_async(
|
|
@@ -944,7 +948,12 @@ class Pipeline:
|
|
|
944
948
|
|
|
945
949
|
should_save_async = should_save_async or True
|
|
946
950
|
elif name and name != block.name:
|
|
951
|
+
from mage_ai.cache.block_action_object import BlockActionObjectCache
|
|
952
|
+
|
|
953
|
+
cache_block_action_object = await BlockActionObjectCache.initialize_cache()
|
|
954
|
+
cache_block_action_object.update_block(block, remove=True)
|
|
947
955
|
block.update(extract(block_data, ['name']))
|
|
956
|
+
cache_block_action_object.update_block(block)
|
|
948
957
|
block_uuid_mapping[block_data.get('uuid')] = block.uuid
|
|
949
958
|
should_save_async = should_save_async or True
|
|
950
959
|
|
|
@@ -1006,7 +1015,7 @@ class Pipeline:
|
|
|
1006
1015
|
blocks_by_uuid,
|
|
1007
1016
|
block,
|
|
1008
1017
|
upstream_blocks,
|
|
1009
|
-
priority=None,
|
|
1018
|
+
priority: int = None,
|
|
1010
1019
|
):
|
|
1011
1020
|
mapping = blocks_by_uuid.copy()
|
|
1012
1021
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import aiohttp
|
|
2
2
|
|
|
3
|
+
from mage_ai.data_preparation.models.project.constants import FeatureUUID
|
|
3
4
|
from mage_ai.data_preparation.repo_manager import get_repo_config
|
|
4
5
|
from mage_ai.server.constants import VERSION
|
|
5
6
|
from mage_ai.settings.repo import get_repo_path
|
|
7
|
+
from typing import Dict
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
class Project():
|
|
@@ -21,6 +23,21 @@ class Project():
|
|
|
21
23
|
def project_uuid(self) -> str:
|
|
22
24
|
return self.repo_config.project_uuid
|
|
23
25
|
|
|
26
|
+
@property
|
|
27
|
+
def openai_api_key(self) -> str:
|
|
28
|
+
return self.repo_config.openai_api_key
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def features(self) -> Dict:
|
|
32
|
+
data = {}
|
|
33
|
+
features = self.repo_config.features
|
|
34
|
+
|
|
35
|
+
for uuid in FeatureUUID:
|
|
36
|
+
key = uuid.value
|
|
37
|
+
data[key] = features.get(key) if features else None
|
|
38
|
+
|
|
39
|
+
return data
|
|
40
|
+
|
|
24
41
|
async def latest_version(self) -> str:
|
|
25
42
|
try:
|
|
26
43
|
async with aiohttp.ClientSession() as session:
|
|
@@ -76,14 +76,15 @@ class RepoConfig:
|
|
|
76
76
|
repo_config.get('azure_container_instance_config')
|
|
77
77
|
self.ecs_config = repo_config.get('ecs_config')
|
|
78
78
|
self.emr_config = repo_config.get('emr_config')
|
|
79
|
+
self.features = repo_config.get('features', {})
|
|
79
80
|
self.gcp_cloud_run_config = repo_config.get('gcp_cloud_run_config')
|
|
80
81
|
self.k8s_executor_config = repo_config.get('k8s_executor_config')
|
|
81
82
|
self.spark_config = repo_config.get('spark_config')
|
|
82
|
-
|
|
83
83
|
self.notification_config = repo_config.get('notification_config', dict())
|
|
84
84
|
self.queue_config = repo_config.get('queue_config', dict())
|
|
85
85
|
self.project_uuid = repo_config.get('project_uuid')
|
|
86
86
|
self.help_improve_mage = repo_config.get('help_improve_mage')
|
|
87
|
+
self.openai_api_key = repo_config.get('openai_api_key')
|
|
87
88
|
self.retry_config = repo_config.get('retry_config')
|
|
88
89
|
|
|
89
90
|
self.ldap_config = repo_config.get('ldap_config')
|
|
@@ -115,20 +116,22 @@ class RepoConfig:
|
|
|
115
116
|
|
|
116
117
|
def to_dict(self, remote: bool = False) -> Dict:
|
|
117
118
|
return dict(
|
|
118
|
-
project_type=self.project_type,
|
|
119
119
|
azure_container_instance_config=self.azure_container_instance_config,
|
|
120
120
|
ecs_config=self.ecs_config,
|
|
121
121
|
emr_config=self.emr_config,
|
|
122
|
+
features=self.features,
|
|
122
123
|
gcp_cloud_run_config=self.gcp_cloud_run_config,
|
|
124
|
+
help_improve_mage=self.help_improve_mage,
|
|
123
125
|
notification_config=self.notification_config,
|
|
126
|
+
openai_api_key=self.openai_api_key,
|
|
127
|
+
project_type=self.project_type,
|
|
128
|
+
project_uuid=self.project_uuid,
|
|
124
129
|
queue_config=self.queue_config,
|
|
130
|
+
remote_variables_dir=self.remote_variables_dir,
|
|
125
131
|
repo_path=self.repo_path,
|
|
132
|
+
spark_config=self.spark_config,
|
|
126
133
|
variables_dir=self.remote_variables_dir if remote else self.variables_dir,
|
|
127
134
|
variables_retention_period=self.variables_retention_period,
|
|
128
|
-
remote_variables_dir=self.remote_variables_dir,
|
|
129
|
-
project_uuid=self.project_uuid,
|
|
130
|
-
help_improve_mage=self.help_improve_mage,
|
|
131
|
-
spark_config=self.spark_config,
|
|
132
135
|
)
|
|
133
136
|
|
|
134
137
|
def save(self, **kwargs) -> None:
|