Dump the object to a JSON file.
(self)
| 42 | return self.__dict__ |
| 43 | |
| 44 | def dump(self): |
| 45 | """Dump the object to a JSON file.""" |
| 46 | begin = time.time() |
| 47 | try: |
| 48 | with open(self.meta_file_name, "w") as fout: |
| 49 | json.dump(self.__dict__, fout) |
| 50 | except Exception as e: |
| 51 | return f"redundant_expert: dump expert workload failed, {e}" |
| 52 | cost_time = int((time.time() - begin) * 1000 * 1000) |
| 53 | return f"redundant_expert: dump expert workload result in {cost_time} us" |
| 54 | |
| 55 | def load(self): |
| 56 | """Load the object from a JSON file.""" |
no outgoing calls