Skip to main content

Get Result

cc.get_result

#

Gets the result of a Covalent workflow that has been dispatched to the cloud.

This function retrieves the result of a dispatched Covalent workflow that has been executed on the cloud. The function takes the dispatch ID of the workflow and retrieves the results from the cloud. The result is returned as a Result object that contains the status of the workflow, the final result of the lattice, and any error messages that may have occurred during execution.

Parameters

dispatch_id(str) – The dispatch id assigned to the workflow.

wait(bool) – Controls how long the function waits for the server to return a result. if False, the function will not wait and will return the current status of the workflow. if True, the function will wait for the result to finish and keep retrying until the result is available.

status_only(bool) – If True, only retrieves the status of the workflow and not the full result.

settings – The Covalent settings to use for the request.

Return Type

Result

Returns

A Result object that contains the status of the workflow, the final result of the lattice, and any error messages that may have occurred during execution.

Examples

# define a simple lattice 
import covalent_cloud as cc
import covalent as ct

@ct.lattice
def my_lattice(a: int, b: int ) -> int:
return a + b

# dispatch the lattice and get the assigned dispatch ID
dispatch_id = cc.dispatch(my_lattice)(2, 3)

# get the result of the dispatched lattice
result = cc.get_result(dispatch_id, wait=True)

# print the final result of the lattice
print(result.result)