Skip to content

Make error_codes.txt available for other buckets than baec #38

@PabloVasconez

Description

@PabloVasconez

When executing the following code I get the error below:

# Connect to the Measurements database
database = BaseTimeBucket(
    credentials=Credentials(),
    s3bucket="datacrux",
)

image

The error actually comes from the following line. I suspect it simply doesn't find the error_codes.txt in the bucket.

image

Since we are looking for a general solution, it is perhaps the best to add the error_codes.txt to the repo, under measurements/io and with the name basetime_error_codes.txt and parse it in the file basetime.py but outside the BaseTimeBucket class with the name BASETIME_ERROR_CODES. It is perhaps good to add a function as in the file zbase.py to get the error code and in case it is not found to add an "Unrecognized status code". See below:

image

In short, my suggestion is to:

  • Add the error_codes.txt (or even as a .json file already) to the repo under the name basetime_error_codes. Note that this will mean you need to maintain the file up to date in the repo, with the advantage that you only need to add it properly in one place.
  • Parse it to a dictionary BASETIME_ERROR_CODES outside the BaseTimeBucket class.
  • Add a function to get the error code from the dictionary and if not found, give an "Unrecognized status code".

Of course I am happy to hear about other suggestions on how to solve this issue.

Metadata

Metadata

Labels

enhancementNew feature or requestpythonPull requests that update Python code

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions