Skip to content

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

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

Open
3 tasks
PabloVasconez opened this issue Jul 30, 2024 · 2 comments
Open
3 tasks

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

PabloVasconez opened this issue Jul 30, 2024 · 2 comments
Assignees

Comments

@PabloVasconez
Copy link
Contributor

PabloVasconez commented Jul 30, 2024

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.

@BasetimeBV
Copy link
Collaborator

Hi Pablo,
The problem lies with the policy/permissions I created in AWS, unless you used a credential file from Crux?
The measurements in the 'datacrux' were made for Crux to view if they could use it for their systems. The Class I created will only look in the S3 buckets 'baec', I have not set any other buckets to be compatible with the SettlementRodMeasurementSeries.
About your suggestions: I can implement the error_codes inside the repository, with an "Unrecognized status code" added if we have new error codes in the future, which are not yet updated in the repository.

Hope this explains the situation, we can discus the suggestion and choice a solution to fix this.

@PabloVasconez
Copy link
Contributor Author

Hi Tim,

Thanks for the reply. I used indeed the correct credentials for the bucket 'datacrux' (the ones you provides me months ago). So I was expecting the code to work. We want that the code works of course for 'baec', but it is also important that it works for any client of Basetime (such as 'Crux') so they can benefit from this repo.

Do you think that is achievable with the mentioned suggestions? At least regarding the error codes?

Perhaps something extra to take care is the region of the bucket. Are all the buckets always located in the same region? If that is not the case then the region should be also a variable.

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