Skip to content

Commit

Permalink
Use current time when overwriting model configuration. (#304)
Browse files Browse the repository at this point in the history
This change changes the way `model_repository_manager` tracks when a model's
configuration was last updated. Instead of setting the tracked mtime to zero,
the current system time is used. This means that in order to reload the local
configuration file, a user will need to "touch" the config.pbtxt file such that
its mtime is greater than the mtime recorded when overwriting the model's
configuration values and then reload the model.

Test coverage will be added in the next commit.
  • Loading branch information
whoisj committed Jan 17, 2024
1 parent 39a0f64 commit 8c44c46
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/model_repository_manager/model_repository_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,11 @@ ModelRepositoryManager::InitializeModelInfo(
// When override happens, set 'mtime_nsec_' to minimum value so that
// the next load without override will trigger re-load to undo
// the override while the local files may still be unchanged.
linfo->mtime_nsec_ = std::make_pair(0, 0);
auto time_since_epoch =
std::chrono::system_clock::now().time_since_epoch();
linfo->mtime_nsec_.first =
std::chrono::duration_cast<std::chrono::nanoseconds>(time_since_epoch)
.count();
unmodified = false;

const std::string& override_config = override_parameter->ValueString();
Expand Down

0 comments on commit 8c44c46

Please sign in to comment.