MCPcopy Create free account
hub / github.com/dagger/dagger / get_result

Method get_result

sdk/python/src/dagger/mod/_module.py:348–378  ·  view source on GitHub ↗

Get function result as an unstructured Python primitive.

(
        self,
        parent_name: str,
        parent_state: Mapping[str, Any],
        name: str,
        raw_inputs: Mapping[str, Any],
    )

Source from the content-addressed store, hash-verified

346 return result
347
348 async def get_result(
349 self,
350 parent_name: str,
351 parent_state: Mapping[str, Any],
352 name: str,
353 raw_inputs: Mapping[str, Any],
354 ) -> Any:
355 """Get function result as an unstructured Python primitive."""
356 result, fn = await self.get_structured_result(
357 parent_name,
358 parent_state,
359 name,
360 raw_inputs,
361 )
362 if fn.return_type is not None:
363 try:
364 return await self.unstructure(result, fn.return_type)
365 except Exception as e:
366 log_exception_only(e, "Invalid result from function")
367 msg = transform_error(
368 e,
369 origin=getattr(fn, "wrapped", None),
370 typ=fn.return_type,
371 )
372 msg += (
373 "\n"
374 "Please check if the returned value at runtime matches "
375 "the function's declared return type."
376 )
377 raise InvalidResultError(msg) from e
378 return None
379
380 async def get_structured_result(
381 self,

Calls 5

get_structured_resultMethod · 0.95
unstructureMethod · 0.95
log_exception_onlyFunction · 0.90
transform_errorFunction · 0.90
InvalidResultErrorClass · 0.90