Replies: 1 comment 7 replies
-
Hi @cjao & @FyzHsn - Will this affect what gets stored in the |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This post documents some recent (minor) changes to how electron and lattice metadata are represented in the transport graph.
Users can currently specify the following constraints on each electron:
executor
-- either a string description of an executor or an executor objectdeps
-- Instances of DepsBash and DepsPipcall_before
-- a list of DepsCall objectscall_after
-- a list of DepsCall objectsTechnically, the Electron decorator also accepts a
file_transfer
argument, but that is internally converted into a DepsCall.Previously, whenever object instances were passed as metadata, the transport graph stored the actual object instances. These were pickled together with the transport graph by the client and unpickled by the server.
As of the recent work to allow Covalent to process workflows without needing their dependencies, Covalent no longer unpickles any user-submitted data. As part of this change, the transport graph always holds a JSON representation of each metadata object, never object instances. The objects are rehydrated from their JSON representations at runtime whenever they are needed.
One consequence is that every new metadata class we support needs to know how to serialize itself to JSON; the existing metadata types have been taught to do this (the
from_dict()
andto_dict()
methods).Some elaboration is needed for executors. During workflow submission, the transport graph stores the essential data for reconstructing the executor in a field called
executor_data
. Theexecutor
field holds the short-string representation of the executor.For example, suppose the client specifies an executor instance like
@ct.electron(executor=dask_exec)
, wheredask_exec=DaskExecutor(scheduler_address)
is an instance ofDaskExecutor
. the corresponding graph node contains the following fields.executor="dask"
executor_data = {"type": "DaskExecutor", "short_name": "dask", attributes = {"address": [scheduler_address]}
This is what the SDK actually submits to the dispatcher, and you will notice that this is completely JSON-serializable. When the dispatcher dispatches the task, it creates a
DaskExecutor
instance from this JSON description (see here for the gory details).A similar treatment is applied to the Deps objects.
To better understand the current mechanism it may be helpful to construct a simple workflow, run
and then inspect
received_lattice
, which is what the server would receive from the client.Beta Was this translation helpful? Give feedback.
All reactions