(
self, data, name, groupId, gpuId, pretty=False, tmpPath="./tmp"
)
| 316 | ) |
| 317 | |
| 318 | def dumpDict( |
| 319 | self, data, name, groupId, gpuId, pretty=False, tmpPath="./tmp" |
| 320 | ): |
| 321 | self._lock.acquire() |
| 322 | if not os.path.exists(tmpPath): |
| 323 | os.makedirs(tmpPath) |
| 324 | self._lock.release() |
| 325 | if pretty: |
| 326 | jsObj = json.dumps(data, indent=4, separators=(',', ': ')) |
| 327 | else: |
| 328 | jsObj = json.dumps(data, separators=(',', ':')) |
| 329 | |
| 330 | fileName = self.getFileName(name, groupId, gpuId, tmpPath) |
| 331 | if os.path.isfile(fileName): |
| 332 | os.remove(fileName) |
| 333 | |
| 334 | fileObject = open(fileName, 'w') |
| 335 | fileObject.write(jsObj) |
| 336 | fileObject.close() |
| 337 | self._logger.info(f"dump [{fileName}] successfully!") |
| 338 | |
| 339 | |
| 340 | def getLogger(): |
no test coverage detected