Asynchronous skeleton generation and instituted low/high PubSub skeleton generation #298
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CAVEclient:SkeletonClient.get_skeleton()
has a new booleanasync_
parameter. If false, the function performs as before, blocking until a skeleton is generated and returned (which may be very quick if the skeleton is in the cache). Ifasync_
is passed as true, this function behaves identically from the user's perspective, blocking until a Skeleton is available and returned. In both cases, if a skeleton is in the cache already, it will probably return in a few seconds. In both cases, if a skeleton is missing from the cache, a skeleton is generated and then returned. However, in the new asynchronous case, skeleton generation is performed by publishing a request to the PubSub queue and then polling the cache periodically (every 5s) until the skeleton is available. The polling is performed on the server bySkeletonService
, not by the client ("over the wire" at a distance). It is debatable what utility this new method offers, but it supports high and low priority messaging. Skeletons generated this way go into the high priority queue.Note that the new low and high priority queues depend on a new version of
messaging-client
, which isn't officially deployed yet. I have forced it into LTV5 by hackingSkeletonService:requirements.txt
to pull from the relevant Github branch, but it is not published to PyPi yet. The same approach could be taken on minniev6 of course, and would safely only affectSkeletonService
since each repo/docker-image/kube-pod operates in isolation (all other repos usingmessaging-client
would continue to use the PyPi release), but ultimately, I'm unsure of the correct order of operations to fully deploy these various tools.CAVEclient:SkeletonClient.generate_bulk_skeletons_async()
works as before, but publishes requests to the low priority queue. Any skeletonization requests issued using the new option described above forget_skeleton()
will supersede those generated usinggenerate_bulk_skeletons_async()
.CAVEclient:SkeletonClient.get_bulk_skeletons()
has deprecated thegenerate_missing_skeletons
parameter. Although left in place for backward compatibility, the parameter is now ignored. Any skeleton that is missing is now published as a request on a the high priority queue with no corresponding skeleton return by this function. At some later time (presumably within about 1 minute) the skeleton will become available and can be retrieved simply be recalling this function with any root ids that did not previously produce skeletons. However, there is no practical way for the user to know if and when the skeleton is available without either callingskeletons_exist()
or simply recalling this function in an effort to retrieve the skeleton.Note that the last change mentioned above,
get_bulk_skeletons()
can effectively replace other channels into the skeleton service, most notablyget_skeleton()
, thereby simplifying the service (and likewise its front-end in CAVEclient). That would be the next step.