Skip to content

Add reconfig poll patch #1801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gkumbhat
Copy link

This patch is essentially porting the patch submitted by @njhill in PR #1518 to 2.4.0 version

Currently when the configured model list is updated via a call to handleReloadConfigRequest, the request thread blocks until any newly added models become available.

Their availability however depends on the filesystem polling thread rescanning the filesystem at some periodic interval, meaning that there's an arbitrary delay before the requested changes actually take effect and the RPC returns.

This problem may not be very noticeable with the default polling interval of 1 second, but seems undesirable for longer intervals and in particular makes API-based dynamic reconfiguration incompatible with the --file_system_poll_wait_seconds=0 setting (in this case all handleReloadConfigRequest calls time-out and do not take effect).

Fixes #1519

@google-cla
Copy link

google-cla bot commented Jan 22, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label Jan 22, 2021
@netfs netfs requested a review from christisg February 2, 2021 00:31
@gkumbhat gkumbhat marked this pull request as ready for review February 2, 2021 15:37
Copy link
Member

@christisg christisg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@@ -90,6 +90,9 @@ class FileSystemStoragePathSource : public Source<StoragePath> {
// such child.
Status PollFileSystemAndInvokeCallback();

// Logs servable version information
void LogVersions(const std::vector<ServableData<StoragePath>>& versions);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any reasons to make it a class method as its logic doesn't involve reading/manipulating class state. Can we remove this declaration from the .h file and add it as a function wrapped with anonymous namespace in the .cc file (the only place where it's used)?

CallAspiredVersionsCallback(servable, versions);
}
return Status::OK();
}

void FileSystemStoragePathSource::LogVersions(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per the other comment, let's put this implementation outside of the class definition, under anonymous namespace.

CallAspiredVersionsCallback(servable, versions);
}
return Status::OK();
}

void FileSystemStoragePathSource::LogVersions(
const std::vector<ServableData<StoragePath>>& versions) {
for (const ServableData<StoragePath> &version : versions) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use auto&

versions_by_servable_name;
Status FailIfZeroVersions(const FileSystemStoragePathSourceConfig& config,
std::map<string, std::vector<ServableData<StoragePath>>>&
versions_by_servable_name) {
TF_RETURN_IF_ERROR(
PollFileSystemForConfig(config, &versions_by_servable_name));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like PollFileSystemForConfig is already called in line 344. So it should be fine to remove it from here and pass a read-only arg versions_by_servable_name to FailIfZeroVersions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Aspired servables/versions aren't refreshed following config updates
2 participants