Skip to content
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

Restartable poller prototype #10102

Closed
wants to merge 2 commits into from
Closed

Restartable poller prototype #10102

wants to merge 2 commits into from

Conversation

lmazuel
Copy link
Member

@lmazuel lmazuel commented Mar 5, 2020

Implement a (not tested yet) restartable poller.

The idea is that autorest changes this (the callback currently generated):

        def get_long_running_output(pipeline_response):
            response_headers = {}
            response = pipeline_response.http_response
            response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation'))
            response_headers['Location']=self._deserialize('str', response.headers.get('Location'))
            response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After'))
            deserialized = self._deserialize('Product', pipeline_response)

            if cls:
                return cls(pipeline_response, deserialized, response_headers)
            return deserialized
...
    return LROPoller(self._client, raw_result, get_long_running_output, polling_method)

to this

deserializer = MsrestDeserializer(
   self._deserialize,
   'Product',
   {'Azure-AsyncOperation':'str',
    'Location':'str',
    'Retry-After':'int'},
   cls
)
...
return LROPoller(self._client, raw_result, deserializer, polling_method)

Then it's possible to do something like:

poller = client.begin_create()
import pickle
serialized_poller = pickle.dumps(poller)
...
poller = LROPoller.from_serialized(client, serialized_poller, cls=lambda x,y,z: y)

@lmazuel lmazuel self-assigned this Mar 5, 2020
@lmazuel
Copy link
Member Author

lmazuel commented Apr 10, 2020

See #10801 instead

@lmazuel lmazuel closed this Apr 10, 2020
@lmazuel lmazuel deleted the restartable_poller branch April 10, 2020 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant