GithubHelp home page GithubHelp logo

Comments (4)

trel avatar trel commented on September 22, 2024

I think the get() at the end of create() is getting tripped up by being inside the AWS fabric and firing before the earlier COLL_CREATE_AN has a chance to 'settle'.

https://github.com/irods/python-irodsclient/blob/86a8f11a9399db29774c4096d83bba733a024ab6/irods/manager/collection_manager.py#L46

We can work around this scenario by catching the rare, but real, CollectionDoesNotExist exception and performing a small number of retries, perhaps with backoff.

Then, the lambda would not proceed until it got the 'go-ahead' that the Collection of interest does already exist in the iRODS catalog.

Something like...

                    try:
                        session.collections.create(irods_collection_name, recurse=True)
                    except CollectionDoesNotExist as e:
                        print('caught CollectionDoesNotExist, retrying...')
                        retries = 4
                        delay_in_seconds = 1.0
                        backoff_multiplier = 1.2
                        for i in range(retries):
                            retry_number = i+1
                            if retry_number == 1:
                                sleep_time = delay_in_seconds
                            else:
                                sleep_time = sleep_time * backoff_multiplier
                            print('retry [{}] ... sleeping for [{}]'.format(retry_number, sleep_time))
                            time.sleep(sleep_time)
                            try:
                                collection_created = session.collections.get(irods_collection_name)
                                break
                            except CollectionDoesNotExist:
                                pass
                        if not collection_created:
                            print('session.collections.create retried and still failed...')
                            raise e
                    except Exception as e:
                        print(e)

will create a PR for more easy commenting/review.

from irods_client_aws_lambda_s3.

korydraughn avatar korydraughn commented on September 22, 2024

I think the get() at the end of create() is getting tripped up by being inside the AWS fabric and firing before the earlier COLL_CREATE_AN has a chance to 'settle'.

But, wouldn't that make it impossible to trust python code in AWS Lambda? The API request for the create op is supposed to be complete by the time the response is captured.

from irods_client_aws_lambda_s3.

trel avatar trel commented on September 22, 2024

Agreed. And yet… here we are seeing failures for the get().

from irods_client_aws_lambda_s3.

trel avatar trel commented on September 22, 2024

and remember, there is a network call to iRODS in there... serviced by... who knows what fabric in the middle...

in fact, two network calls - the mkdir API call, and then the query API to 'see' the newly created collection.

from irods_client_aws_lambda_s3.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.