Skip to main content

Redispatch

Covalent Cloud’s redispatch utility (cc.redispatch) is an efficient way to re-run existing workflows using new inputs, without the original source code or Lattice object. This greatly streamlines iterative workloads and helps you make the most of Covalent Cloud’s advanced compute resources.

Why use cc.redispatch?

  • Eliminate redundancy: Avoid the need for repeated asset uploads.
  • Efficiency: Relax local requirements for memory, compute, and software dependencies—useful, e.g., for automated lambda functions or CI/CD pipelines.
  • Convenience: Perfect for scenarios like machine learning workflows, where the same workflow is frequency re-run with different inputs.

How it Works

  1. Save your API key.
import covalent_cloud as cc

# cc.save_api_key("your-api-key")
  1. Re-dispatch with new inputs: Provide the cc.redispatch function a dispatch ID from any workflow in your account, along with the new arguments.
# A dispatch ID from any workflow in your account.
dispatch_id = "8ba8830e-3f6b-473e-add9-1e7be3dab19c"

# Re-dispatch the original workflow with new inputs.
new_args = (5, 6)
new_kwargs = {"option2": True}
redispatch_id = cc.redispatch(dispatch_id)(*new_args, option1="test", **new_kwargs)
  1. Query the result as usual: Simply pass the (re)dispatch ID from the previous step.
# Query result as usual.
result = cc.get_result(redispatch_id, wait=True)