digitalhub 0.8.0b13__py3-none-any.whl → 0.8.0b14__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.

@@ -192,6 +192,7 @@ class Project(Entity):
192
192
  filename = f"{self.kind}_{self.name}.yml"
193
193
  pth = Path(self.spec.context) / filename
194
194
  pth.parent.mkdir(parents=True, exist_ok=True)
195
+
195
196
  obj = self._export_not_embedded(obj)
196
197
  write_yaml(pth, obj)
197
198
  return str(pth)
@@ -226,11 +227,13 @@ class Project(Entity):
226
227
  """
227
228
  # Cycle over entity types
228
229
  for entity_type in self._get_entity_types():
230
+
229
231
  # Entity types are stored as a list of entities
230
232
  for idx, entity in enumerate(obj.get("spec", {}).get(entity_type, [])):
233
+
231
234
  # Export entity if not embedded is in metadata, else do nothing
232
- embedded = entity["metadata"].get("embedded", False)
233
- if not embedded:
235
+ if not self._is_embedded(entity):
236
+
234
237
  # Get entity object from backend
235
238
  obj_dict: dict = read_entity_api_ctx(entity["key"])
236
239
 
@@ -261,28 +264,34 @@ class Project(Entity):
261
264
 
262
265
  # Cycle over entity types
263
266
  for entity_type in entity_types:
267
+
264
268
  # Entity types are stored as a list of entities
265
269
  for entity in obj.get("spec", {}).get(entity_type, []):
270
+
266
271
  embedded = self._is_embedded(entity)
267
272
  ref = entity["metadata"].get("ref")
268
273
 
269
- # Import entity if not embedded
274
+ # Import entity if not embedded and there is a ref
270
275
  if not embedded and ref is not None:
276
+
271
277
  # Import entity from local ref
272
278
  if map_uri_scheme(ref) == "local":
273
279
  try:
274
280
  # Artifacts, Dataitems and Models
275
281
  if entity_type in entity_types[:3]:
276
282
  import_context_entity(ref)
283
+
277
284
  # Functions and Workflows
278
285
  elif entity_type in entity_types[3:]:
279
286
  import_executable_entity(ref)
287
+
280
288
  except FileNotFoundError:
281
289
  msg = f"File not found: {ref}."
282
290
  raise EntityError(msg)
283
291
 
284
292
  # If entity is embedded, create it and try to save
285
293
  elif embedded:
294
+
286
295
  # It's possible that embedded field in metadata is not shown
287
296
  if entity["metadata"].get("embedded") is None:
288
297
  entity["metadata"]["embedded"] = True
@@ -328,7 +337,7 @@ class Project(Entity):
328
337
  f"{EntityTypes.WORKFLOW.value}s",
329
338
  ]
330
339
 
331
- def run(self, workflow: str | None = "main", **kwargs) -> Run:
340
+ def run(self, workflow: str | None = None, **kwargs) -> Run:
332
341
  """
333
342
  Run workflow project.
334
343
 
@@ -345,15 +354,18 @@ class Project(Entity):
345
354
  Run instance.
346
355
  """
347
356
  self.refresh()
357
+
358
+ workflow = workflow if workflow is not None else "main"
359
+
348
360
  for i in self.spec.workflows:
349
- if i["name"] == workflow or i["key"] == workflow:
350
- workflow = build_entity_from_dict(i)
361
+ if workflow in [i["name"], i["key"]]:
362
+ entity = self.get_workflow(i["key"])
351
363
  break
352
364
  else:
353
365
  msg = f"Workflow {workflow} not found."
354
366
  raise EntityError(msg)
355
367
 
356
- return workflow.run(**kwargs)
368
+ return entity.run(**kwargs)
357
369
 
358
370
  ##############################
359
371
  # Artifacts
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: digitalhub
3
- Version: 0.8.0b13
3
+ Version: 0.8.0b14
4
4
  Summary: Python SDK for Digitalhub
5
5
  Author-email: Fondazione Bruno Kessler <dslab@fbk.eu>, Matteo Martini <mmartini@fbk.eu>
6
6
  License: Apache License
@@ -139,7 +139,7 @@ digitalhub/entities/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
139
139
  digitalhub/entities/project/crud.py,sha256=P2IhKR2-YNmiNy0rpu0PG-LKD9nJGKsAahxvhsovmJA,8971
140
140
  digitalhub/entities/project/_base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
141
141
  digitalhub/entities/project/_base/builder.py,sha256=Fx_p8M75SkE_ssVBvKGu45wwqwqAZ5N6l6UZZj9LSNc,3612
142
- digitalhub/entities/project/_base/entity.py,sha256=nkPrYyn18xrglWT9WZICJ9SyLmmaupMJOL7ce4qeNKY,53532
142
+ digitalhub/entities/project/_base/entity.py,sha256=OZ4vH38ORWTdYS6yE4sxc0jdIpqgKszDJp_IrpeQJMQ,53559
143
143
  digitalhub/entities/project/_base/spec.py,sha256=zRJKFztK7z79LU4spxX7Rykv_1sK6kV9F9Qg95HBc6s,1346
144
144
  digitalhub/entities/project/_base/status.py,sha256=w1Hj_yFwr_5X7ZH7SmtZRto4qUdCWb010viFfvbqX48,168
145
145
  digitalhub/entities/run/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -224,8 +224,8 @@ test/local/CRUD/test_artifacts.py,sha256=Y3J_C7SDRSsQd2SGIZjPIOvyTL92B1sTFrUONG3
224
224
  test/local/CRUD/test_dataitems.py,sha256=LQqTzI59uwTGy4zoq8jL0yWVe2W9vXlatkgDU9aB6xg,2968
225
225
  test/local/CRUD/test_models.py,sha256=msosbZuRwIMbZtmi3ZaOva4TjQ4lrzkNu9AguIFhrSo,2929
226
226
  test/local/imports/test_imports.py,sha256=W-YugO0rpJwvtWp57MXaXfEmE-f5iWuCiLY-n0ZU4z8,1271
227
- digitalhub-0.8.0b13.dist-info/LICENSE.txt,sha256=_yVOtnbW7Ss28mp058UEEc1X4Rgj8-kQBP_kj8_Sc88,11585
228
- digitalhub-0.8.0b13.dist-info/METADATA,sha256=nGqQ6XVBy4IemsnJhaksOtDXpUrHOzcikQJW3TRkhoI,15289
229
- digitalhub-0.8.0b13.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
230
- digitalhub-0.8.0b13.dist-info/top_level.txt,sha256=ae9pDfCF27ZoaVAxuBKONMP0lm5P-N_I-e-no1WlvD8,16
231
- digitalhub-0.8.0b13.dist-info/RECORD,,
227
+ digitalhub-0.8.0b14.dist-info/LICENSE.txt,sha256=_yVOtnbW7Ss28mp058UEEc1X4Rgj8-kQBP_kj8_Sc88,11585
228
+ digitalhub-0.8.0b14.dist-info/METADATA,sha256=ZCqntN3pfX1zYGBO3TwzSli4gxGmsyqB8dnJZXXL8Jk,15289
229
+ digitalhub-0.8.0b14.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
230
+ digitalhub-0.8.0b14.dist-info/top_level.txt,sha256=ae9pDfCF27ZoaVAxuBKONMP0lm5P-N_I-e-no1WlvD8,16
231
+ digitalhub-0.8.0b14.dist-info/RECORD,,