digitalhub 0.14.0b6__py3-none-any.whl → 0.14.1__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 digitalhub might be problematic. Click here for more details.

Files changed (69) hide show
  1. digitalhub/__init__.py +2 -2
  2. digitalhub/context/api.py +42 -1
  3. digitalhub/context/context.py +3 -6
  4. digitalhub/entities/_base/context/entity.py +0 -3
  5. digitalhub/entities/_base/material/entity.py +2 -2
  6. digitalhub/entities/_processors/base/crud.py +14 -23
  7. digitalhub/entities/_processors/base/import_export.py +0 -5
  8. digitalhub/entities/_processors/base/processor.py +1 -4
  9. digitalhub/entities/_processors/base/special_ops.py +4 -8
  10. digitalhub/entities/_processors/context/crud.py +5 -5
  11. digitalhub/entities/_processors/context/import_export.py +5 -5
  12. digitalhub/entities/_processors/context/material.py +2 -2
  13. digitalhub/entities/_processors/context/special_ops.py +13 -13
  14. digitalhub/entities/_processors/utils.py +2 -111
  15. digitalhub/entities/function/_base/entity.py +0 -3
  16. digitalhub/entities/project/_base/builder.py +0 -6
  17. digitalhub/entities/project/_base/entity.py +4 -12
  18. digitalhub/entities/project/_base/spec.py +4 -4
  19. digitalhub/entities/project/crud.py +9 -44
  20. digitalhub/entities/project/utils.py +7 -3
  21. digitalhub/entities/task/_base/models.py +3 -15
  22. digitalhub/entities/workflow/_base/entity.py +0 -5
  23. digitalhub/stores/client/{dhcore/api_builder.py → api_builder.py} +2 -3
  24. digitalhub/stores/client/builder.py +20 -32
  25. digitalhub/stores/client/{dhcore/client.py → client.py} +64 -23
  26. digitalhub/stores/client/{dhcore/configurator.py → configurator.py} +122 -176
  27. digitalhub/stores/client/{_base/enums.py → enums.py} +11 -0
  28. digitalhub/stores/client/{dhcore/http_handler.py → http_handler.py} +4 -5
  29. digitalhub/stores/client/{_base/key_builder.py → key_builder.py} +13 -13
  30. digitalhub/stores/client/{dhcore/params_builder.py → params_builder.py} +51 -12
  31. digitalhub/stores/client/{dhcore/response_processor.py → response_processor.py} +1 -1
  32. digitalhub/stores/client/{dhcore/utils.py → utils.py} +2 -7
  33. digitalhub/stores/{credentials → configurator}/api.py +5 -5
  34. digitalhub/stores/configurator/configurator.py +123 -0
  35. digitalhub/stores/{credentials → configurator}/enums.py +25 -10
  36. digitalhub/stores/configurator/handler.py +213 -0
  37. digitalhub/stores/{credentials → configurator}/ini_module.py +31 -0
  38. digitalhub/stores/data/_base/store.py +0 -4
  39. digitalhub/stores/data/api.py +2 -4
  40. digitalhub/stores/data/builder.py +5 -37
  41. digitalhub/stores/data/s3/configurator.py +30 -114
  42. digitalhub/stores/data/s3/store.py +9 -22
  43. digitalhub/stores/data/sql/configurator.py +49 -71
  44. digitalhub/stores/data/sql/store.py +20 -55
  45. {digitalhub-0.14.0b6.dist-info → digitalhub-0.14.1.dist-info}/METADATA +1 -1
  46. {digitalhub-0.14.0b6.dist-info → digitalhub-0.14.1.dist-info}/RECORD +52 -67
  47. digitalhub/stores/client/_base/api_builder.py +0 -34
  48. digitalhub/stores/client/_base/client.py +0 -243
  49. digitalhub/stores/client/_base/params_builder.py +0 -82
  50. digitalhub/stores/client/api.py +0 -32
  51. digitalhub/stores/client/dhcore/__init__.py +0 -3
  52. digitalhub/stores/client/dhcore/enums.py +0 -18
  53. digitalhub/stores/client/dhcore/key_builder.py +0 -62
  54. digitalhub/stores/client/local/__init__.py +0 -3
  55. digitalhub/stores/client/local/api_builder.py +0 -116
  56. digitalhub/stores/client/local/client.py +0 -605
  57. digitalhub/stores/client/local/enums.py +0 -15
  58. digitalhub/stores/client/local/key_builder.py +0 -62
  59. digitalhub/stores/client/local/params_builder.py +0 -97
  60. digitalhub/stores/credentials/__init__.py +0 -3
  61. digitalhub/stores/credentials/configurator.py +0 -185
  62. digitalhub/stores/credentials/handler.py +0 -164
  63. digitalhub/stores/credentials/store.py +0 -77
  64. /digitalhub/stores/client/{dhcore/error_parser.py → error_parser.py} +0 -0
  65. /digitalhub/stores/client/{dhcore/header_manager.py → header_manager.py} +0 -0
  66. /digitalhub/stores/{client/_base → configurator}/__init__.py +0 -0
  67. {digitalhub-0.14.0b6.dist-info → digitalhub-0.14.1.dist-info}/WHEEL +0 -0
  68. {digitalhub-0.14.0b6.dist-info → digitalhub-0.14.1.dist-info}/licenses/AUTHORS +0 -0
  69. {digitalhub-0.14.0b6.dist-info → digitalhub-0.14.1.dist-info}/licenses/LICENSE +0 -0
digitalhub/__init__.py CHANGED
@@ -95,8 +95,8 @@ from digitalhub.entities.workflow.crud import (
95
95
  new_workflow,
96
96
  update_workflow,
97
97
  )
98
- from digitalhub.stores.client.dhcore.utils import refresh_token
99
- from digitalhub.stores.credentials.api import get_current_profile, set_current_profile
98
+ from digitalhub.stores.client.utils import refresh_token
99
+ from digitalhub.stores.configurator.api import get_current_profile, set_current_profile
100
100
  from digitalhub.utils.store_utils import get_s3_client, get_sql_engine
101
101
 
102
102
  try:
digitalhub/context/api.py CHANGED
@@ -7,6 +7,11 @@ from __future__ import annotations
7
7
  import typing
8
8
 
9
9
  from digitalhub.context.builder import context_builder
10
+ from digitalhub.entities._commons.enums import EntityTypes
11
+ from digitalhub.factory.entity import entity_factory
12
+ from digitalhub.stores.client.builder import get_client
13
+ from digitalhub.stores.client.enums import ApiCategories, BackendOperations
14
+ from digitalhub.utils.exceptions import ContextError, EntityNotExistsError
10
15
 
11
16
  if typing.TYPE_CHECKING:
12
17
  from digitalhub.context.context import Context
@@ -49,7 +54,43 @@ def get_context(project: str) -> Context:
49
54
  Context
50
55
  The context for the given project name.
51
56
  """
52
- return context_builder.get(project)
57
+ try:
58
+ return context_builder.get(project)
59
+ except ContextError:
60
+ try:
61
+ return get_context_from_remote(project)
62
+ except EntityNotExistsError as e:
63
+ raise ContextError(f"Context '{project}' not found remotely nor locally.") from e
64
+
65
+
66
+ def get_context_from_remote(project: str) -> Context:
67
+ """
68
+ Fetch project context from remote backend and create local context.
69
+
70
+
71
+ Parameters
72
+ ----------
73
+ project : str
74
+ The name of the project to fetch from remote.
75
+
76
+ Returns
77
+ -------
78
+ Context
79
+ The context instance created from the remote project data.
80
+ """
81
+ try:
82
+ client = get_client()
83
+ api = client.build_api(
84
+ ApiCategories.BASE.value,
85
+ BackendOperations.READ.value,
86
+ entity_type=EntityTypes.PROJECT.value,
87
+ entity_name=project,
88
+ )
89
+ obj = client.read_object(api)
90
+ entity_factory.build_entity_from_dict(obj)
91
+ return context_builder.get(project)
92
+ except EntityNotExistsError:
93
+ raise ContextError(f"Project '{project}' not found.")
53
94
 
54
95
 
55
96
  def delete_context(project: str) -> None:
@@ -10,12 +10,12 @@ from pathlib import Path
10
10
 
11
11
  from digitalhub.entities._commons.enums import EntityTypes
12
12
  from digitalhub.runtimes.enums import RuntimeEnvVar
13
- from digitalhub.stores.client._base.enums import ApiCategories, BackendOperations
13
+ from digitalhub.stores.client.enums import ApiCategories, BackendOperations
14
14
  from digitalhub.utils.exceptions import BackendError
15
15
 
16
16
  if typing.TYPE_CHECKING:
17
17
  from digitalhub.entities.project._base.entity import Project
18
- from digitalhub.stores.client._base.client import Client
18
+ from digitalhub.stores.client.client import Client
19
19
 
20
20
 
21
21
  class Context:
@@ -33,8 +33,6 @@ class Context:
33
33
  The client instance (local or remote) associated with the project.
34
34
  config : dict
35
35
  Project configuration profile.
36
- local : bool
37
- Whether the client is local or remote.
38
36
  root : Path
39
37
  The local context project path.
40
38
  is_running : bool
@@ -47,8 +45,7 @@ class Context:
47
45
  self.name: str = project.name
48
46
  self.client: Client = project._client
49
47
  self.config: dict = project.spec.config
50
- self.local: bool = project._client.is_local()
51
- self.root: Path = Path(project.spec.context)
48
+ self.root: Path = Path(project.spec.source)
52
49
  self.root.mkdir(parents=True, exist_ok=True)
53
50
 
54
51
  self.is_running: bool = False
@@ -9,7 +9,6 @@ import typing
9
9
  from digitalhub.context.api import get_context
10
10
  from digitalhub.entities._base.entity.entity import Entity
11
11
  from digitalhub.entities._processors.processors import context_processor
12
- from digitalhub.utils.generic_utils import get_timestamp
13
12
  from digitalhub.utils.io_utils import write_yaml
14
13
 
15
14
  if typing.TYPE_CHECKING:
@@ -81,8 +80,6 @@ class ContextEntity(Entity):
81
80
  ContextEntity
82
81
  Entity updated.
83
82
  """
84
- if self._context().local:
85
- self.metadata.updated = self.metadata.updated = get_timestamp()
86
83
  new_obj = context_processor.update_context_entity(self.project, self.ENTITY_TYPE, self.id, self.to_dict())
87
84
  self._update_attributes(new_obj)
88
85
  return self
@@ -56,7 +56,7 @@ class MaterialEntity(VersionedEntity):
56
56
  """
57
57
  # Evaluate files info list length
58
58
  files = None
59
- if self.status.files is not None and len(self.status.files) > 5 and not self._context().local:
59
+ if self.status.files is not None and len(self.status.files) > 5:
60
60
  files = self.status.files
61
61
  self.status.files = []
62
62
 
@@ -222,7 +222,7 @@ class MaterialEntity(VersionedEntity):
222
222
  """
223
223
  Get files info from backend.
224
224
  """
225
- if not self._context().local and not self.status.files:
225
+ if not self.status.files:
226
226
  files = context_processor.read_files_info(
227
227
  project=self.project,
228
228
  entity_type=self.ENTITY_TYPE,
@@ -8,12 +8,12 @@ import typing
8
8
 
9
9
  from digitalhub.context.api import delete_context
10
10
  from digitalhub.factory.entity import entity_factory
11
- from digitalhub.stores.client._base.enums import ApiCategories, BackendOperations
12
- from digitalhub.stores.client.api import get_client
11
+ from digitalhub.stores.client.builder import get_client
12
+ from digitalhub.stores.client.enums import ApiCategories, BackendOperations
13
13
 
14
14
  if typing.TYPE_CHECKING:
15
15
  from digitalhub.entities.project._base.entity import Project
16
- from digitalhub.stores.client._base.client import Client
16
+ from digitalhub.stores.client.client import Client
17
17
 
18
18
 
19
19
  class BaseEntityCRUDProcessor:
@@ -69,8 +69,7 @@ class BaseEntityCRUDProcessor:
69
69
  Create a project entity in the backend.
70
70
 
71
71
  Creates a new project either from an existing entity object or
72
- by building one from the provided parameters. Handles both
73
- local and remote backend creation.
72
+ by building one from the provided parameters.
74
73
 
75
74
  Parameters
76
75
  ----------
@@ -78,8 +77,7 @@ class BaseEntityCRUDProcessor:
78
77
  An existing project entity object to create. If None,
79
78
  a new entity will be built from kwargs.
80
79
  **kwargs : dict
81
- Parameters for entity creation, including 'local' flag
82
- and entity-specific parameters.
80
+ Parameters for entity creation.
83
81
 
84
82
  Returns
85
83
  -------
@@ -90,10 +88,9 @@ class BaseEntityCRUDProcessor:
90
88
  client = _entity._client
91
89
  obj = _entity
92
90
  else:
93
- client = get_client(kwargs.get("local"))
91
+ client = get_client()
94
92
  obj = entity_factory.build_entity_from_params(**kwargs)
95
93
  ent = self._create_base_entity(client, obj.ENTITY_TYPE, obj.to_dict())
96
- ent["local"] = client.is_local()
97
94
  return entity_factory.build_entity_from_dict(ent)
98
95
 
99
96
  def _read_base_entity(
@@ -160,9 +157,8 @@ class BaseEntityCRUDProcessor:
160
157
  Project
161
158
  The project entity object populated with backend data.
162
159
  """
163
- client = get_client(kwargs.pop("local", False))
160
+ client = get_client()
164
161
  obj = self._read_base_entity(client, entity_type, entity_name, **kwargs)
165
- obj["local"] = client.is_local()
166
162
  return entity_factory.build_entity_from_dict(obj)
167
163
 
168
164
  def _list_base_entities(
@@ -215,19 +211,17 @@ class BaseEntityCRUDProcessor:
215
211
  entity_type : str
216
212
  The type of entities to list (typically 'project').
217
213
  **kwargs : dict
218
- Additional parameters including 'local' flag and
219
- API call parameters for filtering or pagination.
214
+ Additional parameters.
220
215
 
221
216
  Returns
222
217
  -------
223
218
  list[Project]
224
219
  List of project entity objects.
225
220
  """
226
- client = get_client(kwargs.pop("local", False))
221
+ client = get_client()
227
222
  objs = self._list_base_entities(client, entity_type, **kwargs)
228
223
  entities = []
229
224
  for obj in objs:
230
- obj["local"] = client.is_local()
231
225
  ent = entity_factory.build_entity_from_dict(obj)
232
226
  entities.append(ent)
233
227
  return entities
@@ -294,17 +288,15 @@ class BaseEntityCRUDProcessor:
294
288
  entity_dict : dict
295
289
  The updated project data dictionary.
296
290
  **kwargs : dict
297
- Additional parameters including 'local' flag and
298
- API call parameters.
291
+ Additional parameters.
299
292
 
300
293
  Returns
301
294
  -------
302
295
  Project
303
296
  The updated project entity object.
304
297
  """
305
- client = get_client(kwargs.pop("local", False))
298
+ client = get_client()
306
299
  obj = self._update_base_entity(client, entity_type, entity_name, entity_dict, **kwargs)
307
- obj["local"] = client.is_local()
308
300
  return entity_factory.build_entity_from_dict(obj)
309
301
 
310
302
  def _delete_base_entity(
@@ -360,7 +352,7 @@ class BaseEntityCRUDProcessor:
360
352
  Delete a project entity from the backend.
361
353
 
362
354
  Deletes a project from the backend and optionally cleans up
363
- the associated context. Handles both local and remote backends.
355
+ the associated context.
364
356
 
365
357
  Parameters
366
358
  ----------
@@ -371,8 +363,7 @@ class BaseEntityCRUDProcessor:
371
363
  entity_name : str
372
364
  The name identifier of the project to delete.
373
365
  **kwargs : dict
374
- Additional parameters including 'local' flag, 'clean_context'
375
- flag (default True), and API call parameters.
366
+ Additional parameters including 'clean_context'.
376
367
 
377
368
  Returns
378
369
  -------
@@ -381,7 +372,7 @@ class BaseEntityCRUDProcessor:
381
372
  """
382
373
  if kwargs.pop("clean_context", True):
383
374
  delete_context(entity_name)
384
- client = get_client(kwargs.pop("local", False))
375
+ client = get_client()
385
376
  return self._delete_base_entity(
386
377
  client,
387
378
  entity_type,
@@ -8,7 +8,6 @@ import typing
8
8
  from warnings import warn
9
9
 
10
10
  from digitalhub.factory.entity import entity_factory
11
- from digitalhub.stores.client.api import get_client
12
11
  from digitalhub.utils.exceptions import EntityAlreadyExistsError, EntityError, EntityNotExistsError
13
12
  from digitalhub.utils.io_utils import read_yaml
14
13
 
@@ -57,10 +56,8 @@ class BaseEntityImportExportProcessor:
57
56
  EntityError
58
57
  If the project already exists in the backend.
59
58
  """
60
- client = get_client(kwargs.pop("local", False))
61
59
  obj: dict = read_yaml(file)
62
60
  obj["status"] = {}
63
- obj["local"] = client.is_local()
64
61
  ent: Project = entity_factory.build_entity_from_dict(obj)
65
62
  reset_id = kwargs.pop("reset_id", False)
66
63
 
@@ -107,9 +104,7 @@ class BaseEntityImportExportProcessor:
107
104
  Project
108
105
  The loaded and updated project entity.
109
106
  """
110
- client = get_client(kwargs.pop("local", False))
111
107
  obj: dict = read_yaml(file)
112
- obj["local"] = client.is_local()
113
108
  ent: Project = entity_factory.build_entity_from_dict(obj)
114
109
 
115
110
  try:
@@ -247,7 +247,6 @@ class BaseEntityOperationsProcessor:
247
247
  def build_project_key(
248
248
  self,
249
249
  entity_id: str,
250
- **kwargs,
251
250
  ) -> str:
252
251
  """
253
252
  Build a storage key for a project entity.
@@ -259,15 +258,13 @@ class BaseEntityOperationsProcessor:
259
258
  ----------
260
259
  entity_id : str
261
260
  The unique identifier of the project entity.
262
- **kwargs : dict
263
- Additional parameters including 'local' flag.
264
261
 
265
262
  Returns
266
263
  -------
267
264
  str
268
265
  The constructed project entity key string.
269
266
  """
270
- return self.special_ops_processor.build_project_key(entity_id, **kwargs)
267
+ return self.special_ops_processor.build_project_key(entity_id)
271
268
 
272
269
  def share_project_entity(
273
270
  self,
@@ -6,8 +6,8 @@ from __future__ import annotations
6
6
 
7
7
  import typing
8
8
 
9
- from digitalhub.stores.client._base.enums import ApiCategories, BackendOperations
10
- from digitalhub.stores.client.api import get_client
9
+ from digitalhub.stores.client.builder import get_client
10
+ from digitalhub.stores.client.enums import ApiCategories, BackendOperations
11
11
 
12
12
  if typing.TYPE_CHECKING:
13
13
  pass
@@ -24,7 +24,6 @@ class BaseEntitySpecialOpsProcessor:
24
24
  def build_project_key(
25
25
  self,
26
26
  entity_id: str,
27
- **kwargs,
28
27
  ) -> str:
29
28
  """
30
29
  Build a storage key for a project entity.
@@ -36,16 +35,13 @@ class BaseEntitySpecialOpsProcessor:
36
35
  ----------
37
36
  entity_id : str
38
37
  The unique identifier of the project entity.
39
- **kwargs : dict
40
- Additional parameters including 'local' flag.
41
38
 
42
39
  Returns
43
40
  -------
44
41
  str
45
42
  The constructed project entity key string.
46
43
  """
47
- client = get_client(kwargs.pop("local", False))
48
- return client.build_key(ApiCategories.BASE.value, entity_id)
44
+ return get_client().build_key(ApiCategories.BASE.value, entity_id)
49
45
 
50
46
  def share_project_entity(
51
47
  self,
@@ -77,7 +73,7 @@ class BaseEntitySpecialOpsProcessor:
77
73
  ValueError
78
74
  If trying to unshare from a user who doesn't have access.
79
75
  """
80
- client = get_client(kwargs.pop("local", False))
76
+ client = get_client()
81
77
  api = client.build_api(
82
78
  ApiCategories.BASE.value,
83
79
  BackendOperations.SHARE.value,
@@ -8,12 +8,12 @@ import typing
8
8
 
9
9
  from digitalhub.entities._commons.utils import is_valid_key, sanitize_unversioned_key
10
10
  from digitalhub.entities._processors.utils import (
11
+ get_context,
11
12
  get_context_from_identifier,
12
- get_context_from_project,
13
13
  parse_identifier,
14
14
  )
15
15
  from digitalhub.factory.entity import entity_factory
16
- from digitalhub.stores.client._base.enums import ApiCategories, BackendOperations
16
+ from digitalhub.stores.client.enums import ApiCategories, BackendOperations
17
17
 
18
18
  if typing.TYPE_CHECKING:
19
19
  from digitalhub.context.context import Context
@@ -93,7 +93,7 @@ class ContextEntityCRUDProcessor:
93
93
  context = _entity._context()
94
94
  obj = _entity
95
95
  else:
96
- context = get_context_from_project(kwargs["project"])
96
+ context = get_context(kwargs["project"])
97
97
  obj: ContextEntity = entity_factory.build_entity_from_params(**kwargs)
98
98
  new_obj = self._create_context_entity(context, obj.ENTITY_TYPE, obj.to_dict())
99
99
  return entity_factory.build_entity_from_dict(new_obj)
@@ -423,7 +423,7 @@ class ContextEntityCRUDProcessor:
423
423
  list[ContextEntity]
424
424
  List of context entity objects (latest versions only).
425
425
  """
426
- context = get_context_from_project(project)
426
+ context = get_context(project)
427
427
  objs = self._list_context_entities(context, entity_type, **kwargs)
428
428
  objects = []
429
429
  for o in objs:
@@ -507,7 +507,7 @@ class ContextEntityCRUDProcessor:
507
507
  ContextEntity
508
508
  The updated context entity object.
509
509
  """
510
- context = get_context_from_project(project)
510
+ context = get_context(project)
511
511
  obj = self._update_context_entity(
512
512
  context,
513
513
  entity_type,
@@ -7,7 +7,7 @@ from __future__ import annotations
7
7
  import typing
8
8
 
9
9
  from digitalhub.entities._constructors.uuid import build_uuid
10
- from digitalhub.entities._processors.utils import get_context_from_identifier, get_context_from_project
10
+ from digitalhub.entities._processors.utils import get_context, get_context_from_identifier
11
11
  from digitalhub.factory.entity import entity_factory
12
12
  from digitalhub.utils.exceptions import EntityAlreadyExistsError, EntityError, EntityNotExistsError
13
13
  from digitalhub.utils.io_utils import read_yaml
@@ -75,7 +75,7 @@ class ContextEntityImportExportProcessor:
75
75
  if context is None:
76
76
  context = dict_obj["project"]
77
77
 
78
- ctx = get_context_from_project(context)
78
+ ctx = get_context(context)
79
79
  obj = entity_factory.build_entity_from_dict(dict_obj)
80
80
  if reset_id:
81
81
  new_id = build_uuid()
@@ -147,7 +147,7 @@ class ContextEntityImportExportProcessor:
147
147
  if context is None:
148
148
  context = exec_dict["project"]
149
149
 
150
- ctx = get_context_from_project(context)
150
+ ctx = get_context(context)
151
151
  obj: ExecutableEntity = entity_factory.build_entity_from_dict(exec_dict)
152
152
 
153
153
  if reset_id:
@@ -190,7 +190,7 @@ class ContextEntityImportExportProcessor:
190
190
  The loaded and updated context entity.
191
191
  """
192
192
  dict_obj: dict = read_yaml(file)
193
- context = get_context_from_project(dict_obj["project"])
193
+ context = get_context(dict_obj["project"])
194
194
  obj: ContextEntity = entity_factory.build_entity_from_dict(dict_obj)
195
195
  try:
196
196
  crud_processor._update_context_entity(context, obj.ENTITY_TYPE, obj.id, obj.to_dict())
@@ -231,7 +231,7 @@ class ContextEntityImportExportProcessor:
231
231
  exec_dict = dict_obj
232
232
  tsk_dicts = []
233
233
 
234
- context = get_context_from_project(exec_dict["project"])
234
+ context = get_context(exec_dict["project"])
235
235
  obj: ExecutableEntity = entity_factory.build_entity_from_dict(exec_dict)
236
236
 
237
237
  try:
@@ -7,7 +7,7 @@ from __future__ import annotations
7
7
  import typing
8
8
 
9
9
  from digitalhub.entities._commons.enums import Relationship, State
10
- from digitalhub.entities._processors.utils import get_context_from_project
10
+ from digitalhub.entities._processors.utils import get_context
11
11
  from digitalhub.factory.entity import entity_factory
12
12
  from digitalhub.utils.exceptions import EntityError
13
13
  from digitalhub.utils.types import SourcesOrListOfSources
@@ -59,7 +59,7 @@ class ContextEntityMaterialProcessor:
59
59
  If file upload fails during the process.
60
60
  """
61
61
  source: SourcesOrListOfSources = kwargs.pop("source")
62
- context = get_context_from_project(kwargs["project"])
62
+ context = get_context(kwargs["project"])
63
63
  obj = entity_factory.build_entity_from_params(**kwargs)
64
64
  if context.is_running:
65
65
  obj.add_relationship(Relationship.PRODUCEDBY.value, context.get_run_ctx())
@@ -7,8 +7,8 @@ from __future__ import annotations
7
7
  import typing
8
8
  from typing import Any
9
9
 
10
- from digitalhub.entities._processors.utils import get_context_from_project
11
- from digitalhub.stores.client._base.enums import ApiCategories, BackendOperations
10
+ from digitalhub.entities._processors.utils import get_context
11
+ from digitalhub.stores.client.enums import ApiCategories, BackendOperations
12
12
 
13
13
  if typing.TYPE_CHECKING:
14
14
  from digitalhub.entities._base.context.entity import ContextEntity
@@ -55,7 +55,7 @@ class ContextEntitySpecialOpsProcessor:
55
55
  str
56
56
  The constructed context entity key string.
57
57
  """
58
- context = get_context_from_project(project)
58
+ context = get_context(project)
59
59
  return context.client.build_key(
60
60
  ApiCategories.CONTEXT.value,
61
61
  project=context.name,
@@ -91,7 +91,7 @@ class ContextEntitySpecialOpsProcessor:
91
91
  dict
92
92
  Secret data retrieved from the backend.
93
93
  """
94
- context = get_context_from_project(project)
94
+ context = get_context(project)
95
95
  api = context.client.build_api(
96
96
  ApiCategories.CONTEXT.value,
97
97
  BackendOperations.DATA.value,
@@ -124,7 +124,7 @@ class ContextEntitySpecialOpsProcessor:
124
124
  **kwargs : dict
125
125
  Additional parameters to pass to the API call.
126
126
  """
127
- context = get_context_from_project(project)
127
+ context = get_context(project)
128
128
  api = context.client.build_api(
129
129
  ApiCategories.CONTEXT.value,
130
130
  BackendOperations.DATA.value,
@@ -162,7 +162,7 @@ class ContextEntitySpecialOpsProcessor:
162
162
  dict
163
163
  Log data retrieved from the backend.
164
164
  """
165
- context = get_context_from_project(project)
165
+ context = get_context(project)
166
166
  api = context.client.build_api(
167
167
  ApiCategories.CONTEXT.value,
168
168
  BackendOperations.LOGS.value,
@@ -196,7 +196,7 @@ class ContextEntitySpecialOpsProcessor:
196
196
  **kwargs : dict
197
197
  Additional parameters to pass to the API call.
198
198
  """
199
- context = get_context_from_project(project)
199
+ context = get_context(project)
200
200
  api = context.client.build_api(
201
201
  ApiCategories.CONTEXT.value,
202
202
  BackendOperations.STOP.value,
@@ -230,7 +230,7 @@ class ContextEntitySpecialOpsProcessor:
230
230
  **kwargs : dict
231
231
  Additional parameters to pass to the API call.
232
232
  """
233
- context = get_context_from_project(project)
233
+ context = get_context(project)
234
234
  api = context.client.build_api(
235
235
  ApiCategories.CONTEXT.value,
236
236
  BackendOperations.RESUME.value,
@@ -269,7 +269,7 @@ class ContextEntitySpecialOpsProcessor:
269
269
  list[dict]
270
270
  List of file information dictionaries from the backend.
271
271
  """
272
- context = get_context_from_project(project)
272
+ context = get_context(project)
273
273
  api = context.client.build_api(
274
274
  ApiCategories.CONTEXT.value,
275
275
  BackendOperations.FILES.value,
@@ -303,7 +303,7 @@ class ContextEntitySpecialOpsProcessor:
303
303
  **kwargs : dict
304
304
  Parameters to pass to the API call.
305
305
  """
306
- context = get_context_from_project(project)
306
+ context = get_context(project)
307
307
  api = context.client.build_api(
308
308
  ApiCategories.CONTEXT.value,
309
309
  BackendOperations.FILES.value,
@@ -347,7 +347,7 @@ class ContextEntitySpecialOpsProcessor:
347
347
  dict
348
348
  Dictionary containing metric data from the backend.
349
349
  """
350
- context = get_context_from_project(project)
350
+ context = get_context(project)
351
351
  api = context.client.build_api(
352
352
  ApiCategories.CONTEXT.value,
353
353
  BackendOperations.METRICS.value,
@@ -390,7 +390,7 @@ class ContextEntitySpecialOpsProcessor:
390
390
  **kwargs : dict
391
391
  Additional parameters to pass to the API call.
392
392
  """
393
- context = get_context_from_project(project)
393
+ context = get_context(project)
394
394
  api = context.client.build_api(
395
395
  ApiCategories.CONTEXT.value,
396
396
  BackendOperations.METRICS.value,
@@ -453,7 +453,7 @@ class ContextEntitySpecialOpsProcessor:
453
453
  list[ContextEntity]
454
454
  List of matching entity instances from the search.
455
455
  """
456
- context = get_context_from_project(project)
456
+ context = get_context(project)
457
457
  kwargs = context.client.build_parameters(
458
458
  ApiCategories.CONTEXT.value,
459
459
  BackendOperations.SEARCH.value,