Exemplo n.º 1
0
def deserialize_workload_registry_entry(data):
    """
    Deserialize a workload registry entry.
    This should be used along with :code:`serialize_workload_registry_entry`

    Parameters
    ----------
    data: Tuple
        The return value of :code:`serialize_workload_registry_entry`
    """
    global WORKLOAD_FUNC_REGISTRY

    name, value = data
    if name not in WORKLOAD_FUNC_REGISTRY:
        # pylint: disable=assignment-from-no-return
        WORKLOAD_FUNC_REGISTRY[name] = LoadJSON(value)
Exemplo n.º 2
0
 def __setstate__(self, state):
     # Since we always use tensors to recover the ComputeDAG, we do not support
     # (de)serialization of the ComputeDAG constructed by a schedule.
     self.__init_handle_by_constructor__(_ffi_api.ComputeDAG,
                                         LoadJSON(state["tensors"]), None)
Exemplo n.º 3
0
 def __setstate__(self, state):
     self.compute = LoadJSON(state["compute"])  # pylint: disable=assignment-from-no-return
     self.sche = LoadJSON(state["sche"])  # pylint: disable=assignment-from-no-return
     self.__init_handle_by_constructor__(_ffi_api.ComputeDAG, self.compute,
                                         self.sche)