(self, manifest_path, manifest_output_dir=".")
| 388 | |
| 389 | # Used by CI/CD automation for freezing model manifest files, and by the CLI for manual freezing |
| 390 | def freeze(self, manifest_path, manifest_output_dir="."): |
| 391 | if os.path.exists(manifest_path): |
| 392 | with open(manifest_path, 'r') as f: |
| 393 | manifest_file = json.load(f) |
| 394 | manifest_file['timestamp'] = str(time()) |
| 395 | required_files = manifest_file['required_files'] |
| 396 | optional_files = manifest_file['optional_files'] |
| 397 | for i in range(len(required_files)): |
| 398 | uri = required_files[i]['source_uri'] |
| 399 | local_file = self.file(uri).getFile(as_path=True) |
| 400 | md5_checksum = md5_for_file(local_file) |
| 401 | required_files[i]['md5_checksum'] = md5_checksum |
| 402 | for i in range(len(optional_files)): |
| 403 | uri = required_files[i]['source_uri'] |
| 404 | local_file = self.file(uri).getFile(as_path=True) |
| 405 | md5_checksum = md5_for_file(local_file) |
| 406 | required_files[i]['md5_checksum'] = md5_checksum |
| 407 | lock_md5_checksum = md5_for_str(str(manifest_file)) |
| 408 | manifest_file['lock_checksum'] = lock_md5_checksum |
| 409 | with open(manifest_output_dir + '/' + 'model_manifest.json.freeze', 'w') as f: |
| 410 | json.dump(manifest_file, f) |
| 411 | else: |
| 412 | print("Expected to find a model_manifest.json file, none was discovered in working directory") |
| 413 | |
| 414 | |
| 415 | def isJson(myjson): |
no test coverage detected