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

session publish_array_to_public_bucket() method results in a 400 error #46

Open
mhearne-usgs opened this issue Jul 20, 2023 · 1 comment

Comments

@mhearne-usgs
Copy link

I'm trying to use sciencebasepy to test automated uploading of data, and running into this error:

python upload_gmprocess.py /data/gmprocess/comprehensive/data/ci14383980/workspace.h5
Password:
Uploading |################################| 8/8
<Response [400]>
Failed to publish file /data/gmprocess/comprehensive/data/ci14383980/workspace.h5 to public S3 bucket

The code snippet that results in the error:

        session = None
        try:
            session = sciencebasepy.SbSession().loginc(DEFAULT_USER)
            jdict_item = session.upload_file_and_create_item(
                PARENT_ITEM, str(metadata_filename)
            )
            item_id = jdict_item["id"]
            updated_item_id = session.upload_cloud_file_to_item(
                item_id, str(workspace_file)
            )
            assert updated_item_id["id"] == item_id
            session.publish_array_to_public_bucket(item_id, [str(workspace_file)])
        except Exception as e:
            print(
                f"Failed to login or upload file for user {DEFAULT_USER}. Error '{e}'. Exiting."
            )
            sys.exit(1)
        finally:
            if session is not None:
                session.logout()
@dignizio-usgs
Copy link
Member

@mhearne-usgs - Thanks for the note. Can you follow up via email and provide @ColinTalbert , @ennsk , and I the full Python file you're using? I'd like to review the item itself, verify that the publish works for the file(s) via UI, and then try to determine where this is breaking down. Have you been able to successfully run the code on other files and are just now hitting the error?

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

No branches or pull requests

2 participants