Skip to content

Fix running a Model with footprint file via AwsS3Storage#49

Merged
sambles merged 4 commits into
developfrom
fix/execption-for-missing-file
Jun 11, 2026
Merged

Fix running a Model with footprint file via AwsS3Storage#49
sambles merged 4 commits into
developfrom
fix/execption-for-missing-file

Conversation

@sambles

@sambles sambles commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Fix running a Model with footprint file via AwsS3Storage

        try:
            lookup_file = self.storage.with_fileno(footprint_bin_lookup)
            with lookup_file as f:
                lookup = mmap.mmap(f.fileno(), length=0, access=mmap.ACCESS_READ)
            df = pickle.loads(lookup)


            self.events_dict = {
                row.event_id: (row.min_areaperil_id, row.max_areaperil_id)
                for row in df.itertuples(index=False)
            }
        except FileNotFoundError:
            self.events_dict = None

Before this fix that would cause TypeError, fixed so FileNotFoundError is raised when not found in bucket

  • Added public_bucket (bool) option that sets anon = True in the S3 client settings, (anonymous user) this need an explicit setting because it prevents boto3 'walking the chain' of credentials. (for example EC2 instance with an S3 access role attached)

@sambles sambles requested a review from vinulw June 11, 2026 09:20

@vinulw vinulw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@sambles sambles merged commit 141deed into develop Jun 11, 2026
3 checks passed
@sambles sambles deleted the fix/execption-for-missing-file branch June 11, 2026 15:06
@github-actions github-actions Bot mentioned this pull request Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants