Skip to content

Commit

Permalink
Importer will now use the most recently created artifact when reusing…
Browse files Browse the repository at this point in the history
… an existing artifact instead of the one with the highest ID.

PiperOrigin-RevId: 479241179
  • Loading branch information
tfx-copybara committed Oct 6, 2022
1 parent 14c1518 commit 0d68333
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
`[tflite-support]` extra.
* Statistics gen and Schema gen now crash on empty input examples and statistics respectively.
* Importer will now check that an existing artifact has the same type as the intended output before reusing the existing artifact.
* Importer will now use the most recently created artifact when reusing an existing artifact instead of the one with the highest ID.

## Dependency Updates

Expand Down
3 changes: 2 additions & 1 deletion tfx/dsl/components/common/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ def _prepare_artifact(
# not explicitly ask for reimport, reuse that artifact.
if previous_artifacts:
absl.logging.info('Reusing existing artifact')
result.set_mlmd_artifact(max(previous_artifacts, key=lambda m: m.id))
result.set_mlmd_artifact(
max(previous_artifacts, key=lambda m: m.create_time_since_epoch))

return result

Expand Down

0 comments on commit 0d68333

Please sign in to comment.