예제 #1
0
def serialize_result(dmlresult_job):
    """
    Serializes a DML Result object into a dictionary.

    Args:
        dmlresult_job (DMLResult): result object.

    Returns:
        dict: The serialized version of the DML Result.
    """
    return {
        'status': dmlresult_job.status,
        'job': serialize_job(dmlresult_job.job),
        'results': dmlresult_job.results,
        'error_message': dmlresult_job.error_message,
    }
예제 #2
0
 def _communicate(self, job):
     """
     Communicates a message to the blockchain using the Runner's
     IPFS client, puts the tx_receipt in DMLResult.
     """
     tx_receipt = setter(
         client=self._client,
         key=job.key,
         port=self._port,
         value=serialize_job(job),
     )
     results = DMLResult(
         status='successful',
         job=job,
         results={
             'receipt': tx_receipt,
         },
         error_message="",
     )
     return results
예제 #3
0
def make_serialized_job_with_uuid(uuid):
    initialize_job = make_initialize_job(make_model_json(), uuid=uuid)
    serialized_job = serialize_job(initialize_job)
    return serialized_job
예제 #4
0
def make_serialized_job(raw_filepath):
    initialize_job = make_initialize_job(make_model_json(),
                                         raw_filepath=raw_filepath)
    serialized_job = serialize_job(initialize_job)
    return serialized_job